Using ObjectAffineDistort command
Corel PHOTOPAINT is a bitmap editing application which means it works
with bitmap images. Sometimes those bitmap are really huge and opertations
on those bitmap could take awhile to complete.
Frequently it is necessary to perform several consecutive
transformations on a single object (e.g. stretch it, then rotate and
skew). And not even it could take long to perform each individual
operation, each transformation reduces the quality of the image by adding
more blur to it.
Fortunately there is a way to combine different types of
transformations (stretch, rotation and skew) into one transformation
command and do them all at once. This speeds up the transformation and
provides better result. This magic scripting command is ObjectAffineDistort.
This command uses a transformation matrix to perform the
transformation. A transformation matrix is four numbers that include three
transformations.
If a is a rotation angle, b
is a skew angle, and D_{x} and D_{y} are horizontal and
vertical stretch factors, then the transformation matrix will look like:
Each matrix element is referred to as D_{11}, D_{12}, D_{21},
and D_{22} respectively (left to right, top to bottom).
ObjectAffineDistort command takes the four transformation matrix
elements, the translation values to perform the transformation, and
a boolean indicating whether or not use antialiasing. The translation
values show the position of the lower left corner of the transformed
object relatively to the lower left corner of the document.
So, here is an example of how to apply rotation, skew and stretch to an
object at one step. (You can use it to apply even one transformation only
though  just use 1 for each "unused" stretch values and 0 for
each angle).
Note the order of matrix elements. They go in the following order: D_{11},
D_{21}, D_{12}, D_{22}, not .., D_{12}, D_{21},...
WITHOBJECT "CorelPhotoPaint.Automation.9"
a#=ANGLECONVERT(1,2,20)
b#=ANGLECONVERT(1,2,10)
Dx#=0.5
Dy#=0.5
D11#=Dx*Cos(a)
D12#=Dy*Sin(a+b)
D21#=Dx*Sin(a)
D22#=Dy*Cos(a+b)
.ObjectAffineDistort 0, 0, D11, D21, D12, D22, TRUE
.ObjectSelectNone
.ObjectSelect 1, TRUE
.EndObject
END WITHOBJECT
