Purple Code

com.purpletech.awt
Class PureImage

java.lang.Object
  |
  +--java.awt.Image
        |
        +--com.purpletech.awt.PureImage

public class PureImage
extends java.awt.Image

PureImage - an Image with no ties to any AWT peer nonsense.

Author:
Alex Chaffee (alexc@purpletech.com)
See Also:
PureGraphics

Field Summary
protected  int[] data
           
protected  int height
           
protected  int width
           
 
Fields inherited from class java.awt.Image
SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Constructor Summary
PureImage(java.awt.Image src)
          Create a new image which is a copy of the given image
PureImage(int width, int height)
          Create a new image with the given width and height.
 
Method Summary
 void drawImage(java.awt.Image source, int xDest, int yDest, java.awt.Color bg, java.awt.image.ImageObserver observer)
          just draw an image into this one
 void flush()
           
protected  int[] getData()
          returns the int[] array containing the pixel data.
 java.awt.Graphics getGraphics()
          Creates a graphics context for drawing to an off-screen image.
 int getHeight()
           
 int getHeight(java.awt.image.ImageObserver observer)
          Determines the height of the image.
 java.lang.Object getProperty(java.lang.String name, java.awt.image.ImageObserver observer)
          Gets a property of this image by name.
 java.awt.Image getScaledInstance(int width, int height, int hints)
          not implemented
 java.awt.image.ImageProducer getSource()
          Gets the object that produces the pixels for the image.
 int getWidth()
           
 int getWidth(java.awt.image.ImageObserver observer)
          Determines the width of the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

protected int width

height

protected int height

data

protected int[] data
Constructor Detail

PureImage

public PureImage(java.awt.Image src)
Create a new image which is a copy of the given image


PureImage

public PureImage(int width,
                 int height)
Create a new image with the given width and height.

Method Detail

getWidth

public int getWidth(java.awt.image.ImageObserver observer)
Determines the width of the image. If the width is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

Specified by:
getWidth in class java.awt.Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the width of this image, or -1 if the width is not yet known.
Since:
JDK1.0
See Also:
Image.getHeight(java.awt.image.ImageObserver), ImageObserver

getHeight

public int getHeight(java.awt.image.ImageObserver observer)
Determines the height of the image. If the height is not yet known, this method returns -1 and the specified ImageObserver object is notified later.

Specified by:
getHeight in class java.awt.Image
Parameters:
observer - an object waiting for the image to be loaded.
Returns:
the height of this image, or -1 if the height is not yet known.
Since:
JDK1.0
See Also:
Image.getWidth(java.awt.image.ImageObserver), ImageObserver

getSource

public java.awt.image.ImageProducer getSource()
Gets the object that produces the pixels for the image. This method is called by the image filtering classes and by methods that perform image conversion and scaling.

Specified by:
getSource in class java.awt.Image
Returns:
the image producer that produces the pixels for this image.
See Also:
ImageProducer

getGraphics

public java.awt.Graphics getGraphics()
Creates a graphics context for drawing to an off-screen image. This method can only be called for off-screen images.

Specified by:
getGraphics in class java.awt.Image
Returns:
a graphics context to draw to the off-screen image.
Since:
JDK1.0
See Also:
Graphics, Component.createImage(int, int)

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.awt.image.ImageObserver observer)
Gets a property of this image by name.

Individual property names are defined by the various image formats. If a property is not defined for a particular image, this method returns the UndefinedProperty object.

If the properties for this image are not yet known, this method returns null, and the ImageObserver object is notified later.

The property name "comment" should be used to store an optional comment which can be presented to the application as a description of the image, its source, or its author.

Specified by:
getProperty in class java.awt.Image
Parameters:
name - a property name.
observer - an object waiting for this image to be loaded.
Returns:
the value of the named property.
Since:
JDK1.0
See Also:
ImageObserver, Image.UndefinedProperty

getData

protected int[] getData()
returns the int[] array containing the pixel data. Only available to package friends and subclasses. Needed by PureGraphics.

See Also:
PureGraphics

getWidth

public int getWidth()
Returns:
the image width in pixels

getHeight

public int getHeight()
Returns:
the image height in pixels

getScaledInstance

public java.awt.Image getScaledInstance(int width,
                                        int height,
                                        int hints)
not implemented

Overrides:
getScaledInstance in class java.awt.Image

flush

public void flush()
Specified by:
flush in class java.awt.Image

drawImage

public void drawImage(java.awt.Image source,
                      int xDest,
                      int yDest,
                      java.awt.Color bg,
                      java.awt.image.ImageObserver observer)
just draw an image into this one

Parameters:
xDest - where inside the target to draw
yDest - where inside the target to draw
bg - background color for transparent pixels (can be null)

Documentation generated March 5 2003