Each time one of the transformation functions is called by an application, the application can set the function's option parameter to control how the function combines the transformation with existing transformations and in what order the transformations are applied.

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³If the application uses this flag...³Then the operating      ³
³                                    ³system...               ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³TRANSFORM_REPLACE                   ³Replaces any existing   ³
³                                    ³transformations with the³
³                                    ³new transformation. The ³
³                                    ³existing value of the   ³
³                                    ³matrix is discarded and ³
³                                    ³replaced by straight    ³
³                                    ³substitution.           ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³TRANSFORM_PREEMPT                   ³Applies the new         ³
³                                    ³transformation before   ³
³                                    ³applying the existing   ³
³                                    ³transformation.         ³
³                                    ³The transformation      ³
³                                    ³matrix of the new       ³
³                                    ³transformation is       ³
³                                    ³pre-multiplied with the ³
³                                    ³transformation matrix of³
³                                    ³the current             ³
³                                    ³transformation.         ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³TRANSFORM_ADD                       ³Applies the new         ³
³                                    ³transformation after    ³
³                                    ³applying the existing   ³
³                                    ³transformation.         ³
³                                    ³The transformation      ³
³                                    ³matrix of the new       ³
³                                    ³transformation is       ³
³                                    ³post-multiplied with the³
³                                    ³transformation matrix of³
³                                    ³the current             ³
³                                    ³transformation.         ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

The order in which transformations are applied affects the appearance of the picture. For example, suppose that a box primitive has been defined, with its lower-left corner at (4,2) and its upper-right corner at (8,8), and that you want both to scale the box by 0.5 and to translate it by (-10,-10).

If the box is translated before scaling it, the transformed box is as shown in the following figure.

Translating before Scaling

The translated box has its lower-left corner at (-6,-8), and its upper-right corner at (-2,-2). Each of its coordinates is then scaled by 0.5, and the transformed box has its corners at (-3,-1), (-1,-1), (-3,-4), and (-1,-4).

If the box is scaled before translating it, the transformed box is as shown in the figure after the following figure.

Scaling before Translating

The scaled box has its lower-left corner at (2,1), and its upper-right corner at (4,4). The box is then translated by (-10,-10), and the transformed box has its corners at (-8,-6), (-6,-6), (-6,-9), and (-8,-9).

When an application is drawing a picture in which there are called segments, and in which transformations are applied to the root segments, the root-segment transformations should usually be applied to any segments they call. For example, if a segment that is translated to the left of the picture (by changing its segment transformation) calls a second segment, that leftward transformation should also be applied to the called segment. In this instance, the application would specify TRANSFORM_ADD in the call to GpiCallSegmentMatrix to add the instance transformation to the calling segments' segment transformation. Instance transformations are automatically reset on return to the calling segment.


[Back] [Next]