artofillusion.image
Class MIPMappedImage

java.lang.Object
  extended by artofillusion.image.ImageMap
      extended by artofillusion.image.MIPMappedImage

public class MIPMappedImage
extends ImageMap

MIPMappedImage is an ImageMap subclass. It stores 8 bits per color component, and uses MIP mapping to eliminate aliasing.


Field Summary
 
Fields inherited from class artofillusion.image.ImageMap
PREVIEW_HEIGHT, PREVIEW_WIDTH
 
Constructor Summary
MIPMappedImage(java.io.DataInputStream in)
          Reconstruct an image from its serialized representation.
MIPMappedImage(java.io.DataInputStream in, short version)
          Reconstruct an image from its serialized representation.
MIPMappedImage(java.io.File file)
          Construct a MIPMappedImage from a GIF, JPEG, or PNG image file.
MIPMappedImage(java.awt.Image im)
          Construct a MIPMappedImage from an Image object.
 
Method Summary
 float getAverageComponent(int component)
          Get the average value for a particular component, over the entire image.
 void getColor(RGBColor theColor, boolean wrapx, boolean wrapy, double x, double y, double xsize, double ysize)
          Get the color at a particular location.
 float getComponent(int component, boolean wrapx, boolean wrapy, double x, double y, double xsize, double ysize)
          Get the value of a single component at a particular location in the image.
 int getComponentCount()
          Get the number of components in the image.
 void getGradient(Vec2 grad, int component, boolean wrapx, boolean wrapy, double x, double y, double xsize, double ysize)
          Get the gradient of a single component at a particular location in the image.
 int getHeight()
          Get the height of the image.
 java.awt.Image getPreview()
          Get a scaled down copy of the image, to use for previews.
 int getWidth()
          Get the width of the image.
 void writeToStream(java.io.DataOutputStream out)
          Serialize an image to an output stream.
 
Methods inherited from class artofillusion.image.ImageMap
getID, loadImage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIPMappedImage

public MIPMappedImage(java.awt.Image im)
               throws java.lang.InterruptedException
Construct a MIPMappedImage from an Image object.

Throws:
java.lang.InterruptedException

MIPMappedImage

public MIPMappedImage(java.io.File file)
               throws java.lang.InterruptedException
Construct a MIPMappedImage from a GIF, JPEG, or PNG image file.

Throws:
java.lang.InterruptedException

MIPMappedImage

public MIPMappedImage(java.io.DataInputStream in)
               throws java.io.IOException,
                      java.io.InvalidObjectException
Reconstruct an image from its serialized representation.

Throws:
java.io.IOException
java.io.InvalidObjectException

MIPMappedImage

public MIPMappedImage(java.io.DataInputStream in,
                      short version)
               throws java.io.IOException,
                      java.io.InvalidObjectException
Reconstruct an image from its serialized representation. This constructor is provided only for compatibility with versions of AoI prior to 1.4, which did not write image version information to the stream.

Throws:
java.io.IOException
java.io.InvalidObjectException
Method Detail

getWidth

public int getWidth()
Get the width of the image.

Specified by:
getWidth in class ImageMap

getHeight

public int getHeight()
Get the height of the image.

Specified by:
getHeight in class ImageMap

getComponentCount

public int getComponentCount()
Get the number of components in the image.

Specified by:
getComponentCount in class ImageMap

getComponent

public float getComponent(int component,
                          boolean wrapx,
                          boolean wrapy,
                          double x,
                          double y,
                          double xsize,
                          double ysize)
Get the value of a single component at a particular location in the image. The value is represented as a float between 0.0 and 1.0. The components are: 0: Red 1: Green 2: Blue 3: Alpha The location is specified by x and y, which must lie between 0 and 1. The value is averaged over a region of width (xsize, ysize). wrapx and wrapy specify whether, for purposes of interpolation, the image should be treated as wrapping around so that opposite edges touch each other.

Specified by:
getComponent in class ImageMap

getAverageComponent

public float getAverageComponent(int component)
Get the average value for a particular component, over the entire image.

Specified by:
getAverageComponent in class ImageMap

getColor

public void getColor(RGBColor theColor,
                     boolean wrapx,
                     boolean wrapy,
                     double x,
                     double y,
                     double xsize,
                     double ysize)
Get the color at a particular location. The location is specified by x and y, which must lie between 0 and 1. The color is averaged over a region of width (xsize, ysize). wrapx and wrapy specify whether, for purposes of interpolation, the image should be treated as wrapping around so that opposite edges touch each other.

Specified by:
getColor in class ImageMap

getGradient

public void getGradient(Vec2 grad,
                        int component,
                        boolean wrapx,
                        boolean wrapy,
                        double x,
                        double y,
                        double xsize,
                        double ysize)
Get the gradient of a single component at a particular location in the image. The location is specified by x and y, which must lie between 0 and 1. The value is averaged over a region of width (xsize, ysize) before the gradient is calculated. wrapx and wrapy specify whether, for purposes of interpolation, the image should be treated as wrapping around so that opposite edges touch each other.

Specified by:
getGradient in class ImageMap

getPreview

public java.awt.Image getPreview()
Get a scaled down copy of the image, to use for previews. This Image will be no larger (but may be smaller) than PREVIEW_WIDTH by PREVIEW_HEIGHT.

Specified by:
getPreview in class ImageMap

writeToStream

public void writeToStream(java.io.DataOutputStream out)
                   throws java.io.IOException
Serialize an image to an output stream.

Specified by:
writeToStream in class ImageMap
Throws:
java.io.IOException


Copyright © 1999-2011 by Peter Eastman.