javax.media.jai.operator
Class OrderedDitherDescriptor

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

public class OrderedDitherDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "OrderedDither" operation.

The "OrderedDither" operation performs color quantization by finding the nearest color to each pixel in a supplied color cube and "shifting" the resulting index value by a pseudo-random amount determined by the values of a supplied dither mask.

The dither mask is supplied as an array of KernelJAI objects the length of which must equal the number of bands in the image. Each element of the array is a KernelJAI object which represents the dither mask matrix for the corresponding band. All KernelJAI objects in the array must have the same dimensions and contain floating point values greater than or equal to 0.0 and less than or equal to 1.0.

For all integral data types, the source image samples are presumed to occupy the full range of the respective types. For floating point data types it is assumed that the data samples have been scaled to the range [0.0, 1.0].

Resource List
Name Value
GlobalName OrderedDither
LocalName OrderedDither
Vendor com.sun.media.jai
Description Performs ordered dither color quantization using a specified color cube and dither mask.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/OrderedDitherDescriptor.html
Version 1.0
arg0Desc The color cube.
arg1Desc The dither mask.

Parameter List
Name Class Type Default Value
colorMap javax.media.jai.ColorCube ColorCube.BYTE_496
ditherMask javax.media.jai.KernelJAI[] KernelJAI.DITHER_MASK_443

See Also:
KernelJAI, ColorCube, OperationDescriptor, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.OperationDescriptorImpl
sourceNames
 
Fields inherited from interface javax.media.jai.OperationDescriptor
NO_PARAMETER_DEFAULT
 
Constructor Summary
OrderedDitherDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, ColorCube colorMap, KernelJAI[] ditherMask, RenderingHints hints)
          Performs ordered dither color quantization using a specified color cube and dither mask.
 boolean validateArguments(String modeName, ParameterBlock args, StringBuffer msg)
          Validates the input source and 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, validateParameters, 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

OrderedDitherDescriptor

public OrderedDitherDescriptor()
Constructor.

Method Detail

validateArguments

public boolean validateArguments(String modeName,
                                 ParameterBlock args,
                                 StringBuffer msg)
Validates the input source and parameters.

In addition to the standard checks performed by the superclass method, this method checks that "colorMap" and "ditherMask" are valid for the given source image.

Specified by:
validateArguments in interface OperationDescriptor
Overrides:
validateArguments in class OperationDescriptorImpl
Parameters:
modeName - the operation mode name
args - Input arguments, including source(s) and/or parameter(s).
msg - A string that may contain error messages.
See Also:
OperationDescriptorImpl.validateSources(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer), OperationDescriptorImpl.validateParameters(java.lang.String, java.awt.image.renderable.ParameterBlock, java.lang.StringBuffer)

create

public static RenderedOp create(RenderedImage source0,
                                ColorCube colorMap,
                                KernelJAI[] ditherMask,
                                RenderingHints hints)
Performs ordered dither color quantization using a specified color cube and dither mask.

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

Parameters:
source0 - RenderedImage source 0.
colorMap - The color cube. May be null.
ditherMask - The dither mask. May be null.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp