PgSetTranslation(), PgSetTranslationCx()

Translate draw commands horizontally and vertically

Synopsis:

void PgSetTranslation ( PhPoint_t const *translation,
                        int flags );

void PgSetTranslationCx ( PhGC_t *gc,
                          PhPoint_t const *translation,
                          int flags );

Library:

ph

Description:

These functions cause all subsequent draw commands to be translated by translation->x pixels horizontally and translation->y pixels vertically. The default translation is (0,0). You can set flags to:

0
The translation is absolute, and replaces the current one.
Pg_RELATIVE
The translation is relative to the current translation, and is added to it.

PgSetTranslation() works on the current graphics context, while you can specify the graphics context gc for PgSetTranslationCx().

Examples:

Draw a square from (100,100) to (200,200):

PhPoint_t translation;

PgSetFillColor( Pg_RED );
translation.x = translation.y = 100;
PgSetTranslation( &translation, Pg_RELATIVE );
PgDrawIRect( 0, 0, 100, 100, Pg_DRAW_FILL );

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgClearTranslation*(), PhPoint_t

PtRaw widget in the Raw Drawing and Animation chapter of the Photon Programmer's Guide