zinger.wcollage
Class CollageMaker

java.lang.Object
  extended by zinger.wcollage.CollageMaker

public class CollageMaker
extends java.lang.Object

Collage image creator. Collages are created by starting with an image and merging other images with it one by one. The image object maintained throughout the process is referred to as the canvas image. Both the canvas image and the images provided for merging must be of ARGB type.


Field Summary
protected  java.awt.image.BufferedImage canvasImage
           
 
Constructor Summary
CollageMaker(java.awt.image.BufferedImage canvasImage)
          Creates an instance with the specified canvas image.
CollageMaker(int width, int height)
          Creates an instance with the canvas image of specified dimensions.
 
Method Summary
 void clear()
          Makes canvas image completely transparent black.
 java.awt.Image getCanvasImage()
           
 void mergeImage(java.awt.image.BufferedImage image)
          Merges provided image onto canvas image at a random location.
 void mergeImage(java.awt.image.BufferedImage image, int x, int y)
          Merges provided image onto canvas at specified location.
 void write(java.io.File file, java.lang.String formatName)
          Writes the canvas image into a file using specified format given as an informal name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvasImage

protected java.awt.image.BufferedImage canvasImage
Constructor Detail

CollageMaker

public CollageMaker(java.awt.image.BufferedImage canvasImage)
Creates an instance with the specified canvas image. It must be of ARGB type.

Parameters:
canvasImage - must be of ARGB type

CollageMaker

public CollageMaker(int width,
                    int height)
Creates an instance with the canvas image of specified dimensions.

Method Detail

mergeImage

public void mergeImage(java.awt.image.BufferedImage image)
Merges provided image onto canvas image at a random location. this method is thread safe.

Parameters:
image - must be of ARGB type
See Also:
mergeImage(java.awt.image.BufferedImage, int, int)

mergeImage

public void mergeImage(java.awt.image.BufferedImage image,
                       int x,
                       int y)
Merges provided image onto canvas at specified location. Coordinates must not place the image completely outside the canvas image boundaries. This method is thread safe.

Parameters:
image - must be of ARGB type
x - x-coordinate for merging
y - y-coordinate for merging

getCanvasImage

public java.awt.Image getCanvasImage()

clear

public void clear()
Makes canvas image completely transparent black. This method is thread safe.


write

public void write(java.io.File file,
                  java.lang.String formatName)
           throws java.io.IOException
Writes the canvas image into a file using specified format given as an informal name. This method is thread safe.

Throws:
java.io.IOException