VintaSoft Imaging .NET SDK 12.0: Documentation for .NET developer
Vintasoft.Imaging.Drawing Namespace / DrawingEngine Class / Transform Property
Example



In This Topic
    Transform Property (DrawingEngine)
    In This Topic
    Gets or sets a copy of the geometric world transformation for this drawing engine.
    Syntax
    'Declaration
     
    Public MustOverride Property Transform As AffineMatrix
    public abstract AffineMatrix Transform {get; set;}
    public: __property abstract AffineMatrix* get_Transform();
    public: __property abstract void set_Transform( 
       AffineMatrix* value
    );
    public:
    abstract property AffineMatrix^ Transform {
       AffineMatrix^ get();
       void set (    AffineMatrix^ value);
    }

    Property Value

    A copy of the Vintasoft.Imaging.AffineMatrix that represents the geometric world transformation for this drawing engine.
    Example
    Here is an example that shows how to change engine transformation using DrawingEngine.Transform property.
    ''' <summary>
    ''' Draws an image on specified drawing engine.
    ''' </summary>
    ''' <param name="drawingEngine">Drawing engine.</param>
    ''' <param name="area">Area to draw objects in.</param>
    Public Shared Sub DrawImageExample(drawingEngine As DrawingEngine, area As RectangleF)
        ' path to image file for drawing
        ' this image is located in <install path>/VintaSoft/Imaging .NET/Images/
        Dim imagePath As String = "AutoContrast.jpg"
                
        ' create VintaSoft image
        Using image As New VintasoftImage(imagePath)
            ' create transform holder to save current engine transform and restore it aftewards
            Using drawingEngine.CreateTransformHolder()
                ' create image destination rectangle
                Dim imageRect As New RectangleF(area.X + area.Width * 0.25F, area.Y + area.Height * 0.25F, area.Width / 2, area.Height / 2)
                ' apply rotation transform to drawing engine
                drawingEngine.Transform = AffineMatrix.CreateRotation(35, imageRect.X + imageRect.Width / 2, imageRect.Y + imageRect.Height / 2)
                ' draw image
                drawingEngine.DrawImage(image, imageRect)
            End Using
        End Using
    End Sub
    /// <summary>
    /// Draws an image on specified drawing engine.
    /// </summary>
    /// <param name="drawingEngine">Drawing engine.</param>
    /// <param name="area">Area to draw objects in.</param>
    public static void DrawImageExample(DrawingEngine drawingEngine, RectangleF area)
    {
        // path to image file for drawing
        // this image is located in <install path>/VintaSoft/Imaging .NET/Images/
        string imagePath = "AutoContrast.jpg";
                
        // create VintaSoft image
        using (VintasoftImage image = new VintasoftImage(imagePath))
        // create transform holder to save current engine transform and restore it aftewards
        using (drawingEngine.CreateTransformHolder())
        {
            // create image destination rectangle
            RectangleF imageRect = new RectangleF(area.X + area.Width * 0.25f, area.Y + area.Height * 0.25f, area.Width / 2, area.Height / 2);
            // apply rotation transform to drawing engine
            drawingEngine.Transform = AffineMatrix.CreateRotation(35, imageRect.X + imageRect.Width / 2, imageRect.Y + imageRect.Height / 2);
            // draw image
            drawingEngine.DrawImage(image, imageRect);
        }
    }
    Requirements

    Target Platforms: .NET 6; .NET 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also