Link between annotation data and view collections in WinForms
In This Topic
from the
AnnotationDataController and one
AnnotationViewCollection.
AnnotationViewController class allows to:
Here is an example that shows how to load an image collection, add annotation to the first image, burn annotation on the image and save the image collection to a new file:
// Create the image collection and add images to collection.
Vintasoft.Imaging.ImageCollection imageCollection =
new Vintasoft.Imaging.ImageCollection();
imageCollection.Add(@"D:\Images\AutoContrast.jpg");
imageCollection.Add(@"D:\Images\AutoColors.jpg");
// Create annotation controllers associated with image collection.
Vintasoft.Imaging.Annotation.AnnotationDataController annotationDataController =
new Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection);
Vintasoft.Imaging.Annotation.UI.AnnotationViewController annotationViewController =
new Vintasoft.Imaging.Annotation.UI.AnnotationViewController(annotationDataController);
// Create a data of rectangle annotation.
Vintasoft.Imaging.Annotation.RectangleAnnotationData rectangleAnnotationData =
new Vintasoft.Imaging.Annotation.RectangleAnnotationData();
rectangleAnnotationData.Location = new System.Drawing.PointF(340, 150);
rectangleAnnotationData.Size = new System.Drawing.SizeF(220, 150);
// Create a view of rectangle annotation.
Vintasoft.Imaging.Annotation.UI.RectangleAnnotationView rectangleAnnotationView =
new Vintasoft.Imaging.Annotation.UI.RectangleAnnotationView(rectangleAnnotationData);
// Add the rectangle annotation to the annotation controller.
annotationViewController[0].Add(rectangleAnnotationView);
// Burn annotation collection on the first image.
annotationViewController.BurnAnnotationCollectionOnImage(0);
// Save image collection to TIFF file.
imageCollection.SaveSync(@"D:\ImageCollection.tif", true);
' Create the image collection and add images to collection.
Dim imageCollection As New Vintasoft.Imaging.ImageCollection()
imageCollection.Add("D:\Images\AutoContrast.jpg")
imageCollection.Add("D:\Images\AutoColors.jpg")
' Create annotation controllers associated with image collection.
Dim annotationDataController As New Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection)
Dim annotationViewController As New Vintasoft.Imaging.Annotation.UI.AnnotationViewController(annotationDataController)
' Create a data of rectangle annotation.
Dim rectangleAnnotationData As New Vintasoft.Imaging.Annotation.RectangleAnnotationData()
rectangleAnnotationData.Location = New System.Drawing.PointF(340, 150)
rectangleAnnotationData.Size = New System.Drawing.SizeF(220, 150)
' Create a view of rectangle annotation.
Dim rectangleAnnotationView As New Vintasoft.Imaging.Annotation.UI.RectangleAnnotationView(rectangleAnnotationData)
' Add the rectangle annotation to the annotation controller.
annotationViewController(0).Add(rectangleAnnotationView)
' Burn annotation collection on the first image.
annotationViewController.BurnAnnotationCollectionOnImage(0)
' Save image collection to TIFF file.
imageCollection.SaveSync("D:\ImageCollection.tif", True)
Access to collections of annotations
The image collection, which connections are stored in controller, may be get using
AnnotationViewController.Images property.
The collections of annotation data can be accessed using
AnnotationViewController.DataController property.
The collections of annotation's visual appearances can be accessed via indexer.