Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class ncsa.horizon.awt.color.FunctionalColorModel

java.lang.Object
  |
  +--java.awt.image.ColorModel
        |
        +--ncsa.horizon.awt.color.HorizonColorModel
              |
              +--ncsa.horizon.awt.color.FunctionalColorModel
Subclasses:
GreyScaleColorModel

public abstract class FunctionalColorModel
extends HorizonColorModel
a ColorModel represented by a 4-D function.

This class supports the HorizonColorModel via a color table calculated by a set of 4 functions defining the red, green, blue, and alpha components. Developers subclass it by implementing three methods: getRedValue(), getGreenValue(), getBlueValue(), getAlphaValue(). Normally, subclasses do not override the getColor() methods (getRed(), getGreen(), etc.) as the default implementations employ the getColorValue() methods as well as support scaling of the function as well as the special indicies supported by the HorizonColorModel. Although it extends the ColorModel class, this class (like its superclass) is not meant to be used directly as such; instead, one should convert this ColorModel to an IndexColorModel via the superclass's createIndexColorModel() method for higher performance during image rendering.

See Also:
ncsa.horizon.awt.image.HorizonColorModel, ncsa.horizon.awt.image.EditableColorModel, Serialized Form

Field Summary
boolean doscale
          if true, scale the function.
int oflo
          the color associated the last index (overflow values).
int uflo
          the color associated with index 1 (underflow values).
int undef
          the color associated with index 0 (undefined values).
 
Fields inherited from class ncsa.horizon.awt.color.HorizonColorModel
mapsz, transi
 
Fields inherited from class java.awt.image.ColorModel
pixel_bits, transferType
 
Constructor Summary
FunctionalColorModel(int bits, int size)
          instantiate a HorizonColorModel.
FunctionalColorModel(int bits, int size, boolean scale)
          instantiate a HorizonColorModel.
 
Method Summary
byte[] getAlpha()
          return the alpha components of the color table as an array
int getAlpha(int index)
          Returns the alpha compoment for the specified pixel in the range 0-255.
byte getAlphaValue(double in)
          return the alpha component value associated with an unscaled input value.
byte[] getBlue()
          return the blue components of the color table as an array
int getBlue(int index)
          Returns the blue color compoment for the specified pixel in the range 0-255.
byte getBlueValue(double in)
          return the blue component value associated with an unscaled input value.
byte[] getGreen()
          return the green components of the color table as an array
int getGreen(int index)
          Returns the green color compoment for the specified pixel in the range 0-255.
byte getGreenValue(double in)
          return the green component value associated with an unscaled input value.
byte[] getRed()
          return the red components of the color table as an array
int getRed(int index)
          Returns the red color compoment for the specified pixel in the range 0-255.
byte getRedValue(double in)
          return the red component value associated with an unscaled input value.
boolean isEditable()
          return true if the arrays returned by the getColors() methods return a reference to the internal color component array.
void setOverflowColor(int red, int green, int blue, int alpha)
          set the color to be given to undefined datum values.
void setUndefinedColor(int red, int green, int blue, int alpha)
          set the color to be given to undefined datum values.
void setUnderflowColor(int red, int green, int blue, int alpha)
          set the color to be given to undefined datum values.
 
Methods inherited from class ncsa.horizon.awt.color.HorizonColorModel
addHorizonColorModelListener, clearChanged, clone, createIndexColorModel, delayNotify, delayNotify, getAlpha, getAlphas, getBlue, getBlues, getGreen, getGreens, getMapSize, getOverflowColor, getRed, getReds, getTransparentIndex, getUndefinedColor, getUnderflowColor, hasChanged, notifyListeners, removeAllListeners, removeListener, saveColorModel, saveColorModel, saveColorModel, setChanged, setChanged, setOverflowColor, setTransparentIndex, setUndefinedColor, setUnderflowColor
 
Methods inherited from class java.awt.image.ColorModel
coerceData, createCompatibleSampleModel, createCompatibleWritableRaster, equals, finalize, getAlpha, getAlpha, getAlphaRaster, getBlue, getBlue, getColorSpace, getComponents, getComponents, getComponentSize, getComponentSize, getDataElement, getDataElements, getGreen, getGreen, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRed, getRed, getRGB, getRGB, getRGBdefault, getTransparency, getUnnormalizedComponents, hasAlpha, isAlphaPremultiplied, isCompatibleRaster, isCompatibleSampleModel, setDataElements, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

doscale

protected boolean doscale
if true, scale the function. Default=true.

undef

protected int undef
the color associated with index 0 (undefined values). This is transparent by default.

uflo

protected int uflo
the color associated with index 1 (underflow values). This is black by default.

oflo

protected int oflo
the color associated the last index (overflow values). This is white by default.
Constructor Detail

FunctionalColorModel

public FunctionalColorModel(int bits,
                            int size)
instantiate a HorizonColorModel.
Parameters:
bits - the number of bits each pixel
size - the number of colors in the color table
Throws:
java.lang.IndexOutOfBoundsException - if size is less than 3.

FunctionalColorModel

public FunctionalColorModel(int bits,
                            int size,
                            boolean scale)
instantiate a HorizonColorModel.
Parameters:
bits - the number of bits each pixel
size - the number of colors in the color table
scale - if true, scale the regular part of the table to fit within the functions' input values [0, 100).
Throws:
java.lang.IndexOutOfBoundsException - if size is less than 3.
Method Detail

isEditable

public boolean isEditable()
return true if the arrays returned by the getColors() methods return a reference to the internal color component array. In this case, changes made to elements of the arrays effectively update this ColorModel. A value of false is returned if those methods return copies of the internal color component arrays.

getRed

protected byte[] getRed()
return the red components of the color table as an array
Overrides:
getRed in class HorizonColorModel

getGreen

protected byte[] getGreen()
return the green components of the color table as an array
Overrides:
getGreen in class HorizonColorModel

getBlue

protected byte[] getBlue()
return the blue components of the color table as an array
Overrides:
getBlue in class HorizonColorModel

getAlpha

protected byte[] getAlpha()
return the alpha components of the color table as an array
Overrides:
getAlpha in class HorizonColorModel

getRedValue

protected abstract byte getRedValue(double in)
return the red component value associated with an unscaled input value. This function should be defined such that the intended relevent range is [0, 100).

getGreenValue

protected abstract byte getGreenValue(double in)
return the green component value associated with an unscaled input value. This function should be defined such that the intended relevent range is [0, 100).

getBlueValue

protected abstract byte getBlueValue(double in)
return the blue component value associated with an unscaled input value. This function should be defined such that the intended relevent range is [0, 100).

getAlphaValue

protected abstract byte getAlphaValue(double in)
return the alpha component value associated with an unscaled input value. This function should be defined such that the intended relevent range is [0, 100).

getRed

public int getRed(int index)
Returns the red color compoment for the specified pixel in the range 0-255.
Overrides:
getRed in class java.awt.image.ColorModel

getGreen

public int getGreen(int index)
Returns the green color compoment for the specified pixel in the range 0-255.
Overrides:
getGreen in class java.awt.image.ColorModel

getBlue

public int getBlue(int index)
Returns the blue color compoment for the specified pixel in the range 0-255.
Overrides:
getBlue in class java.awt.image.ColorModel

getAlpha

public int getAlpha(int index)
Returns the alpha compoment for the specified pixel in the range 0-255.
Overrides:
getAlpha in class java.awt.image.ColorModel

setUndefinedColor

public void setUndefinedColor(int red,
                              int green,
                              int blue,
                              int alpha)
set the color to be given to undefined datum values. By convention, this is the color with index zero.
Overrides:
setUndefinedColor in class HorizonColorModel

setUnderflowColor

public void setUnderflowColor(int red,
                              int green,
                              int blue,
                              int alpha)
set the color to be given to undefined datum values. By convention, this is the color with index zero.
Overrides:
setUnderflowColor in class HorizonColorModel

setOverflowColor

public void setOverflowColor(int red,
                             int green,
                             int blue,
                             int alpha)
set the color to be given to undefined datum values. By convention, this is the color with index zero.
Overrides:
setOverflowColor in class HorizonColorModel

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD