Transform Свойство (DrawingEngine)
Возвращает или задает копию преобразования геометрического мира для этого механизма рисования.
Property Value
Копия
AffineMatrix, которая представляет преобразование геометрического мира для этого механизма рисования.
Вот пример, показывающий, как изменить преобразование механизма с помощью свойства DrawingEngine.Transform.
''' <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);
}
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5