VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Annotation.Formatters Namespace / AnnotationVintasoftBinaryFormatter Class
Members Example



In This Topic
    AnnotationVintasoftBinaryFormatter Class
    In This Topic
    Serializes annotations to and from Vintasoft's binary format.
    Object Model
    AnnotationVintasoftBinaryFormatter ClassResolution Structure
    Syntax
    'Declaration
     
    Public Class AnnotationVintasoftBinaryFormatter 
       Inherits AnnotationFormatter
    public class AnnotationVintasoftBinaryFormatter : AnnotationFormatter 
    public __gc class AnnotationVintasoftBinaryFormatter : public AnnotationFormatter 
    public ref class AnnotationVintasoftBinaryFormatter : public AnnotationFormatter 
    Example
    This example shows how to save an annotation collection of image to the file using VintaSoft Binary formatter.
    ' 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 controller associated with image collection.
    Dim annotationDataController As New Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection)
                
    ' Create a rectangle annotation.
    Dim rectangleAnnotationData As New Vintasoft.Imaging.Annotation.RectangleAnnotationData()
    rectangleAnnotationData.Location = New System.Drawing.PointF(32, 27)
    rectangleAnnotationData.Size = New System.Drawing.SizeF(38, 35)
    ' Add the rectangle annotation to the annotation collection of first image.
    annotationDataController(0).Add(rectangleAnnotationData)
                
    ' Create a line annotation.
    Dim lineAnnotationData As New Vintasoft.Imaging.Annotation.LineAnnotationData()
    lineAnnotationData.Location = New System.Drawing.PointF(17, 66)
    lineAnnotationData.EndPoint = New System.Drawing.PointF(51, 50)
    ' Add the line annotation to the annotation collection of first image.
    annotationDataController(0).Add(lineAnnotationData)
                
    ' Create an ellipse annotation.
    Dim ellipseAnnotationData As New Vintasoft.Imaging.Annotation.EllipseAnnotationData()
    ellipseAnnotationData.Location = New System.Drawing.PointF(115, 45)
    ellipseAnnotationData.Size = New System.Drawing.SizeF(66, 64)
    ' Add the ellipse annotation to the annotation collection of first image.
    annotationDataController(0).Add(ellipseAnnotationData)
                
    ' Create a VintaSoft Binary formmater.
    Dim binaryFormatter As New Vintasoft.Imaging.Annotation.Formatters.AnnotationVintasoftBinaryFormatter()
    ' Create a file where VintaSoft Binary packet will be saved.
    Using file As New System.IO.FileStream("D:\Annotations.vsab", System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite)
        ' Get a reference to the annotation collection of first image.
        Dim annotationDataCollection As Vintasoft.Imaging.Annotation.AnnotationDataCollection = annotationDataController(0)
        ' Save annotation collection to the file using VintaSoft Binary formatter.
        binaryFormatter.Serialize(file, annotationDataCollection)
    End Using
    // 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 controller associated with image collection.
    Vintasoft.Imaging.Annotation.AnnotationDataController annotationDataController = 
        new Vintasoft.Imaging.Annotation.AnnotationDataController(imageCollection);
                
    // Create a rectangle annotation.
    Vintasoft.Imaging.Annotation.RectangleAnnotationData rectangleAnnotationData = 
        new Vintasoft.Imaging.Annotation.RectangleAnnotationData();
    rectangleAnnotationData.Location = new System.Drawing.PointF(32, 27);
    rectangleAnnotationData.Size = new System.Drawing.SizeF(38, 35);
    // Add the rectangle annotation to the annotation collection of first image.
    annotationDataController[0].Add(rectangleAnnotationData);
                
    // Create a line annotation.
    Vintasoft.Imaging.Annotation.LineAnnotationData lineAnnotationData = 
        new Vintasoft.Imaging.Annotation.LineAnnotationData();
    lineAnnotationData.Location = new System.Drawing.PointF(17, 66);
    lineAnnotationData.EndPoint = new System.Drawing.PointF(51, 50);
    // Add the line annotation to the annotation collection of first image.
    annotationDataController[0].Add(lineAnnotationData);
                
    // Create an ellipse annotation.
    Vintasoft.Imaging.Annotation.EllipseAnnotationData ellipseAnnotationData = 
        new Vintasoft.Imaging.Annotation.EllipseAnnotationData();
    ellipseAnnotationData.Location = new System.Drawing.PointF(115, 45);
    ellipseAnnotationData.Size = new System.Drawing.SizeF(66, 64);
    // Add the ellipse annotation to the annotation collection of first image.
    annotationDataController[0].Add(ellipseAnnotationData);
                
    // Create a VintaSoft Binary formmater.
    Vintasoft.Imaging.Annotation.Formatters.AnnotationVintasoftBinaryFormatter binaryFormatter = 
        new Vintasoft.Imaging.Annotation.Formatters.AnnotationVintasoftBinaryFormatter();
    // Create a file where VintaSoft Binary packet will be saved.
    using (System.IO.FileStream file = new System.IO.FileStream(@"D:\Annotations.vsab", 
        System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite))
    {
        // Get a reference to the annotation collection of first image.
        Vintasoft.Imaging.Annotation.AnnotationDataCollection annotationDataCollection = annotationDataController[0];
        // Save annotation collection to the file using VintaSoft Binary formatter.
        binaryFormatter.Serialize(file, annotationDataCollection);
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Annotation.Formatters.AnnotationFormatter
          Vintasoft.Imaging.Annotation.Formatters.AnnotationVintasoftBinaryFormatter

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also