TransformLayer -- apply affine transformation to a layer (V4.5)
TransformLayer(id, sx, rx, ry, sy[, smooth])
This function can be used to apply affine transformation to a layer. You have to pass a 2x2 transformation matrix to this function that will define how each point in the layer will be transformed. This function is useful if you want to apply rotation and scaling at the same time. The optional argument smooth can be set to True if Hollywood should use interpolation during the transformation. This yields results that look better but interpolation is quite slow.

When the specified layer is a vector layer (e.g. circle, polygon, true type text or a rectangle) Hollywood will be able to transform the layer without any loss in quality because vector graphics can be freely transformed. Thus, the smooth argument does not have any function if the specified layer is a vector layer. If the layer contains a pixel image, however, normal pixel-based affine transformation routines will be used.

In contrast to transforming brushes using TransformBrush() layers always keep their original data so there will not be any loss in quality if you transform a layer to (20,15) and then back to (640,480). This is perfectly possible.

See TransformBrush for more information about how to set up a transformation matrix.

identifier of the layer to be transformed
scale x factor; must never be 0
rotate x factor
rotate y factor
scale y factor; must never be 0
optional: whether or not affine transformation should use interpolation
angle = Rad(45)    ; convert degrees to radians
TransformLayer(1, Cos(angle), Sin(angle), -Sin(angle), Cos(angle))
The code above rotates layer number 1 by 45 degrees using a 2x2 transformation matrix.

Show TOC