org.geotools.coverage.processing.operation
Class Recolor

Object
  extended by AbstractOperation
      extended by Operation2D
          extended by Recolor
All Implemented Interfaces:
Serializable, Operation

public final class Recolor
extends Operation2D

Operation replacing the colors of a org.geotools.coverage.grid.GridCoverage. This operation accepts one argument, ColorMaps, which must be an instance of ColorMap.

Since:
2.3
Author:
Martin Desruisseaux
See Also:
Serialized Form
Module:
modules/library/coverage (gt-coverage.jar)

Field Summary
static ParameterDescriptor COLOR_MAPS
          The parameter descriptor for the color map.
 
Fields inherited from class Operation2D
PRIMARY_SOURCE_INDEX, SOURCE_0
 
Fields inherited from class AbstractOperation
descriptor
 
Constructor Summary
Recolor()
          Constructs a new "Recolor" operation.
 
Method Summary
 Coverage doOperation(ParameterValueGroup parameters, Hints hints)
          Performs the color transformation.
protected  GridSampleDimension transformColormap(int[] ARGB, int band, GridSampleDimension sampleDimension, ParameterValueGroup parameters)
          Transforms the supplied RGB colors.
 
Methods inherited from class Operation2D
computeOnGeophysicsValues, extractSources, getFactory
 
Methods inherited from class AbstractOperation
ensureNonNull, equals, getDescription, getDocURL, getName, getNumSources, getParameters, getProcessor, getVendor, getVersion, hashCode, toString
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COLOR_MAPS

public static final ParameterDescriptor COLOR_MAPS
The parameter descriptor for the color map.

Constructor Detail

Recolor

public Recolor()
Constructs a new "Recolor" operation.

Method Detail

transformColormap

protected GridSampleDimension transformColormap(int[] ARGB,
                                                int band,
                                                GridSampleDimension sampleDimension,
                                                ParameterValueGroup parameters)
Transforms the supplied RGB colors.

Parameters:
ARGB - Alpha, Red, Green and Blue components to transform.
band - The band number, from 0 to the number of bands in the image -1.
sampleDimension - The sample dimension of band band.
parameters - The user-supplied parameters.
Returns:
A sample dimension identical to sampleDimension except for the colors. Subclasses may conservatively returns sampleDimension.
See Also:
ColorMap.recolor(org.geotools.coverage.GridSampleDimension, int[])

doOperation

public Coverage doOperation(ParameterValueGroup parameters,
                            Hints hints)
Performs the color transformation. This method invokes the transformColormap(...) method with current RGB colormap, the source SampleDimension and the supplied parameters.

Specified by:
doOperation in class AbstractOperation
Parameters:
parameters - The parameters.
hints - Rendering hints (ignored in this implementation).
Returns:
The result as a coverage.
Throws:
IllegalArgumentException - if the candidate image do not use an IndexColorModel.


Copyright © 1996-2009 Geotools. All Rights Reserved.