|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.image.VolatileMirage
public abstract class VolatileMirage
A mirage implementation which allows the image to be maintained in video memory and rebuilt from some source image or images in the event that our target screen resolution changes or we are flushed from video memory for some other reason.
| Field Summary | |
|---|---|
protected Rectangle |
_bounds
The bounds of the region of our source image which we desire for this mirage (possibly the whole thing). |
protected BufferedImage |
_image
Our volatile image which lives in video memory and can go away at any time. |
protected ImageManager |
_imgr
The image manager with whom we interoperate. |
protected static boolean |
IMAGE_DEBUG
Turns off image rendering for testing. |
| Constructor Summary | |
|---|---|
protected |
VolatileMirage(ImageManager imgr,
Rectangle bounds)
Informs the base class of its image manager and image bounds. |
| Method Summary | |
|---|---|
protected void |
createVolatileImage()
Creates our volatile image from the information in our source image. |
long |
getEstimatedMemoryUsage()
Returns an estimate of the memory consumed by this mirage's image raster data. |
int |
getHeight()
Returns the height of this mirage. |
BufferedImage |
getSnapshot()
Returns a snapshot of this mirage as a buffered image. |
protected abstract int |
getTransparency()
Returns the transparency that should be used when creating our volatile image. |
int |
getWidth()
Returns the width of this mirage. |
int |
getX()
Returns the x offset into our source image, which is generally zero but may be non-zero for a mirage that obtains its data from a region of its source image. |
int |
getY()
Returns the y offset into our source image, which is generally zero but may be non-zero for a mirage that obtains its data from a region of its source image. |
boolean |
hitTest(int x,
int y)
Returns true if this mirage contains a non-transparent pixel at the specified coordinate. |
void |
paint(Graphics2D gfx,
int x,
int y)
Renders this mirage at the specified position in the supplied graphics context. |
protected abstract void |
refreshVolatileImage()
Rerenders our volatile image from the its source image data. |
String |
toString()
|
protected void |
toString(StringBuilder buf)
Generates a string representation of this instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ImageManager _imgr
protected Rectangle _bounds
protected BufferedImage _image
protected static final boolean IMAGE_DEBUG
| Constructor Detail |
|---|
protected VolatileMirage(ImageManager imgr,
Rectangle bounds)
| Method Detail |
|---|
public void paint(Graphics2D gfx,
int x,
int y)
Mirage
paint in interface Miragepublic int getX()
public int getY()
public int getWidth()
Mirage
getWidth in interface Miragepublic int getHeight()
Mirage
getHeight in interface Mirage
public boolean hitTest(int x,
int y)
Mirage
hitTest in interface Miragepublic long getEstimatedMemoryUsage()
Mirage
getEstimatedMemoryUsage in interface Miragepublic BufferedImage getSnapshot()
Mirage
getSnapshot in interface Mirageprotected void createVolatileImage()
protected abstract int getTransparency()
protected abstract void refreshVolatileImage()
public String toString()
toString in class Objectprotected void toString(StringBuilder buf)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||