Graphics.Transform Property

Gets or sets a transformation matrix for this Graphics.

Namespace: Aurigma.GraphicsMill.AdvancedDrawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public Matrix Transform { get; set; }

Property Value

The transformation matrix for this Graphics.

Remarks

If the matrix defines some transformation, then all objects that are drawn on the Graphics after the transformation is set will undergo this transformation. By default no transformation is set.

Examples

C#
using (var bitmap = new Bitmap(640, 480, PixelFormat.Format24bppRgb, RgbColor.White))
using (var graphics = bitmap.GetAdvancedGraphics())
{

    graphics.DrawEllipse(new Pen(RgbColor.Red, 2f), 0, 0, bitmap.Width / 2, bitmap.Height / 4);

    // Translate coordinates and rotate
    var matrix = new System.Drawing.Drawing2D.Matrix();
    matrix.Translate(bitmap.Width / 3, bitmap.Height / 3);
    matrix.Rotate(30);
    graphics.Transform = matrix;

    graphics.DrawEllipse(new Pen(RgbColor.Green, 2f), 0, 0, bitmap.Width / 2, bitmap.Height / 4);

    bitmap.Save(@"Images\Output\graphicsTransform.jpg");
}

See Also

Reference

Manual