javax.media.jai.operator
Class RescaleDescriptor

java.lang.Object
  |
  +--javax.media.jai.OperationDescriptorImpl
        |
        +--javax.media.jai.operator.RescaleDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class RescaleDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Rescale" operation.

The "Rescale" operation takes a rendered or renderable source image and maps the pixel values of an image from one range to another range by multiplying each pixel value by one of a set of constants and then adding another constant to the result of the multiplication. If the number of constants supplied is less than the number of bands of the destination, then the constant from entry 0 is applied to all the bands. Otherwise, a constant from a different entry is applied to each band. There must be at least one entry in each of the contants and offsets arrays.

The destination pixel values are defined by the pseudocode:

 constant = (constants.length < dstNumBands) ?
            constants[0] : constants[b];
 offset = (offsets.length < dstNumBands) ?
          offsets[0] : offsets[b];

 dst[x][y][b] = src[x][y][b]*constant + offset;
 

The pixel arithmetic is performed using the data type of the destination image. By default, the destination will have the same data type as the source image unless an ImageLayout containing a SampleModel with a different data type is supplied as a rendering hint.

Resource List
Name Value
GlobalName Rescale
LocalName Rescale
Vendor com.sun.media.jai
Description Maps the pixels values of an image from one range to another range.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/RescaleDescriptor.html
Version 1.0
arg0Desc The per-band constants to multiply by.
arg1Desc The per-band offsets to be added.

Parameter List
Name Class Type Default Value
constants double[] NO_PARAMETER_DEFAULT
offsets double[] NO_PARAMETER_DEFAULT

See Also:
OperationDescriptor, Serialized Form

Fields inherited from class javax.media.jai.OperationDescriptorImpl
resources, sourceNames, supportedModes
 
Constructor Summary
RescaleDescriptor()
          Constructor.
 
Method Summary
 boolean isRenderableSupported()
          Returns true since renderable operation is supported.
protected  boolean validateParameters(ParameterBlock args, StringBuffer msg)
          Validates the input parameters.
 
Methods inherited from class javax.media.jai.OperationDescriptorImpl
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, validateArguments, validateParameters, validateRenderableArguments, validateRenderableSources, validateSources, validateSources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RescaleDescriptor

public RescaleDescriptor()
Constructor.
Method Detail

isRenderableSupported

public boolean isRenderableSupported()
Returns true since renderable operation is supported.
Overrides:
isRenderableSupported in class OperationDescriptorImpl
Tags copied from class: OperationDescriptorImpl
See Also:
OperationDescriptorImpl.isModeSupported(java.lang.String)

validateParameters

protected boolean validateParameters(ParameterBlock args,
                                     StringBuffer msg)
Validates the input parameters.

In addition to the standard checks performed by the superclass method, this method checks that the length of the "constants" and "offsets" arrays are each at least 1.

Overrides:
validateParameters in class OperationDescriptorImpl
Tags copied from class: OperationDescriptorImpl
Throws:
IllegalArgumentException - if args is null.
IllegalArgumentException - if msg is null and the validation fails.
See Also:
OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)