ilog.views.maps.raster
Class IlvAdjustableDelegateColorModel

java.lang.Object
  extended by java.awt.image.ColorModel
      extended by ilog.views.maps.raster.IlvAdjustableDelegateColorModel
All Implemented Interfaces:
IlvPersistentObject, Transparency

public class IlvAdjustableDelegateColorModel
extends ColorModel
implements IlvPersistentObject

This class wraps up a color model to provide access to brightness, saturation and contrast change.

Since:
JViews 7.5

Field Summary
 
Fields inherited from class java.awt.image.ColorModel
pixel_bits, transferType
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
IlvAdjustableDelegateColorModel(ColorModel cm)
          Creates an adjustable color model based on the supplied color model.
IlvAdjustableDelegateColorModel(IlvInputStream stream)
          Creates an IlvAdjustableDelegateColorModel by reading a stream.
 
Method Summary
 int brightShade(int rgb)
          Computes the rgb value passed into a brighter version, for raster shading.
 int darkShade(int rgb)
          Computes the rgb value passed into a darker version, for raster shading.
 int getAlpha(int pixel)
          Returns the alpha color component for the specified pixel.
 int getBlue(int pixel)
          Returns the blue color component for the specified pixel.
 double getBrightness()
          Returns the brightness.
 ColorModel getColorModel()
          Returns the delegate colorModel.
 double getContrast()
          Returns the contrast.
 int getGreen(int pixel)
          Returns the green color component for the specified pixel.
 int getRed(int pixel)
          Returns the red color component for the specified pixel.
 int getRGB(int pixel)
          Apply brightness,saturation, contrast and transparent pixel settings to the value returned by the delegate.
 double getSaturation()
          Returns the saturation.
 int getTransparentPixel()
          Returns the transparent Pixel.
static ColorModel readColorModel(IlvInputStream stream)
          Reads a color model from an input stream.
 void setBrightness(double brightness)
          Sets a new level of brightness.
 void setColorModel(ColorModel colorModel)
          Sets the color model used internally.
 void setContrast(double contrast)
          Sets a new level of contrast.
 void setSaturation(double saturation)
          Sets a new level of saturation.
 void setTransparentPixel(int transparentPixel)
          Sets a transparent pixel value used to return a fully transparent rgb value.
 void write(IlvOutputStream out)
          Writes the color model of this raster.
static void writeColorModel(ColorModel colorModel, IlvOutputStream out)
          Write the specified ColorModel to the specified IlvOutputStream.
 
Methods inherited from class java.awt.image.ColorModel
coerceData, createCompatibleSampleModel, createCompatibleWritableRaster, equals, finalize, getAlpha, getAlphaRaster, getBlue, getColorSpace, getComponents, getComponents, getComponentSize, getComponentSize, getDataElement, getDataElement, getDataElements, getDataElements, getDataElements, getGreen, getNormalizedComponents, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRed, getRGB, getRGBdefault, getTransferType, getTransparency, getUnnormalizedComponents, hasAlpha, hashCode, isAlphaPremultiplied, isCompatibleRaster, isCompatibleSampleModel, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlvAdjustableDelegateColorModel

public IlvAdjustableDelegateColorModel(ColorModel cm)
Creates an adjustable color model based on the supplied color model.

Parameters:
cm - Color model to wrap.

IlvAdjustableDelegateColorModel

public IlvAdjustableDelegateColorModel(IlvInputStream stream)
                                throws IlvReadFileException
Creates an IlvAdjustableDelegateColorModel by reading a stream.

Parameters:
stream - stream to read from.
Throws:
IlvReadFileException
Method Detail

getBrightness

public double getBrightness()
Returns the brightness.

Returns:
Returns the brightness.

setBrightness

public void setBrightness(double brightness)
Sets a new level of brightness.

Parameters:
brightness - The brightness to set.

getSaturation

public double getSaturation()
Returns the saturation.

Returns:
Returns the saturation.

getTransparentPixel

public int getTransparentPixel()
Returns the transparent Pixel.

Returns:
Returns the transparent Pixel.

setTransparentPixel

public void setTransparentPixel(int transparentPixel)
Sets a transparent pixel value used to return a fully transparent rgb value.

Parameters:
transparentPixel - The transparent Pixel to set.

setSaturation

public void setSaturation(double saturation)
Sets a new level of saturation.

Parameters:
saturation - The saturation to set.

getContrast

public double getContrast()
Returns the contrast.

Returns:
Returns the contrast.

setContrast

public void setContrast(double contrast)
Sets a new level of contrast.

Parameters:
contrast - The contrast to set.

setColorModel

public void setColorModel(ColorModel colorModel)
Sets the color model used internally.

Parameters:
colorModel - The color Model to set.

getRGB

public int getRGB(int pixel)
Apply brightness,saturation, contrast and transparent pixel settings to the value returned by the delegate.

Overrides:
getRGB in class ColorModel
See Also:
ColorModel.getRGB(int)

brightShade

public int brightShade(int rgb)
Computes the rgb value passed into a brighter version, for raster shading.

Parameters:
rgb - 4 bytes value of (A,R,G,B)
Returns:
the new ARGB value.

darkShade

public int darkShade(int rgb)
Computes the rgb value passed into a darker version, for raster shading.

Parameters:
rgb - 4 bytes value of (A,R,G,B)
Returns:
the new ARGB value.

getAlpha

public int getAlpha(int pixel)
Returns the alpha color component for the specified pixel.

Specified by:
getAlpha in class ColorModel
See Also:
ColorModel.getAlpha(int)

getBlue

public int getBlue(int pixel)
Returns the blue color component for the specified pixel.

Specified by:
getBlue in class ColorModel
See Also:
ColorModel.getBlue(int)

getGreen

public int getGreen(int pixel)
Returns the green color component for the specified pixel.

Specified by:
getGreen in class ColorModel
See Also:
ColorModel.getGreen(int)

getRed

public int getRed(int pixel)
Returns the red color component for the specified pixel.

Specified by:
getRed in class ColorModel
See Also:
ColorModel.getRed(int)

readColorModel

public static ColorModel readColorModel(IlvInputStream stream)
                                 throws IlvReadFileException
Reads a color model from an input stream.

Parameters:
stream - The input stream.
Returns:
Returns the color model read or null.
Throws:
IlvReadFileException - if an error occurs while reading the data.
Since:
JViews 7.5

write

public void write(IlvOutputStream out)
           throws IOException
Writes the color model of this raster.

Specified by:
write in interface IlvPersistentObject
Parameters:
out - The output stream.
Throws:
IOException - if an error occurs while writing the data.

writeColorModel

public static void writeColorModel(ColorModel colorModel,
                                   IlvOutputStream out)
                            throws IOException
Write the specified ColorModel to the specified IlvOutputStream.

Parameters:
colorModel - the ColorModel to write.
out - the IlvOutputStream to write to.
Throws:
IOException - if an I/O exception occurs during the writing process.
Since:
JViews 7.5

getColorModel

public ColorModel getColorModel()
Returns the delegate colorModel.

Returns:
Returns the delegate colorModel.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.