|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.BufferedGraphics
A BufferedGraphics object provides a temporary off-screen Image for a Control to draw on, before being transferred to the on-screen Graphics.
This facility is necessary because some platforms (e.g. Qtopia on the Sharp Zaurus) do not support reading bits from a Window surface. This makes certain drawing operations impossible directly on this surface. e.g. XOR'ing of images and the drawing of transparent images. However all platforms should support reading bits from an Image and therefore these operations are possible using images.
You will generally create a BufferedGraphics in the doPaint() method of your control. You then call getGraphics() to get the Graphics object that you should use for your drawing and when you are done call release() on the BufferedGraphics to transfer what has been drawn to the original Graphics.
Note that you can construct the BufferedGraphics conditionally, which means that if the original Graphics was already drawing on an Image, that same graphics will be used and no temporary image will be created. In fact, when created conditionally, the canCopyFrom() method is called on the original Graphics, and if it returns true, then that original Graphics is used.
| Constructor Summary | |
BufferedGraphics(Graphics original,
Control control)
Create a new BufferedGraphics from the original if the original does not support copying. |
|
BufferedGraphics(Graphics original,
Rect drawingAreaNeeded)
Create a new BufferedGraphics from the original if the original does not support copying. |
|
BufferedGraphics(Graphics original,
Rect drawingAreaNeeded,
boolean unconditionally)
Create a new BufferedGraphics from the original. |
|
| Method Summary | |
Graphics |
cancel()
Cancel drawing, free resources and do not update the original graphics. |
Graphics |
flush()
Copy the data already drawn on this surface, to the destination surface. |
Graphics |
getGraphics()
Get the graphics that you should use to draw on. |
Graphics |
release()
Copy the drawn image to the original graphics and free all temporary resources. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Constructor Detail |
public BufferedGraphics(Graphics original,
Rect drawingAreaNeeded,
boolean unconditionally)
original - The original graphics.drawingAreaNeeded - A non-null rectangle specifying the area needed.unconditionally - If this is true then a temporary image will always be created. If it
is false, then a temporary image will only be created if original.canCopyFrom() returns false.
public BufferedGraphics(Graphics original,
Rect drawingAreaNeeded)
original - The original graphics.drawingAreaNeeded - A non-null rectangle specifying the area needed.
public BufferedGraphics(Graphics original,
Control control)
original - The original graphics.control - The control that the original graphics was set up for. This will use a drawing
area equal to the size of the control.| Method Detail |
public Graphics getGraphics()
public Graphics flush()
bufferedGraphics.flush().flush();
public Graphics release()
public Graphics cancel()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||