Buffering
There are situations where it is not desired that drawing
operations immediately draw into the drawing area of a window
and where it is useful to construct the entire drawing in a memory
buffer before copying it (or parts of it) into the drawing
area of the window.
On the right there is a screenshot of the example
program "Bouncing LEDA".
|
|
Examples for Buffering
Applications
- Animations where one wants to display a sequence of snapshots
of a scene that changes over time
- Creation of a pixrect copy of a drawing
without displaying it
Operations
The following operation starts the buffering. All subsequent drawing operations
have no effect in the drawing area of the displayed window, but draw into
an internal buffer with the same size and coordinates as the drawing area
of W .
void W.start_buffering();
The operations
void W.flush_buffer();
void W.flush_buffer(double x0, double y0, double x1, double y1)
copy the contents of the complete internal buffer, respectively the contents
of the rectangle (x0,y0,x1,y1) of the buffer, into W . The second
variant is much faster if the rectangle is significantly smaller than the
drawing area of W. The operation
void W.stop_buffering(char* & pr);
stops the buffering and converts the internal buffer into pixrect
pr . |
See also:
Drawing operations
Windows and Panels
Pixrects (Pixmaps)
Manual Pages:
Manual
Page Windows
|