org.geotoolkit.coverage.processing
Class IndexColorOperation
Object
AbstractOperation
Operation2D
IndexColorOperation
- All Implemented Interfaces:
- Serializable, Operation
- Direct Known Subclasses:
- Recolor
@Immutable
public abstract class IndexColorOperation
- extends Operation2D
Operation applied on the IndexColorModel of the image backing the source grid coverage.
The doOperation method extracts the color map of the source coverage as an
array of ARGB values, passes that array to transformColormap and
creates a new grid coverage using the new colors.
- Since:
- 1.2
- Version:
- 3.14
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
- Module:
IndexColorOperation
protected IndexColorOperation(DefaultParameterDescriptorGroup descriptor)
- Constructs an operation. The operation name will be the same than the
parameter descriptor name.
- Parameters:
descriptor - The parameters descriptor.
getComputationView
protected ViewType getComputationView(ParameterValueGroup parameters)
- Returns
ViewType.RENDERED as the preferred view for computation purpose.
- Overrides:
getComputationView in class Operation2D
- Parameters:
parameters - The parameters supplied by the user to the doOperation method.
- Returns:
- The view on which computation should be performed.
- See Also:
GridCoverage2D.view(ViewType)
doOperation
protected Coverage doOperation(ParameterValueGroup parameters,
Hints hints)
throws IllegalArgumentException
- Performs the color transformation. This method invokes the
transformColormap(...) method with the ARGB colors found in the source image, its
GridSampleDimension and the parameters supplied to this method. The new colors
returned by transformColormap are used for creating a grid coverage backed by
and image using a new IndexColorModel.
- 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 image do not use an IndexColorModel.
transformColormap
protected abstract GridSampleDimension transformColormap(int[] ARGB,
int band,
GridSampleDimension sampleDimension,
ParameterValueGroup parameters)
- Transforms the supplied RGB colors. This method is automatically invoked
by
doOperation(...) for each band in the source
GridCoverage2D. The ARGB array contains the ARGB values
from the current source and should be overridden with new ARGB values
for the destination image.
This method is usually invoked only once, since images backed by IndexColorModel
normally have only one band. However it may happen that an image contains additional
"invisible" bands, in which case this method will be invoked for those bands as well.
- 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.
Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.