javalib.worldimages
Class ImageMaker

java.lang.Object
  extended by javalib.worldimages.ImageMaker
Direct Known Subclasses:
ImageMakerApplet

public class ImageMaker
extends Object

This class allows the user to read image data from a .png file and save it as a RenderedImage in the format that is used for the World when drawing on its canvas.

Since:
February 4 2012, 9 August 2012
Author:
Viera K. Proulx

Field Summary
static ColorModel canvasColorModel
           
 ColorModel cmodel
           
 ColorConvertOp colorOp
           
 int height
           
 BufferedImage image
           
 BufferedImage imageSource
          the buffer that saves the user-generated image
(package private)  File inputfile
           
static HashMap<String,BufferedImage> loadedImages
           
 int width
           
 
Constructor Summary
protected ImageMaker()
          Default constructor, so we can define a subclass that uses url for file name - used by applets
  ImageMaker(String filename)
          Construct the BufferedImage from the given file.
 
Method Summary
 Color getColorPixel(int x, int y)
          Get the specified pixel in the image as an RGB color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

canvasColorModel

public static ColorModel canvasColorModel

cmodel

public ColorModel cmodel

colorOp

public ColorConvertOp colorOp

height

public int height

image

public BufferedImage image

imageSource

public BufferedImage imageSource
the buffer that saves the user-generated image


inputfile

File inputfile

loadedImages

public static HashMap<String,BufferedImage> loadedImages

width

public int width
Constructor Detail

ImageMaker

protected ImageMaker()
Default constructor, so we can define a subclass that uses url for file name - used by applets


ImageMaker

public ImageMaker(String filename)
Construct the BufferedImage from the given file. The file can be given as an URL, or a reference to local image file. If this image has been loaded already, use the saved version.

Parameters:
filename - the file name for the desired image
Method Detail

getColorPixel

public Color getColorPixel(int x,
                           int y)
Get the specified pixel in the image as an RGB color.

Parameters:
x - the x coordinate of the pixel
y - the y coordinate of the pixel