SetTransformation

The SetTransformation function sets a two-dimensional linear transformation of the coordinate space. This transformation can be used to scale, rotate, shear, or translate graphics output.

SetTransformation eM11,eM12,eM21,eM22,eDx,eDy

Parameters

For any coordinates (x,y) in the coordinate space, the transformed coordinates (x',y') can be determined by the following algorithm:

x' = x * eM11 + y * eM21 + eDx, 
y' = x * eM12 + y * eM22 + eDy, 
eM11
Specifies the following:
OperationMeaning
Scaling Horizontal scaling component
Rotation Cosine of rotation angle
Reflection Horizontal component

eM12
Specifies the following:
OperationMeaning
Shear Horizontal proportionality constant
Rotation Sine of the rotation angle

eM21
Specifies the following:
OperationMeaning
Shear Vertical proportionality constant
Rotation Negative sine of the rotation angle

eM22
Specifies the following:
OperationMeaning
Scaling Vertical scaling component
Rotation Cosine of rotation angle
Reflection Vertical component

eDx
Specifies the horizontal translation component.

eDy
Specifies the vertical translation component.

Return values

True if successful, otherwise False.

Remarks

The default transformation is the identity matrix with zero offset:
eM11=1.0, eM12=0.0, eM21=0.0, eM22=1.0, eDx=0.0, eDy=0.0

The SetTransformation function will fail unless the graphics mode has been set to GM_ADVANCED by previously calling the SetGraphicsMode function. Likewise, it will not be possible to reset the graphics mode to the default GM_COMPATIBLE mode, unless the world transformation has first been reset to the default identity transformation by calling SetTransformation(1.0, 0.0, 0.0, 1.0, 0.0, 0.0).

You can not return to COMPATIBLE mode from ADVANCED, if you changed the default transformation settings. You should change settings to default first.

The following tabe shows how you should set every member for each operation:
Operation xM11 xM12 xM21 xM22
Rotation Cosine Sine Negative sine Cosine
Scaling Horizontal scaling component Zero Zero Vertical scaling component
Shear Zero Horizontal Proportionality Constant Vertical Proportionality Constant Zero
Reflection Horizontal Reflection Component Zero Zero Vertical Reflection Component

Example
View result

<%@ Language=VBScript %>
<%
Response.ContentType="image/gif"
set obj=Server.CreateObject("shotgraph.image")

size=400
obj.CreateImage size,size,2
obj.SetColor 0,255,255,255
obj.SetColor 1,0,0,0
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1

obj.SetDrawColor 1
obj.CreateBrush "BS_NULL",0,""
obj.SetGraphicsMode "GM_ADVANCED"
for i=0 to 179 step 10
	ang=i*3.141/180.0
	'Rotate the drawing
	obj.SetTransformation Cos(ang),Sin(ang),-Sin(ang),Cos(ang),size/2,size/2
	obj.Ellipse -size/2,-size/4,size/2-2,size/4-2
next

img=obj.GifImage(-1,1,"")
Response.BinaryWrite(img)
%>