[Previous] [Contents] [Index] [Next]

PgFlush(), PgFFlush()

Explicitly flush the current draw buffer

Synopsis:

int PgFlush( void );

int PgFFlush( unsigned int flags );

Description:

These functions flush the current draw buffer and then clear it. Most applications call PgFlush(); you need to call PgFFlush() only if you need to specify the type of draw event.

Normally, you set flags to Ph_NORMAL_DRAW; this is the same as calling PgFlush(). But if your application has received an expose event with a subtype of Ph_CAPTURE_EXPOSE, you should encapsulate your drawing events by calling

PgFFlush( Ph_START_DRAW );

before drawing anything, and

PgFFlush( Ph_DONE_DRAW ); 

after the entire exposed region has been redrawn. If you're using widgets, PtEventHandler() makes both these calls automatically.

Any function that builds a command in the draw buffer calls PgFlush() automatically when the draw buffer becomes full.

Returns:

0
Successful completion.
-1
An error occurred.

Examples:

/*
 * Place a group of 3 lines in the draw buffer
 */
PgDrawILine( 100, 100, 200, 300 );
PgDrawILine( 200, 300, 700, 700 );
PgDrawILine( 700, 700, 0,   0   );

/*
 * Emit a draw event that contains those 3 lines
 */
PgFlush();

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgClearDrawBuffer(), PgSetDrawBufferSize(), PhEvent_t


[Previous] [Contents] [Index] [Next]