gnu.awt.xlib

Class XOffScreenImage

Implemented Interfaces:
ImageConsumer, IntegerGraphicsState.ScreenCoupledImage

public class XOffScreenImage
extends Image
implements IntegerGraphicsState.ScreenCoupledImage, ImageConsumer

Image class for xlib off-screen buffers. The image is stored in a server-side pixmap for best performance. This class supports getGraphics, so you can draw on the pixmap, and is specially handled when doing drawImage, so that the image copy is done entirely in the X server. This class does not support rasterization, for which you'd need an XImage.

Field Summary

Fields inherited from class java.awt.Image

SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty, accelerationPriority

Fields inherited from interface java.awt.image.ImageConsumer

COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT

Method Summary

void
flush()
Flushes (that is, destroys) any resources used for this image.
Graphics
getGraphics()
Returns a graphics context object for drawing an off-screen object.
GraphicsConfiguration
getGraphicsConfiguration()
Get the GraphicsConfiguration to which this image is coupled
int
getHeight()
Returns the height of the image, or -1 if it is unknown.
int
getHeight(ImageObserver observer)
Returns the height of the image, or -1 if it is unknown.
Pixmap
getPixmap()
Get the pixmap which contains this image
Object
getProperty(String name, ImageObserver observer)
This method requests a named property for an object.
ImageProducer
getSource()
Returns the image producer object for this object.
int
getWidth()
Returns the width of the image, or -1 if it is unknown.
int
getWidth(ImageObserver observer)
Returns the width of the image, or -1 if it is unknown.
void
imageComplete(int status)
The ImageProducer calls this method to indicate a single frame or the entire image is complete.
void
setColorModel(ColorModel model)
This ColorModel should indicate the model used by the majority of calls to setPixels.
void
setDimensions(int width, int height)
An ImageProducer indicates the size of the image being produced using this method.
void
setHints(int flags)
The ImageProducer should call this method with a bit mask of hints from any of RANDOMPIXELORDER, TOPDOWNLEFTRIGHT, COMPLETESCANLINES, SINGLEPASS, SINGLEFRAME.
void
setPixels(int x, int y, int w, int h, ColorModel model, byte[] pixels, int offset, int scansize)
Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
void
setPixels(int x, int y, int w, int h, ColorModel model, int[] pixels, int offset, int scansize)
Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
void
setProperties(Hashtable<K,V> props)

Methods inherited from class java.awt.Image

flush, getAccelerationPriority, getGraphics, getHeight, getProperty, getScaledInstance, getSource, getWidth, setAccelerationPriority

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

flush

public void flush()
Flushes (that is, destroys) any resources used for this image. This includes the actual image data.
Overrides:
flush in interface Image

getGraphics

public Graphics getGraphics()
Returns a graphics context object for drawing an off-screen object. This method is only valid for off-screen objects.
Overrides:
getGraphics in interface Image
Returns:
a graphics context object for an off-screen object
See Also:
Graphics.createImage(int, int)

getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()
Get the GraphicsConfiguration to which this image is coupled
Specified by:
getGraphicsConfiguration in interface IntegerGraphicsState.ScreenCoupledImage
Returns:
the GraphicsConfiguration

getHeight

public int getHeight()
Returns the height of the image, or -1 if it is unknown. If the image height is unknown, the observer object will be notified when the value is known.
Returns:
the height in pixels
See Also:
getWidth()

getHeight

public int getHeight(ImageObserver observer)
Returns the height of the image, or -1 if it is unknown. If the image height is unknown, the observer object will be notified when the value is known.
Overrides:
getHeight in interface Image
Parameters:
observer - the image observer for this object
Returns:
the height in pixels

getPixmap

public Pixmap getPixmap()
Get the pixmap which contains this image
Returns:
The pixmap

getProperty

public Object getProperty(String name,
                          ImageObserver observer)
This method requests a named property for an object. The value of the property is returned. The value UndefinedProperty is returned if there is no property with the specified name. The value null is returned if the properties for the object are not yet known. In this case, the specified image observer is notified when the properties are known.
Overrides:
getProperty in interface Image
Parameters:
name - the requested property name
observer - the image observer for this object
Returns:
the named property, if available

getSource

public ImageProducer getSource()
Returns the image producer object for this object. The producer is the object which generates pixels for this image.
Overrides:
getSource in interface Image
Returns:
the image producer for this object

getWidth

public int getWidth()
Returns the width of the image, or -1 if it is unknown. If the image width is unknown, the observer object will be notified when the value is known.
Returns:
the width in pixels
See Also:
getHeight()

getWidth

public int getWidth(ImageObserver observer)
Returns the width of the image, or -1 if it is unknown. If the image width is unknown, the observer object will be notified when the value is known.
Overrides:
getWidth in interface Image
Parameters:
observer - the image observer for this object
Returns:
the width in pixels

imageComplete

public void imageComplete(int status)
The ImageProducer calls this method to indicate a single frame or the entire image is complete. The method is also used to indicate an error in loading or producing the image.
Specified by:
imageComplete in interface ImageConsumer
Parameters:
status - the status of image production, represented by a bitwise OR of ImageConsumer flags

setColorModel

public void setColorModel(ColorModel model)
This ColorModel should indicate the model used by the majority of calls to setPixels. Each call to setPixels could however indicate a different ColorModel.
Specified by:
setColorModel in interface ImageConsumer
Parameters:
model - the color model to be used most often by setPixels
See Also:
ColorModel

setDimensions

public void setDimensions(int width,
                          int height)
An ImageProducer indicates the size of the image being produced using this method.
Specified by:
setDimensions in interface ImageConsumer
Parameters:
width - the width of the image
height - the height of the image

setHints

public void setHints(int flags)
The ImageProducer should call this method with a bit mask of hints from any of RANDOMPIXELORDER, TOPDOWNLEFTRIGHT, COMPLETESCANLINES, SINGLEPASS, SINGLEFRAME.
Specified by:
setHints in interface ImageConsumer
Parameters:
flags - a bit mask of hints

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      ColorModel model,
                      byte[] pixels,
                      int offset,
                      int scansize)
Deliver a subset of an ImageProducer's pixels to this ImageConsumer. Each element of the pixels array represents one pixel. The pixel data is formatted according to the color model model. The x and y parameters are the coordinates of the block of pixels being delivered to this ImageConsumer. They are specified relative to the top left corner of the image being produced. Likewise, w and h are the pixel block's dimensions.
Specified by:
setPixels in interface ImageConsumer
Parameters:
x - x coordinate of pixel block
y - y coordinate of pixel block
w - width of pixel block
h - height of pixel block
model - color model used to interpret pixel data
pixels - pixel block data
offset - offset into pixels array
scansize - width of one row in the pixel block

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      ColorModel model,
                      int[] pixels,
                      int offset,
                      int scansize)
Deliver a subset of an ImageProducer's pixels to this ImageConsumer. Each element of the pixels array represents one pixel. The pixel data is formatted according to the color model model. The x and y parameters are the coordinates of the rectangular region of pixels being delivered to this ImageConsumer, specified relative to the top left corner of the image being produced. Likewise, w and h are the pixel region's dimensions.
Specified by:
setPixels in interface ImageConsumer
Parameters:
x - x coordinate of pixel block
y - y coordinate of pixel block
w - width of pixel block
h - height of pixel block
model - color model used to interpret pixel data
pixels - pixel block data
offset - offset into pixels array
scansize - width of one row in the pixel block

setProperties

public void setProperties(Hashtable<K,V> props)

Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. This software is copyrighted work licensed under the terms of the Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details.