artofillusion.image
Class HDRImage

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

public class HDRImage
extends ImageMap

HDRImage is an ImageMap subclass. It represents a high dynamic range image stored in Greg Ward's RGBE format, as described in "Graphics Gems IV", edited by James Arvo, Academic Press, 1994.


Field Summary
 
Fields inherited from class artofillusion.image.ImageMap
PREVIEW_HEIGHT, PREVIEW_WIDTH
 
Constructor Summary
HDRImage(byte[] r, byte[] g, byte[] b, byte[] e, int xres, int yres)
          Create an HDRImage from the r, g, b, and e components.
HDRImage(java.io.DataInputStream in)
          Reconstruct an image from its serialized representation.
 
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

HDRImage

public HDRImage(byte[] r,
                byte[] g,
                byte[] b,
                byte[] e,
                int xres,
                int yres)
Create an HDRImage from the r, g, b, and e components.


HDRImage

public HDRImage(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
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 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.