jjil.j2se
Class RgbImageJ2se

java.lang.Object
  extended by jjil.j2se.RgbImageJ2se
All Implemented Interfaces:
Show

public class RgbImageJ2se
extends java.lang.Object
implements Show

RgbImageJ2se is the interface between jjil's RgbImage and java.awt.Image objects. It provides an implementation of the Show interface for use with the Debug object, which allows images to be displayed and sent to files without being aware of the underlying architecture.
It also provides methods for transforming java.awt.Image objects to and from jjil.core.RgbImage objects.

Author:
webb

Constructor Summary
RgbImageJ2se()
          Creates an instance of RgbImageJ2se which will use the common graphics object for image display.
RgbImageJ2se(java.awt.Graphics graphics)
          Creates a new instance of RgbImageJ2se.
 
Method Summary
 void toDisplay(RgbImage rgb)
          Sends an RgbImage to the current graphics object.
 void toFile(RgbImage rgb, java.lang.String szFile)
          Sends an RgbImage to a file.
static RgbImage toRgbImage(java.awt.Image im)
          Transforms an input java.awt.Image to a jjil.core.RgbImage.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RgbImageJ2se

public RgbImageJ2se(java.awt.Graphics graphics)
Creates a new instance of RgbImageJ2se. The graphics object will be used to display images in all subsequently created instances of RgbImageJ2se.

Parameters:
graphics - the graphics object to use for all image displays.

RgbImageJ2se

public RgbImageJ2se()
Creates an instance of RgbImageJ2se which will use the common graphics object for image display.

Method Detail

toDisplay

public void toDisplay(RgbImage rgb)
Sends an RgbImage to the current graphics object.

Specified by:
toDisplay in interface Show
Parameters:
rgb - the image to display.

toFile

public void toFile(RgbImage rgb,
                   java.lang.String szFile)
Sends an RgbImage to a file.

Specified by:
toFile in interface Show
Parameters:
rgb - the RgbImage to send to the file.
szFile - the path of the file to save the image in. The file suffix is used to determine the image type (JPEG or PNG). Storage is in JPEG by default.

toRgbImage

public static RgbImage toRgbImage(java.awt.Image im)
Transforms an input java.awt.Image to a jjil.core.RgbImage. The image is read from the ImageProducer until the entire image is received, and the result is stored into the returned RgbImage.

Parameters:
im - the input java.awt.Image object.
Returns:
a jjil.core.RgbImage with the same contents as the input im.