GeezerVison is showing docs.oracle.com — VolatileImage (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
java.awt.image
Class VolatileImage
-
-
Field Summary
Fields
| Modifier and Type |
Field |
Description |
static int |
IMAGE_INCOMPATIBLE |
Validated image is incompatible with supplied
GraphicsConfiguration object and should be
re-created as appropriate.
|
static int |
IMAGE_OK |
Validated image is ready to use as-is.
|
static int |
IMAGE_RESTORED |
Validated image has been restored and is now ready to use.
|
protected int |
transparency |
The transparency value with which this image was created.
|
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods
| Modifier and Type |
Method |
Description |
abstract boolean |
contentsLost() |
Returns true if rendering data was lost since last
validate call.
|
abstract Graphics2D |
createGraphics() |
Creates a Graphics2D, which can be used to draw into
this VolatileImage.
|
abstract ImageCapabilities |
getCapabilities() |
Returns an ImageCapabilities object which can be
inquired as to the specific capabilities of this
VolatileImage.
|
Graphics |
getGraphics() |
This method returns a Graphics2D, but is here
for backwards compatibility.
|
abstract int |
getHeight() |
Returns the height of the VolatileImage.
|
abstract BufferedImage |
getSnapshot() |
Returns a static snapshot image of this object.
|
ImageProducer |
getSource() |
This returns an ImageProducer for this VolatileImage.
|
int |
getTransparency() |
Returns the transparency.
|
abstract int |
getWidth() |
Returns the width of the VolatileImage.
|
abstract int |
validate(GraphicsConfiguration gc) |
Attempts to restore the drawing surface of the image if the surface
had been lost since the last validate call.
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Field Detail
-
IMAGE_INCOMPATIBLE
public static final int IMAGE_INCOMPATIBLE
Validated image is incompatible with supplied
GraphicsConfiguration object and should be
re-created as appropriate. Usage of the image as-is
after receiving this return code from validate
is undefined.
- See Also:
- Constant Field Values
-
Constructor Detail
-
VolatileImage
public VolatileImage()
-
Method Detail
-
getSnapshot
public abstract BufferedImage getSnapshot()
Returns a static snapshot image of this object. The
BufferedImage returned is only current with
the VolatileImage at the time of the request
and will not be updated with any future changes to the
VolatileImage.
- Returns:
- a
BufferedImage representation of this
VolatileImage
- See Also:
BufferedImage
-
getSource
public ImageProducer getSource()
This returns an ImageProducer for this VolatileImage.
Note that the VolatileImage object is optimized for
rendering operations and blitting to the screen or other
VolatileImage objects, as opposed to reading back the
pixels of the image. Therefore, operations such as
getSource may not perform as fast as
operations that do not rely on reading the pixels.
Note also that the pixel values read from the image are current
with those in the image only at the time that they are
retrieved. This method takes a snapshot
of the image at the time the request is made and the
ImageProducer object returned works with
that static snapshot image, not the original VolatileImage.
Calling getSource()
is equivalent to calling getSnapshot().getSource().
- Specified by:
getSource in class Image
- Returns:
- an
ImageProducer that can be used to produce the
pixels for a BufferedImage representation of
this Image.
- See Also:
ImageProducer,
getSnapshot()
-
createGraphics
public abstract Graphics2D createGraphics()
Creates a Graphics2D, which can be used to draw into
this VolatileImage.
- Returns:
- a
Graphics2D, used for drawing into this
image.
-
validate
public abstract int validate(GraphicsConfiguration gc)
Attempts to restore the drawing surface of the image if the surface
had been lost since the last validate call. Also
validates this image against the given GraphicsConfiguration
parameter to see whether operations from this image to the
GraphicsConfiguration are compatible. An example of an
incompatible combination might be a situation where a VolatileImage
object was created on one graphics device and then was used
to render to a different graphics device. Since VolatileImage
objects tend to be very device-specific, this operation might
not work as intended, so the return code from this validate
call would note that incompatibility. A null or incorrect
value for gc may cause incorrect values to be returned from
validate and may cause later problems with rendering.
- Parameters:
gc - a GraphicsConfiguration object for this
image to be validated against. A null gc implies that the
validate method should skip the compatibility test.
- Returns:
IMAGE_OK if the image did not need validation
IMAGE_RESTORED if the image needed restoration.
Restoration implies that the contents of the image may have
been affected and the image may need to be re-rendered.
IMAGE_INCOMPATIBLE if the image is incompatible
with the GraphicsConfiguration object passed
into the validate method. Incompatibility
implies that the image may need to be recreated with a
new Component or
GraphicsConfiguration in order to get an image
that can be used successfully with this
GraphicsConfiguration.
An incompatible image is not checked for whether restoration
was necessary, so the state of the image is unchanged
after a return value of IMAGE_INCOMPATIBLE
and this return value implies nothing about whether the
image needs to be restored.
- See Also:
GraphicsConfiguration,
Component,
IMAGE_OK,
IMAGE_RESTORED,
IMAGE_INCOMPATIBLE
-
contentsLost
public abstract boolean contentsLost()
Returns true if rendering data was lost since last
validate call. This method should be called by the
application at the end of any series of rendering operations to
or from the image to see whether
the image needs to be validated and the rendering redone.
- Returns:
true if the drawing surface needs to be restored;
false otherwise.
-
getCapabilities
public abstract ImageCapabilities getCapabilities()
Returns an ImageCapabilities object which can be
inquired as to the specific capabilities of this
VolatileImage. This would allow programmers to find
out more runtime information on the specific VolatileImage
object that they have created. For example, the user
might create a VolatileImage but the system may have
no video memory left for creating an image of that
size, so although the object is a VolatileImage, it is
not as accelerated as other VolatileImage objects on
this platform might be. The user might want that
information to find other solutions to their problem.
- Returns:
- an
ImageCapabilities object that contains
the capabilities of this VolatileImage.
- Since:
- 1.4
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|