|
A number of different types of transform
exist. You can specify a range of transforms for any object you
are drawing, applying them to text, pictures, shapes and lines.
For instance:
- You can rotate an object a number of degrees around a point.
- You can translate (move) an object.
- You can scale or stretch an object.
- You can skew an object (a shear or perspective type of operation).
- You can pin a transformed object to a particular location
- You can limit the height or width of a transformed object
Any drawable object can be transformed, but be careful about the
order you apply transforms as this can result in objects being 'lost'
off the edge of your Canvas.
In the examples below the light blue area represents the canvas
we are drawing on. Areas outside the canvas are shown to illustrate
how objects may be fully or partially 'lost' outside the canvas.
For instance if you first move an object right (1) and then rotate
it by 45 degrees round the origin (2),

the effect can be completely different than if you rotate the object
and then move it,

If you wish to ensure that an object always stays in the same place
you can apply a pin transform. In the example below we apply a rotation
of 45 degrees round the origin, then we pin the rotated object to
a location on our canvas. A pin operates on the top left corner
of the bounding rectangle of the transformed object. In our case
the top left is at position (1). Our pin location is at point (2)
and so the image has to be shifted over until point (1) has been
pinned to position (2).

Try to avoid mixing positioning
parameters and transform
parameters as the results can be confusing. If you have to you
should bear in mind that the positioning of objects is always calculated
before the transform is applied.
|