![]() ![]() |
CImage:Affine
The Affine method applies an affine transformation of shift, scale, and rotation to the image.
bResult = CImage:Affine( nX, nY, nAngle, nScale, bResize=false )
nX and nY specify the
shifts, in pixel units.
nAngle is the rotation angle, in degrees.
nScale is the magnification relative to 1.0.
bResize is optional and controls whether the image
is expanded to hold the scaled image.
On success,
true is returned,
otherwise false is
returned.
The affine transformation shifts the image center, then applies the rotation and the scale factor.
The following script fragment shifts the image 10 pixels in x and 20.52 in y, rotates -30.25 degrees, and scales by 1.2 times:
I = CImage:new() |
-- create a new CImage |
nX = 10 ; nY = 20.52 |
-- shifts |
A = -30.25 ; M = 1.2 |
-- angle and magnification |
I:Affine( nX, nY, A, M ) |
-- perform the operation on image I |