Class ShearDescriptor

All Implemented Interfaces:
OperationDescriptor, RegistryElementDescriptor, Serializable

public class ShearDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Shear" operation.

The "Shear" operation shears an image either horizontally or vertically. For each pixel (x, y) of the destination, the source value at the fractional subpixel position (x', y') is constructed by means of an Interpolation object and written to the destination.

If the "shearDir" parameter is equal to SHEAR_HORIZONTAL then x' = (x - xTrans - y*shear) and y' = y. If the "shearDir" parameter is equal to SHEAR_VERTICAL then x' = x and y' = (y - yTrans - x*shear).

The parameter, "backgroundValues", is defined to fill the background with the user-specified background values. These background values will be translated into background colors by the ColorModel when the image is displayed. With the default value, {0.0}, of this parameter, the background pixels are filled with 0s. If the provided array length is smaller than the number of bands, the first element of the provided array is used for all the bands. If the provided values are out of the data range of the destination image, they will be clamped into the proper range.

It may be noted that the minX, minY, width and height hints as specified through the JAI.KEY_IMAGE_LAYOUT hint in the RenderingHints object are not honored, as this operator calculates the destination image bounds itself. The other ImageLayout hints, like tileWidth and tileHeight, however are honored.

It should be noted that this operation automatically adds a value of Boolean.TRUE for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL to the given configuration so that the operation is performed on the pixel values instead of being performed on the indices into the color map if the source(s) have an IndexColorModel. This addition will take place only if a value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL has not already been provided by the user. Note that the configuration Map is cloned before the new hint is added to it. The operation can be smart about the value of the JAI.KEY_REPLACE_INDEX_COLOR_MODEL RenderingHints, i.e. while the default value for the JAI.KEY_REPLACE_INDEX_COLOR_MODEL is Boolean.TRUE, in some cases the operator could set the default.

"Shear" defines a PropertyGenerator that performs an identical transformation on the "ROI" property of the source image, which can be retrieved by calling the getProperty method with "ROI" as the property name.

Resource List
Name Value
GlobalName shear
LocalName shear
Description Shears an image.
Version 1.0
arg0Desc The shear value.
arg1Desc The shear direction.
arg2Desc The X translation.
arg3Desc The Y translation.
arg4Desc The interpolation method for resampling.

Parameter List
Name Class Type Default Value
shear java.lang.Float 0.0F
xTrans java.lang.Float 0.0F
yTrans java.lang.Float 0.0F
interpolation InterpolationNearest
backgroundValues double[] {0.0}

See Also:
Interpolation, OperationDescriptor, ShearDir, Serialized Form

Field Summary
static ShearDir SHEAR_VERTICAL
Fields inherited from class
resources, sourceNames, supportedModes
Fields inherited from interface
Constructor Summary
Method Summary
static RenderedOp create(RenderedImage source0, Float shear, ShearDir shearDir, Float xTrans, Float yTrans, Interpolation interpolation, double[] backgroundValues, RenderingHints hints)
          Shears an image.
 PropertyGenerator[] getPropertyGenerators()
          Returns an array of PropertyGenerators implementing property inheritance for the "Shear" operation.
Methods inherited from class
arePropertiesSupported, getDefaultSourceClass, getDestClass, getDestClass, getInvalidRegion, getName, getNumParameters, getNumSources, getParamClasses, getParamDefaults, getParamDefaultValue, getParameterListDescriptor, getParamMaxValue, getParamMinValue, getParamNames, getPropertyGenerators, getRenderableDestClass, getRenderableSourceClasses, getResourceBundle, getResources, getSourceClasses, getSourceClasses, getSourceNames, getSupportedModes, isImmediate, isModeSupported, isRenderableSupported, isRenderedSupported, makeDefaultSourceClassList, validateArguments, 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

Field Detail


public static final ShearDir SHEAR_HORIZONTAL


public static final ShearDir SHEAR_VERTICAL
Constructor Detail


public ShearDescriptor()
Method Detail


public PropertyGenerator[] getPropertyGenerators()
Returns an array of PropertyGenerators implementing property inheritance for the "Shear" operation.
getPropertyGenerators in class OperationDescriptorImpl
An array of property generators.


public static RenderedOp create(RenderedImage source0,
                                Float shear,
                                ShearDir shearDir,
                                Float xTrans,
                                Float yTrans,
                                Interpolation interpolation,
                                double[] backgroundValues,
                                RenderingHints hints)
Shears an image.

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

source0 - RenderedImage source 0.
shear - The shear value. May be null.
shearDir - The shear direction. May be null.
xTrans - The X translation. May be null.
yTrans - The Y translation. May be null.
interpolation - The interpolation method for resampling. May be null.
backgroundValues - The user-specified background values. May be null.
hints - The RenderingHints to use. May be null.
The RenderedOp destination.
IllegalArgumentException - if source0 is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp