com.eteks.awt
Class PJAImage

java.lang.Object
  |
  +--java.awt.Image
        |
        +--com.eteks.awt.PJAImage

public class PJAImage
extends Image

Pure Java AWT Image implementation. This image stores in a buffer an offscreen image using default RGB color model or another indexed color model.

Since:
PJA1.0
Author:
Emmanuel Puybaret

Fields inherited from class java.awt.Image
SCALE_AREA_AVERAGING, SCALE_DEFAULT, SCALE_FAST, SCALE_REPLICATE, SCALE_SMOOTH, UndefinedProperty
 
Constructor Summary
PJAImage(ImageProducer producer)
          Creates an initial image with a producer.
PJAImage(int width, int height)
          Creates an empty image of width x height pixels.
PJAImage(int width, int height, ColorModel colorModel)
          Creates an empty image of width x height pixels.
 
Method Summary
protected  int check(ImageObserver observer)
           
 void flush()
          java.awt.Image implementation.
 ColorModel getColorModel()
          Returns this image's color model
 Graphics getGraphics()
          java.awt.Image implementation.
protected  int getHeight()
           
 int getHeight(ImageObserver observer)
          java.awt.Image implementation.
protected  int getPixelColor(int x, int y)
          Gets the color at the point (x,y).
protected  int[] getPixels()
          Gets the array used to store the pixels of this image.
protected  Object getPixelsArray()
          Gets the array used to store the pixels of this image.
 Object getProperty(String name, ImageObserver observer)
          java.awt.Image implementation.
 ImageProducer getSource()
          java.awt.Image implementation.
protected  int getWidth()
           
 int getWidth(ImageObserver observer)
          java.awt.Image implementation.
protected  boolean prepare(ImageObserver observer)
           
protected  void setPixelColor(int x, int y, int ARGB)
          Sets the color at the point (x,y).
 void sync()
          Synchronizes the image loading.
 
Methods inherited from class java.awt.Image
getScaledInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PJAImage

public PJAImage(ImageProducer producer)
Creates an initial image with a producer.
Parameters:
producer - An instance of a class that implements ImagePoducer.

PJAImage

public PJAImage(int width,
                int height)
Creates an empty image of width x height pixels. The image is created transparent.
See Also:
PJAToolkit

PJAImage

public PJAImage(int width,
                int height,
                ColorModel colorModel)
Creates an empty image of width x height pixels. The image is created transparent with colorModel color model.
Since:
PJA2.3
Method Detail

getProperty

public Object getProperty(String name,
                          ImageObserver observer)
java.awt.Image implementation.
Overrides:
getProperty in class Image
See Also:
Image

getWidth

public int getWidth(ImageObserver observer)
java.awt.Image implementation.
Overrides:
getWidth in class Image
See Also:
Image

getHeight

public int getHeight(ImageObserver observer)
java.awt.Image implementation.
Overrides:
getHeight in class Image
See Also:
Image

getSource

public ImageProducer getSource()
java.awt.Image implementation.
Overrides:
getSource in class Image
See Also:
Image

getGraphics

public Graphics getGraphics()
java.awt.Image implementation. Contrary to JDK default behavior, PJA allows to retrieve an instance of Graphics on images created with a producer. This enables to draw in transparent images.
Overrides:
getGraphics in class Image
See Also:
Image

getColorModel

public ColorModel getColorModel()
Returns this image's color model
Returns:
the image's color model. null means the default color model.
Since:
PJA2.3

flush

public void flush()
java.awt.Image implementation.
Overrides:
flush in class Image
See Also:
Image

check

protected int check(ImageObserver observer)

prepare

protected boolean prepare(ImageObserver observer)

getWidth

protected int getWidth()

getHeight

protected int getHeight()

getPixels

protected int[] getPixels()
Gets the array used to store the pixels of this image.
Returns:
an array of int or null if the array contains byte or if the image was flushed.

getPixelsArray

protected Object getPixelsArray()
Gets the array used to store the pixels of this image.
Returns:
an array of int or byte.
Since:
PJA2.3

getPixelColor

protected int getPixelColor(int x,
                            int y)
Gets the color at the point (x,y).
Parameters:
x - the point coordinates.
y -  
Returns:
the color of the point in default RGB model.
Since:
PJA2.0

setPixelColor

protected void setPixelColor(int x,
                             int y,
                             int ARGB)
Sets the color at the point (x,y).
Parameters:
x - the point coordinates.
y -  
ARGB - the color of the point in default RGB model.
Since:
PJA2.0

sync

public void sync()
Synchronizes the image loading.
Since:
PJA2.0