uk.co.javagear
Class FastImage

java.lang.Object
  extended by uk.co.javagear.FastImage
All Implemented Interfaces:
java.awt.image.ImageProducer

public class FastImage
extends java.lang.Object
implements java.awt.image.ImageProducer

FastImage implements ImageProducer and is used to reconstruct the image whenever it is needed.

Version:
18th January 2003
Author:
Copyright (C) 2003 Chris White

Field Summary
private  java.awt.image.ImageConsumer consumer
          Image consumer.
private  int height
          Image height.
private  java.awt.Image image
          Image data.
private  java.awt.image.DirectColorModel model
          Direct color model (32 bits).
private  int width
          Image width.
 
Constructor Summary
FastImage(int w, int h)
          Construct a FastImage.
 
Method Summary
 void addConsumer(java.awt.image.ImageConsumer ic)
          Registers an ImageConsumer with the ImageProducer for access to the image data during a later reconstruction of the Image.
 boolean isConsumer(java.awt.image.ImageConsumer ic)
          Check if consumer is already registered.
 void paint(java.awt.Graphics g, int xOffset, int yOffset, int xScale, int yScale)
          Paint the FastImage.
 void paint(java.awt.Graphics g, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
          Paint the FastImage.
 void removeConsumer(java.awt.image.ImageConsumer ic)
          Does nothing.
 void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
          Does nothing.
 void startProduction(java.awt.image.ImageConsumer ic)
          Registers the specified ImageConsumer object as a consumer and starts an immediate reconstruction of the image data which will then be delivered to this consumer and any other consumer which might have already been registered with the producer.
 void update(int[] pixels, int offset)
          Update the FastImage with new pixel data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

private int width
Image width.


height

private int height
Image height.


image

private java.awt.Image image
Image data.


consumer

private java.awt.image.ImageConsumer consumer
Image consumer.


model

private java.awt.image.DirectColorModel model
Direct color model (32 bits).

Constructor Detail

FastImage

public FastImage(int w,
                 int h)
Construct a FastImage.

Parameters:
w - Width of Image
h - Height of Image
Method Detail

update

public void update(int[] pixels,
                   int offset)
Update the FastImage with new pixel data.

Parameters:
pixels - pixel array.
offset - offset into pixel array.

paint

public void paint(java.awt.Graphics g,
                  int xOffset,
                  int yOffset,
                  int xScale,
                  int yScale)
Paint the FastImage.

Parameters:
g - graphics context
xOffset - X Offset at which to paint image at
yOffset - Y Offset at which to paint image at
xScale - X Scale Factor
yScale - Y Scale Factor

paint

public void paint(java.awt.Graphics g,
                  int x1,
                  int y1,
                  int x2,
                  int y2,
                  int x3,
                  int y3,
                  int x4,
                  int y4)
Paint the FastImage.

Parameters:
g - Graphics context
x1 - Destination top left corner
y1 - Destination top left corner
x2 - Destination bottom right corner
y2 - Destination bottom right corner
x3 - Source top left corner
y3 - Source top left corner
x4 - Source bottom right corner
y4 - Source bottom right corner

addConsumer

public void addConsumer(java.awt.image.ImageConsumer ic)
Registers an ImageConsumer with the ImageProducer for access to the image data during a later reconstruction of the Image.

Specified by:
addConsumer in interface java.awt.image.ImageProducer
Parameters:
ic - the specified ImageConsumer

isConsumer

public boolean isConsumer(java.awt.image.ImageConsumer ic)
Check if consumer is already registered.

Specified by:
isConsumer in interface java.awt.image.ImageProducer
Parameters:
ic - an instance of ImageConsumer.
Returns:
always returns true

startProduction

public void startProduction(java.awt.image.ImageConsumer ic)
Registers the specified ImageConsumer object as a consumer and starts an immediate reconstruction of the image data which will then be delivered to this consumer and any other consumer which might have already been registered with the producer.

Specified by:
startProduction in interface java.awt.image.ImageProducer
Parameters:
ic - the specified ImageConsumer

removeConsumer

public void removeConsumer(java.awt.image.ImageConsumer ic)
Does nothing.

Specified by:
removeConsumer in interface java.awt.image.ImageProducer
Parameters:
ic - an instance of ImageConsumer.

requestTopDownLeftRightResend

public void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
Does nothing.

Specified by:
requestTopDownLeftRightResend in interface java.awt.image.ImageProducer
Parameters:
ic - an instance of ImageConsumer.


Copyright © 2007 JavaGear. All Rights Reserved.