RenderImage(VintasoftImage,RectangleF,RectangleF) Метод (DrawingEngine)
Отрисовывает указанную часть указанного
VintasoftImage в указанном прямоугольнике.
Вот пример, показывающий, как визуализировать изображение с помощью механизма рисования.
''' <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);
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5