artofillusion.image
Class SVGImage

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

public class SVGImage
extends ImageMap


Field Summary
 
Fields inherited from class artofillusion.image.ImageMap
PREVIEW_HEIGHT, PREVIEW_WIDTH
 
Constructor Summary
SVGImage(java.io.DataInputStream in)
          Reconstruct an image from its serialized representation.
SVGImage(java.io.File file)
          Construct a SVGImage from a SVG file.
 
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

SVGImage

public SVGImage(java.io.File file)
         throws java.io.IOException,
                java.lang.InterruptedException,
                SVGException
Construct a SVGImage from a SVG file.

Throws:
java.io.IOException
java.lang.InterruptedException
SVGException

SVGImage

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

Throws:
java.io.IOException
SVGException
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.