VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Drawing Namespace / DrawingEngine Class / RenderImage Methods / RenderImage(VintasoftImage,RectangleF) Method
Syntax Example Requirements SeeAlso
In This Topic
    RenderImage(VintasoftImage,RectangleF) Method (DrawingEngine)
    In This Topic
    Renders the specified VintasoftImage in the specified rectangle.
    Syntax

    Parameters

    image
    The VintasoftImage to render.
    destRect
    The System.Drawing.RectangleF structure that specifies the location and size of the rendering image.
    Example

    Here is an example that shows how to render image using drawing engine.

    
    ''' <summary>
    ''' Renders a vector image on specified drawing engine.
    ''' </summary>
    ''' <param name="drawingEngine">Drawing engine.</param>
    ''' <param name="area">Area to draw objects in.</param>
    Public Shared Sub RenderImageExample(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 = "PdfTextFields.pdf"
    
        ' 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 source rectangle, a part of image to draw
                Dim sourceImageRect As New RectangleF(0, 0, image.Width, image.Height * 0.5F)
                ' create image destination rectangle
                Dim destImageRect As New RectangleF(area.X, area.Y, area.Width * 0.5F, area.Height * 0.9F)
                ' apply skew transform to drawing engine
                drawingEngine.Transform = New AffineMatrix(1, 0, 0.2F, 1, 0, 0)
                ' draw image
                drawingEngine.RenderImage(image, destImageRect, sourceImageRect)
            End Using
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Renders a vector image on specified drawing engine.
    /// </summary>
    /// <param name="drawingEngine">Drawing engine.</param>
    /// <param name="area">Area to draw objects in.</param>
    public static void RenderImageExample(DrawingEngine drawingEngine, RectangleF area)
    {
        // path to image file for drawing
        // this image is located in <install path>/VintaSoft/Imaging .NET/Images/
        string imagePath = "PdfTextFields.pdf";
    
        // 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 source rectangle, a part of image to draw
            RectangleF sourceImageRect = new RectangleF(0, 0, image.Width, image.Height * 0.5f);
            // create image destination rectangle
            RectangleF destImageRect = new RectangleF(area.X, area.Y, area.Width * 0.5f, area.Height * 0.9f);
            // apply skew transform to drawing engine
            drawingEngine.Transform = new AffineMatrix(1, 0, 0.2f, 1, 0, 0);
            // draw image
            drawingEngine.RenderImage(image, destImageRect, sourceImageRect);
        }
    }
    
    

    Requirements

    Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also