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.RemappableColorModel

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

public abstract class RemappableColorModel
extends HorizonColorModel
a HorizonColorModel that allows the colors from its table to be rearranged.

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

Field Summary
boolean cached
          if true, map is up to date.
HorizonColorModel refcm
          the four-component reference color table
int[] tbl
          the cached table of remapped colors.
 
Fields inherited from class ncsa.horizon.awt.color.HorizonColorModel
mapsz, transi
 
Fields inherited from class java.awt.image.ColorModel
pixel_bits, transferType
 
Constructor Summary
RemappableColorModel(java.awt.image.IndexColorModel cm)
          instantiate a RemappableColorModel.
RemappableColorModel(HorizonColorModel cm)
          instantiate a RemappableColorModel.
 
Method Summary
void cacheMapping()
          recalculate and cache the mapping for the entire table.
java.lang.Object clone()
           
java.awt.image.IndexColorModel createIndexColorModel()
          convert this ColorModel into an IndexColorModel
int getAlpha(int index)
          return the red component for the given index
byte[] getAlpha()
          return the alpha components of the color table as an array A reference rather than a copy should be returned when possible.
int getBlue(int index)
          return the red component for the given index
byte[] getBlue()
          return the blue components of the color table as an array A reference rather than a copy should be returned when possible.
int getGreen(int index)
          return the red component for the given index
byte[] getGreen()
          return the green components of the color table as an array A reference rather than a copy should be returned when possible.
int getMappedIndex(int index)
          return the current mapping of a given index to an index in the reference color table.
int getRed(int index)
          return the red component for the given index
byte[] getRed()
          return the red components of the color table as an array.
int getRefAlpha(int index)
          return the alpha component of reference model for a given index
int getRefBlue(int index)
          return the blue component of reference model for a given index
int getRefGreen(int index)
          return the green component of reference model for a given index
HorizonColorModel getRefModel()
          return the reference model as an IndexColorModel
int getRefRed(int index)
          return the red component of reference model for a given index
int getRefRGB(int index)
          return the color of reference model for a given index
void hardReset()
          reset this model to its original state, including the outer, logical colors.
void setOverflowColor(int red, int green, int blue, int alpha)
          set the color to be given to datum values greater than some minimum threshold.
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 datum values less than some minimum threshold.
void softReset()
          reset this model to its original state, excepting the outer, logical colors.
 
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

refcm

protected HorizonColorModel refcm
the four-component reference color table

cached

protected boolean cached
if true, map is up to date.

tbl

protected int[] tbl
the cached table of remapped colors. This includes the undefined, underflow, and overflow colors.
Constructor Detail

RemappableColorModel

public RemappableColorModel(java.awt.image.IndexColorModel cm)
instantiate a RemappableColorModel.
Parameters:
cm - the initial color model
Throws:
java.lang.IndexOutOfBoundsException - if size is less than 4.

RemappableColorModel

public RemappableColorModel(HorizonColorModel cm)
instantiate a RemappableColorModel.
Parameters:
cm - the initial color model
Throws:
java.lang.IndexOutOfBoundsException - if size is less than 4.
Method Detail

softReset

public void softReset()
reset this model to its original state, excepting the outer, logical colors.

hardReset

public void hardReset()
reset this model to its original state, including the outer, logical colors.

getRefRed

public final int getRefRed(int index)
return the red component of reference model for a given index

getRefGreen

public final int getRefGreen(int index)
return the green component of reference model for a given index

getRefBlue

public final int getRefBlue(int index)
return the blue component of reference model for a given index

getRefAlpha

public final int getRefAlpha(int index)
return the alpha component of reference model for a given index

getRefRGB

public final int getRefRGB(int index)
return the color of reference model for a given index

getRefModel

public final HorizonColorModel getRefModel()
return the reference model as an IndexColorModel

getMappedIndex

public abstract int getMappedIndex(int index)
return the current mapping of a given index to an index in the reference color table. Subclasses should override this method to calculate the current mapping.

cacheMapping

public void cacheMapping()
recalculate and cache the mapping for the entire table. Calling this method after editing the mapping parameters can make use of this model more efficient. This implementation uses the results of getMappedIndex() to calculate the cached table

getRed

public int getRed(int index)
return the red component for the given index
Overrides:
getRed in class java.awt.image.ColorModel

getGreen

public int getGreen(int index)
return the red component for the given index
Overrides:
getGreen in class java.awt.image.ColorModel

getBlue

public int getBlue(int index)
return the red component for the given index
Overrides:
getBlue in class java.awt.image.ColorModel

getAlpha

public int getAlpha(int index)
return the red component for the given index
Overrides:
getAlpha in class java.awt.image.ColorModel

getRed

protected byte[] getRed()
return the red components of the color table as an array. A reference rather than a copy should be returned when possible.
Overrides:
getRed in class HorizonColorModel

getGreen

protected byte[] getGreen()
return the green components of the color table as an array A reference rather than a copy should be returned when possible.
Overrides:
getGreen in class HorizonColorModel

getBlue

protected byte[] getBlue()
return the blue components of the color table as an array A reference rather than a copy should be returned when possible.
Overrides:
getBlue in class HorizonColorModel

getAlpha

protected byte[] getAlpha()
return the alpha components of the color table as an array A reference rather than a copy should be returned when possible.
Overrides:
getAlpha in class HorizonColorModel

createIndexColorModel

public java.awt.image.IndexColorModel createIndexColorModel()
convert this ColorModel into an IndexColorModel
Overrides:
createIndexColorModel in class HorizonColorModel

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 datum values less than some minimum threshold. By convention, this is the color with index one.
Overrides:
setUnderflowColor in class HorizonColorModel

setOverflowColor

public void setOverflowColor(int red,
                             int green,
                             int blue,
                             int alpha)
set the color to be given to datum values greater than some minimum threshold. By convention, this is the color with index one.
Overrides:
setOverflowColor in class HorizonColorModel

clone

public java.lang.Object clone()
Overrides:
clone 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