| The Essential JViews Framework > Managers > Managing Layers > Triple Buffering Layers |
Triple Buffering Layers |
INDEX
PREVIOUS
NEXT
|
Certain applications can use the notion of layers to display a static background on top of which "live" graphic objects will be drawn and manipulated by the user.
In this type of application, the graphic objects taking part in the background are static and are not modified by the user or the application. Thus, it is possible to draw just once for all of the layers constituting the graphic background. This increases the drawing speed of the application.
The process is called triple buffering. This term is used because the layers will be drawn in an additional off screen image. Thereafter, when the view needs to be redrawn, this image is used instead of redrawing the graphic objects.
| Note |
| Unlike double buffering, triple buffering is not engaged to remove flickering but to increase the drawing speed. Double and triple buffering can be used together. |
For an instance of IlvManagerView, it is possible to indicate that a certain number of layers will be part of the triple buffering.
This is done using the following method of IlvManagerView:
void setTripleBufferedLayerCount(int n)
When this method is called, layers with indices between 0 and n-1 (the nth background layers) will be triple buffered.
Once the method is called and the view has been painted once, further modifications to graphic objects will not be rendered on the screen, since only the triple buffer image will be displayed.
Note that the triple buffer will be updated only when:
IlvManager.applyToObject() to make changes to the triple-buffered graphic objects on the triple-buffered layers.| Note |
| Some interactors, such as the reshape interactor, call this function. Therefore, when you reshape a graphic object on a triple-buffered layer with the mouse, the triple buffer is invalidated. |
If for any reason you need to update the triple buffer, you can use these methods:
void invalidateTripleBuffer(boolean repaint) void invalidateTripleBuffer(IlvRect rect, boolean repaint)
To summarize, an application will use triple buffering when the contents of background layers are static, and when the application does not require the user to zoom and pan frequently.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. Legal terms. | PREVIOUS NEXT |