javax.media.jai.operator
Class SubtractFromConstDescriptor

java.lang.Object
  extended byjavax.media.jai.OperationDescriptorImpl
      extended byjavax.media.jai.operator.SubtractFromConstDescriptor
All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class SubtractFromConstDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "SubtractFromConst" operation.

The SubtractFromConst operation takes one rendered or renderable image and an array of double constants, and subtracts every pixel of the same band of the source from the constant from the corresponding array entry. 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.

By default, the destination image bound, data type, and number of bands are the same as the source image. If the result of the operation underflows/overflows the minimum/maximum value supported by the destination data type, then it will be clamped to the minimum/maximum value respectively.

The destination pixel values are defined by the pseudocode:

 if (constants.length < dstNumBands) {
     dst[x][y][b] = constants[0] - src[x][y][b];
 } else {
     dst[x][y][b] = constants[b] - src[x][y][b];
 }
 

Resource List
Name Value
GlobalName SubtractFromConst
LocalName SubtractFromConst
Vendor com.sun.media.jai
Description Subtracts an image from constants.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/SubtractFromConstDescriptor.html
Version 1.0
arg0Desc The constants to be subtracted from.

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

See Also:
OperationDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
SubtractFromConstDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, double[] constants, RenderingHints hints)
          Subtracts an image from constants.
static RenderableOp createRenderable(RenderableImage source0, double[] constants, RenderingHints hints)
          Subtracts an image from constants.
 boolean isRenderableSupported()
          Returns true since renderable operation is supported.
protected  boolean validateParameters(ParameterBlock args, StringBuffer message)
          Validates the input parameter.
 
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

SubtractFromConstDescriptor

public SubtractFromConstDescriptor()
Constructor.

Method Detail

isRenderableSupported

public boolean isRenderableSupported()
Returns true since renderable operation is supported.

Specified by:
isRenderableSupported in interface OperationDescriptor
Overrides:
isRenderableSupported in class OperationDescriptorImpl
See Also:
OperationDescriptorImpl.isModeSupported(java.lang.String)

validateParameters

protected boolean validateParameters(ParameterBlock args,
                                     StringBuffer message)
Validates the input parameter.

In addition to the standard checks performed by the superclass method, this method checks that the length of the "constants" array is at least 1.

Overrides:
validateParameters in class OperationDescriptorImpl
See Also:
OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)

create

public static RenderedOp create(RenderedImage source0,
                                double[] constants,
                                RenderingHints hints)
Subtracts an image from constants.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.create(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderedImage source 0.
constants - The constants to be subtracted from.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if constants is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp

createRenderable

public static RenderableOp createRenderable(RenderableImage source0,
                                            double[] constants,
                                            RenderingHints hints)
Subtracts an image from constants.

Creates a ParameterBlockJAI from all supplied arguments except hints and invokes JAI.createRenderable(String,ParameterBlock,RenderingHints).

Parameters:
source0 - RenderableImage source 0.
constants - The constants to be subtracted from.
hints - The RenderingHints to use. May be null.
Returns:
The RenderableOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if constants is null.
See Also:
JAI, ParameterBlockJAI, RenderableOp