| Constructor: |
public SunVolatileImage(Component comp,
int width,
int height) {
this(comp, width, height, null);
}
|
public SunVolatileImage(Component comp,
int width,
int height,
Object context) {
this(comp, comp.getGraphicsConfiguration(),
width, height, context, null);
}
|
public SunVolatileImage(GraphicsConfiguration graphicsConfig,
int width,
int height,
int transparency,
ImageCapabilities caps) {
this(null, graphicsConfig, width, height, null, transparency, caps);
}
|
| Method from sun.awt.image.SunVolatileImage Detail: |
public boolean contentsLost() {
return volSurfaceManager.contentsLost();
}
|
public Graphics2D createGraphics() {
return new SunGraphics2D(volSurfaceManager.getPrimarySurfaceData(),
getForeground(),
getBackground(),
getFont());
}
|
protected VolatileSurfaceManager createSurfaceManager(Object context,
ImageCapabilities caps) {
/**
* Platform-specific SurfaceManagerFactories will return a
* manager suited to acceleration on each platform. But if
* the user is asking for a VolatileImage from a BufferedImageGC,
* then we need to return the appropriate unaccelerated manager.
* Note: this could change in the future; if some platform would
* like to accelerate BIGC volatile images, then this special-casing
* of the BIGC graphicsConfig should live in platform-specific
* code instead.
* We do the same for a Printer Device, and if user requested an
* unaccelerated VolatileImage by passing the capabilities object.
*/
if (graphicsConfig instanceof BufferedImageGraphicsConfig ||
graphicsConfig instanceof sun.print.PrinterGraphicsConfig ||
(caps != null && !caps.isAccelerated()))
{
return new BufImgVolatileSurfaceManager(this, context);
}
SurfaceManagerFactory smf = SurfaceManagerFactory.getInstance();
return smf.createVolatileManager(this, context);
}
|
public BufferedImage getBackupImage() {
return graphicsConfig.createCompatibleImage(getWidth(), getHeight(),
getTransparency());
}
This method creates a BufferedImage intended for use as a "snapshot"
or a backup surface. |
public ImageCapabilities getCapabilities() {
return volSurfaceManager.getCapabilities(graphicsConfig);
}
|
public Component getComponent() {
return comp;
}
|
public GraphicsConfiguration getGraphicsConfig() {
return graphicsConfig;
}
|
public int getHeight() {
return height;
}
|
public int getHeight(ImageObserver observer) {
return getHeight();
}
|
public Object getProperty(String name,
ImageObserver observer) {
if (name == null) {
throw new NullPointerException("null property name is not allowed");
}
return java.awt.Image.UndefinedProperty;
}
|
public BufferedImage getSnapshot() {
BufferedImage bi = getBackupImage();
Graphics2D g = bi.createGraphics();
g.setComposite(AlphaComposite.Src);
g.drawImage(this, 0, 0, null);
g.dispose();
return bi;
}
|
public int getWidth() {
return width;
}
|
public int getWidth(ImageObserver observer) {
return getWidth();
}
|
public void updateGraphicsConfig() {
// If this VImage is associated with a Component, get an updated
// graphicsConfig from that component. Otherwise, keep the one
// that we were created with
if (comp != null) {
GraphicsConfiguration gc = comp.getGraphicsConfiguration();
if (gc != null) {
// Could potentially be null in some failure situations;
// better to keep the old non-null value around than to
// set graphicsConfig to null
graphicsConfig = gc;
}
}
}
|
public int validate(GraphicsConfiguration gc) {
return volSurfaceManager.validate(gc);
}
|