javax.media.jai.operator
Class CropDescriptor

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

public class CropDescriptor
extends OperationDescriptorImpl

An OperationDescriptor describing the "Crop" operation.

The Crop operation takes one rendered or renderable image and crops the image to a specified rectangular area. The rectangular area must not be empty, and must be fully contained with the source image bounds.

For rendered images the supplied origin and dimensions are used to determine the smallest rectangle with integral origin and dimensions which encloses the rectangular area requested.

For renderable images the rectangular area is specified in rendering-independent coordinates. When the image is rendered this area will be mapped to rendered image coordinates using the affine transform supplied for the rendering. The crop bounds in rendered coordinates are defined to be the minimum bounding box of the rectangular area mapped to rendered image coordinates.

Resource List
Name Value
GlobalName Crop
LocalName Crop
Vendor com.sun.media.jai
Description Crops the pixel values of a rendered image to a specified rectangle.
DocURL http://java.sun.com/products/java-media/jai/forDevelopers/jai-apidocs/javax/media/jai/operator/CropDescriptor.html
Version 1.0
arg0Desc The x origin for each band.
arg1Desc The y origin for each band.
arg2Desc The width for each band.
arg3Desc The height for each band.

Parameter List
Name Class Type Default Value
x Float NO_PARAMETER_DEFAULT
y Float NO_PARAMETER_DEFAULT
width Float NO_PARAMETER_DEFAULT
height Float NO_PARAMETER_DEFAULT

See Also:
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
CropDescriptor()
          Constructor.
 
Method Summary
static RenderedOp create(RenderedImage source0, Float x, Float y, Float width, Float height, RenderingHints hints)
          Performs cropping to a specified bounding box.
static RenderableOp createRenderable(RenderableImage source0, Float x, Float y, Float width, Float height, RenderingHints hints)
          Performs cropping to a specified bounding box.
 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

CropDescriptor

public CropDescriptor()
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 "x", "y", "width", and "height" form a rectangle that is not empty and that is fully contained within the bounds of the 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,
                                Float x,
                                Float y,
                                Float width,
                                Float height,
                                RenderingHints hints)
Performs cropping to a specified bounding box.

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

Parameters:
source0 - RenderedImage source 0.
x - The x origin of the cropping operation.
y - The y origin of the cropping operation.
width - The width of the cropping operation.
height - The height of the cropping operation.
hints - The RenderingHints to use. May be null.
Returns:
The RenderedOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if x is null.
IllegalArgumentException - if y is null.
IllegalArgumentException - if width is null.
IllegalArgumentException - if height is null.
See Also:
JAI, ParameterBlockJAI, RenderedOp

createRenderable

public static RenderableOp createRenderable(RenderableImage source0,
                                            Float x,
                                            Float y,
                                            Float width,
                                            Float height,
                                            RenderingHints hints)
Performs cropping to a specified bounding box.

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

Parameters:
source0 - RenderableImage source 0.
x - The x origin of the cropping operation.
y - The y origin of the cropping operation.
width - The width of the cropping operation.
height - The height of the cropping operation.
hints - The RenderingHints to use. May be null.
Returns:
The RenderableOp destination.
Throws:
IllegalArgumentException - if source0 is null.
IllegalArgumentException - if x is null.
IllegalArgumentException - if y is null.
IllegalArgumentException - if width is null.
IllegalArgumentException - if height is null.
See Also:
JAI, ParameterBlockJAI, RenderableOp