|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface BackgroundPainter
An interface that allows backgrounds to be painted on a JadeDisplay component before the actual image is drawn. This allows customization of the component's appearance while waiting for tiles to be painted. For example, a Photoshop-style checkerboard could be drawn instead of simply erasing to black.
See JadeDisplay.backgroundPainter() for an example
implementation.
| Method Summary | |
|---|---|
void |
paintBackground(Graphics g,
int x,
int y,
int width,
int height,
boolean isNoErase,
boolean isInsideImage,
boolean isDeferredTile)
This function is called to paint the background for the area specified. |
| Method Detail |
|---|
void paintBackground(Graphics g,
int x,
int y,
int width,
int height,
boolean isNoErase,
boolean isInsideImage,
boolean isDeferredTile)
JadeDisplay component.
This routine should be fast. The idea is to not slow down the actual image display, but simply put something up indicating the image is not yet displayed.
The first parameters provide the Graphics object on which
to draw, and the x/y/width/height of the area to draw. These parameters
are measured in image coordinates and may be passed in exactly as-is to
Graphics.fillRect(x,y,w,h) - the supplied Graphics
object is properly translated, and is clipped to the passed-in bounds.
Thus, you can paint outside the bounds if necessary; the excess will
be clipped off.
Several flags are passed in which help to determine why the area is being erased. These should have an impact on what you draw:
paintNoErase(). It requests that the background not
be erased. Even if you do something different normally, you should
generally not do anything if this flag is on.
paintBackground()
will be called twice for such tiles: once with this false (as
with all tiles), and again with this true, once it is determined that the
tile is being deferred. Generally you will want to do nothing if
isDeferredTile is true. But if you want to, say, paint
a checkerboard only if the tile is deferred, that could be done via this
flag. Note, however, that other, non-deferred tiles may have already
been painted, so this may not be called immediately upon the tile being
exposed.
A note regarding the passed-in Graphics object. This object
is used only for background painting. Thus, you can set any parameters
in the Graphics object that you want, and do not necessarily
have to re-set them when done. However, while the same object may
be re-used in subsequent calls to the background painter, there is
no guarantee of this. So while you don't have to reset to
initial state at the end, you do have to set all state parameters
you want before starting the paint.
g - The Graphics into which to paint. This is most
likely a Graphics2D instance, but that is not guaranteed
by JadeDisplay. It is usually whatever was passed in to
paint(g), translated and clipped appropriately.x - The X coordinate of the rectangle to be paintedy - The Y coordinate of the rectangle to be paintedwidth - The width of the rectangle to be paintedheight - The height of the rectangle to be paintedisNoErase - True if called from paintNoErase()isInsideImage - True if rectangle is inside the image boundsisDeferredTile - True if tile is deferred (this is the second call)JadeDisplay,
JadeDisplay.setBackgroundPainter(jpl.mipl.jade.BackgroundPainter),
Graphics.fillRect(int,int,int,int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||