artofillusion.image
Class ImageOrColor

java.lang.Object
  extended by artofillusion.image.ImageOrColor

public class ImageOrColor
extends java.lang.Object

ImageOrColor represents a color which can potentially vary with position. It provides a Widget with which the user can edit it. They can choose either a single color, or an ImageMap which is then multiplied by a user specified color.


Constructor Summary
ImageOrColor(java.io.DataInputStream in, Scene theScene)
          The following two methods are used for reading and writing files.
ImageOrColor(RGBColor theColor)
           
ImageOrColor(RGBColor scaleColor, ImageMap theMap)
           
 
Method Summary
 void copy(ImageOrColor obj)
          Make this object identical to another one.
 ImageOrColor duplicate()
          Create a duplicate of this object.
 void getAverageColor(RGBColor theColor)
          Return the average color over the entire image.
 RGBColor getColor()
          Get the color by which the image is multiplied.
 void getColor(RGBColor theColor, boolean wrapx, boolean wrapy, double x, double y, double xsize, double ysize)
          Given a texture coordinate (x and y each between 0 and 1), return the average color of a region of width (xsize, ysize) centered at that location.
 Widget getEditingPanel(BFrame parent, Scene theScene)
          Get a Widget with which the user can edit the color.
 ImageMap getImage()
          Get the image, or null if it is a single color.
 void writeToFile(java.io.DataOutputStream out, Scene theScene)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageOrColor

public ImageOrColor(RGBColor theColor)

ImageOrColor

public ImageOrColor(RGBColor scaleColor,
                    ImageMap theMap)

ImageOrColor

public ImageOrColor(java.io.DataInputStream in,
                    Scene theScene)
             throws java.io.IOException
The following two methods are used for reading and writing files. The first is a constructor which reads the necessary data from an input stream. The other writes the object's representation to an output stream.

Throws:
java.io.IOException
Method Detail

getImage

public ImageMap getImage()
Get the image, or null if it is a single color.


getColor

public RGBColor getColor()
Get the color by which the image is multiplied.


getColor

public void getColor(RGBColor theColor,
                     boolean wrapx,
                     boolean wrapy,
                     double x,
                     double y,
                     double xsize,
                     double ysize)
Given a texture coordinate (x and y each between 0 and 1), return the average color of a region of width (xsize, ysize) centered at that location. wrapx and wrapy specify whether, for purposes of interpolation, the image should be treated as wrapping around so that opposite edges touch each other.


getAverageColor

public void getAverageColor(RGBColor theColor)
Return the average color over the entire image.


duplicate

public ImageOrColor duplicate()
Create a duplicate of this object.


copy

public void copy(ImageOrColor obj)
Make this object identical to another one.


writeToFile

public void writeToFile(java.io.DataOutputStream out,
                        Scene theScene)
                 throws java.io.IOException
Throws:
java.io.IOException

getEditingPanel

public Widget getEditingPanel(BFrame parent,
                              Scene theScene)
Get a Widget with which the user can edit the color. This Widget will send out ValueChangedEvents whenever the color changes.

Parameters:
parent - a parent BFrame which can be used for displaying dialogs
theScene - the Scene from which to get images


Copyright © 1999-2011 by Peter Eastman.