Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: RT.Util.Drawing.GraphicsTransformer

Summary

Provides a way to temporarily modify the Transform of a System.Drawing.Graphics object by enclosing the affected code in a “using” scope.

Example

The following example demonstrates how GraphicsTransformer can be used to render graphics translated.

var g = Graphics.FromImage(...);
using (new GraphicsTransformer(g).Translate(15, 10))
{
    // As this is inside the scope of the GraphicsTransformer, the rectangle is translated 15 pixels to the right and 10 down.
    g.DrawRectangle(20, 20, 100, 100);
}

// As this statement is outside the scope of the GraphicsTransformer, the rectangle is not translated.
// The net effect is that two rectangles are rendered even though both calls use the same co-ordinates.
g.DrawRectangle(20, 20, 100, 100);

Constructors

Instantiates a new GraphicsTransformer instance. Use this in a “using” statement.

Instance methods

void
  • Implements: IDisposable.Dispose()
Returns the Transform of the Graphics object back to its original value.
GraphicsTransformer
Rotate(float angle)
Rotates the graphics by the specified angle in degrees.
GraphicsTransformer
RotateAt(float angle, PointF point)
Rotates the graphics clockwise by the specified angle in degrees about the specified center point.
GraphicsTransformer
RotateAt(float angle, float x, float y)
GraphicsTransformer
Scale(float scaleX, float scaleY)
Scales the graphics by the specified factors.
GraphicsTransformer
Scale(double scaleX, double scaleY)
GraphicsTransformer
Translate(float offsetX, float offsetY)
Translates the graphics by the specified amount.
GraphicsTransformer
Translate(double offsetX, double offsetY)