javax.media.jai.operator
Class ConstantDescriptor

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

public class ConstantDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Constant" operation.

The Constant operation creates a multi-banded, tiled rendered image, where all the pixels from the same band have a constant value. The width and height of the image must be specified and greater than 0. At least one constant must be supplied. The number of bands of the image is determined by the number of constant pixel values supplied in the "bandValues" parameter. The data type is determined by the type of the constants; this means all elements of the bandValues array must be of the same type.

If the bandValues array is a Short array, then TYPE_USHORT is used if all values are non-negative; otherwise TYPE_SHORT is used.

Resource List
Name Value
GlobalName Constant
LocalName Constant
Vendor com.sun.media.jai
Description Creates an image with constant pixel values.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/ConstantDescriptor.html
Version 1.0
arg0Desc Image width in pixels.
arg1Desc Image height in pixels.
arg2Desc The constant pixel band values.

Parameter List
Name Class Type Default Value
width java.lang.Float NO_PARAMETER_DEFAULT
height java.lang.Float NO_PARAMETER_DEFAULT
bandValues java.lang.Number[] NO_PARAMETER_DEFAULT

See Also:
OperationDescriptor, Serialized Form

Fields inherited from class javax.media.jai.OperationDescriptorImpl
resources, sourceNames, supportedModes
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
ConstantDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(Float width, Float height, Number[] bandValues, RenderingHints hints)
          Creates an image with constant pixel values.
static RenderableOp createRenderable(Float width, Float height, Number[] bandValues, RenderingHints hints)
          Creates an image with constant pixel values.
protected  boolean validateParameters(String modeName, ParameterBlock args, StringBuffer message)
          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, isRenderableSupported, 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

ConstantDescriptor

public ConstantDescriptor()
Constructor.
Method Detail

validateParameters

protected boolean validateParameters(String modeName,
                                     ParameterBlock args,
                                     StringBuffer message)
Validates the input parameters.

In addition to the standard checks performed by the superclass method, this method checks that "width" and "height" are greater than 0 (for rendered mode) and that "bandValues" has length at least 1.

Overrides:
validateParameters in class OperationDescriptorImpl
Following copied from class: javax.media.jai.OperationDescriptorImpl
Throws:
IllegalArgumentException - if any of the input parameters are null.
See Also:
OperationDescriptorImpl.validateArguments(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer), ParameterListDescriptorImpl.isParameterValueValid(java.lang.String, java.lang.Object)

create

public static RenderedOp create(Float width,
                                Float height,
                                Number[] bandValues,
                                RenderingHints hints)
Creates an image with constant pixel values.

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

Parameters:
width - Image width in pixels.
height - Image height in pixels.
bandValues - The constant pixel band values.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if width is null.
IllegalArgumentException - if height is null.
IllegalArgumentException - if bandValues is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp

createRenderable

public static RenderableOp createRenderable(Float width,
                                            Float height,
                                            Number[] bandValues,
                                            RenderingHints hints)
Creates an image with constant pixel values.

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

Parameters:
width - Image width in pixels.
height - Image height in pixels.
bandValues - The constant pixel band values.
hints - The RenderingHints to use. May be null.
Returns:
The RenderableOp destination.
Throws:
IllegalArgumentException - if width is null.
IllegalArgumentException - if height is null.
IllegalArgumentException - if bandValues is null.
See Also:
JAI, ParameterBlockJAI, RenderableOp