Easy Way to Learn ASP.NET

GDI+ Tutorial

GDI+ Introduction
GDI+ Lines
GDI+ Rectangles
GDI+ Ellipses
GDI+ Arcs
GDI+ Polygons
GDI+ Cardinal Splines
GDI+ Bezier Splines
GDI+ Graphics Paths
GDI+ Brushes
GDI+ Regions
GDI+ Antialiasing
GDI+ Bitmaps
GDI+ Metafiles
GDI+ Transformations
GDI+ Text

Transformations in GDI+

GDI+ provides matrix transformation so that you can transform (rotate, scale, translate, and so on) the items you draw.

The Graphics class provides several methods to transform an image: RotateTransform, ScaleTransform, and TranslateTransform.


RotateTransform

RotateTransform is a method of the Graphics class to apply rotate transformation to the image.

The following is the syntax of the RotateTransform method:

RotateTransform(ByVal angle As Single)

or

RotateTransform(ByVal angle As Single, ByVal order As System.Drawing.Drawing2D.MatrixOrder)

The following code example demonstrates how to apply rotate transformation:

 


ScaleTransform

ScaleTransform is a method of the Graphics class that function to apply scale transformation to the image.

The following is the syntax of the ScaleTransform method:

ScaleTransform(ByVal sx As Single, ByVal sy As Single)

or

ScaleTransform(ByVal sx As Single, ByVal sy As Single, ByVal order As System.Drawing.Drawing2D.MatrixOrder)

The following code example demonstrates how to apply scale transformation to an image:

 


TranslateTransform

TranslateTransform is a method of the Graphics class that function to change the origin of the coordinate system.

The following is the syntax of the TranslateTransform method:

TranslateTransform(ByVal dx As Single, ByVal dy As Single)

or

TranslateTransform(ByVal dx As Single, ByVal dy As Single, ByVal order As System.Drawing.Drawing2D.MatrixOrder)

The following code example demonstrates how to apply translate transformation: