Caution: This version of this document is no longer maintained. For the latest documentation, see

PgFlush(), PgFFlush(), PgFlushCx(), PgFFlushCx()

Explicitly flush the current draw buffer


int PgFlush( void );

int PgFFlush( unsigned int flags );

int PgFlushCx( void *dc );

int PgFFlushCx( void *dc,
                unsigned int flags );




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.

PgFlush() and PgFFlush() work on the current draw context, while you can specify the draw context dc for PgFlushCx() and PgFFlushCx().


Successful completion.
An error occurred.


 * 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



Interrupt handler No
Signal handler No
Thread No

See also:

PgClearDrawBuffer*(), PgSetDrawBufferSize*(), PhEvent_t