Class AffineTransformOp
- All Implemented Interfaces:
- BufferedImageOp,- RasterOp
Raster to 2D coordinates
 in the destination image or Raster.
 The type of interpolation that is used is specified through a constructor,
 either by a RenderingHints object or by one of the integer
 interpolation types defined in this class.
 
 If a RenderingHints object is specified in the constructor, the
 interpolation hint and the rendering quality hint are used to set
 the interpolation type for this operation.  The color rendering hint
 and the dithering hint can be used when color conversion is required.
 
Note that the following constraints have to be met:
- The source and destination must be different.
- For Rasterobjects, the number of bands in the source must be equal to the number of bands in the destination.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intBicubic interpolation type.static final intBilinear interpolation type.static final intNearest-neighbor interpolation type.
- 
Constructor SummaryConstructorsConstructorDescriptionAffineTransformOp(AffineTransform xform, int interpolationType) Constructs anAffineTransformOpgiven an affine transform and the interpolation type.AffineTransformOp(AffineTransform xform, RenderingHints hints) Constructs anAffineTransformOpgiven an affine transform.
- 
Method SummaryModifier and TypeMethodDescriptioncreateCompatibleDestImage(BufferedImage src, ColorModel destCM) Creates a zeroed destination image with the correct size and number of bands.Creates a zeroed destinationRasterwith the correct size and number of bands.final BufferedImagefilter(BufferedImage src, BufferedImage dst) Transforms the sourceBufferedImageand stores the results in the destinationBufferedImage.final WritableRasterfilter(Raster src, WritableRaster dst) Transforms the sourceRasterand stores the results in the destinationRaster.final Rectangle2DgetBounds2D(BufferedImage src) Returns the bounding box of the transformed destination.final Rectangle2DgetBounds2D(Raster src) Returns the bounding box of the transformed destination.final intReturns the interpolation type used by this op.final Point2DgetPoint2D(Point2D srcPt, Point2D dstPt) Returns the location of the corresponding destination point given a point in the source.final RenderingHintsReturns the rendering hints used by this transform operation.final AffineTransformReturns the affine transform used by this transform operation.
- 
Field Details- 
TYPE_NEAREST_NEIGHBORNearest-neighbor interpolation type.- See Also:
 
- 
TYPE_BILINEAR
- 
TYPE_BICUBIC
 
- 
- 
Constructor Details- 
AffineTransformOpConstructs anAffineTransformOpgiven an affine transform. The interpolation type is determined from theRenderingHintsobject. If the interpolation hint is defined, it will be used. Otherwise, if the rendering quality hint is defined, the interpolation type is determined from its value. If no hints are specified (hintsis null), the interpolation type isTYPE_NEAREST_NEIGHBOR.- Parameters:
- xform- The- AffineTransformto use for the operation.
- hints- The- RenderingHintsobject used to specify the interpolation type for the operation.
- Throws:
- ImagingOpException- if the transform is non-invertible.
- See Also:
 
- 
AffineTransformOpConstructs anAffineTransformOpgiven an affine transform and the interpolation type.- Parameters:
- xform- The- AffineTransformto use for the operation.
- interpolationType- One of the integer interpolation type constants defined by this class:- TYPE_NEAREST_NEIGHBOR,- TYPE_BILINEAR,- TYPE_BICUBIC.
- Throws:
- ImagingOpException- if the transform is non-invertible.
 
 
- 
- 
Method Details- 
getInterpolationTypepublic final int getInterpolationType()Returns the interpolation type used by this op.- Returns:
- the interpolation type.
- See Also:
 
- 
filterTransforms the sourceBufferedImageand stores the results in the destinationBufferedImage. If the color models for the two images do not match, a color conversion into the destination color model is performed. If the destination image is null, aBufferedImageis created with the sourceColorModel.The coordinates of the rectangle returned by getBounds2D(BufferedImage)are not necessarily the same as the coordinates of theBufferedImagereturned by this method. If the upper-left corner coordinates of the rectangle are negative then this part of the rectangle is not drawn. If the upper-left corner coordinates of the rectangle are positive then the filtered image is drawn at that position in the destinationBufferedImage.An IllegalArgumentExceptionis thrown if the source is the same as the destination.- Specified by:
- filterin interface- BufferedImageOp
- Parameters:
- src- The- BufferedImageto transform.
- dst- The- BufferedImagein which to store the results of the transformation.
- Returns:
- The filtered BufferedImage.
- Throws:
- IllegalArgumentException- if- srcand- dstare the same
- ImagingOpException- if the image cannot be transformed because of a data-processing error that might be caused by an invalid image format, tile format, or image-processing operation, or any other unsupported operation.
 
- 
filterTransforms the sourceRasterand stores the results in the destinationRaster. This operation performs the transform band by band.If the destination Rasteris null, a newRasteris created. AnIllegalArgumentExceptionmay be thrown if the source is the same as the destination or if the number of bands in the source is not equal to the number of bands in the destination.The coordinates of the rectangle returned by getBounds2D(Raster)are not necessarily the same as the coordinates of theWritableRasterreturned by this method. If the upper-left corner coordinates of rectangle are negative then this part of the rectangle is not drawn. If the coordinates of the rectangle are positive then the filtered image is drawn at that position in the destinationRaster.- Specified by:
- filterin interface- RasterOp
- Parameters:
- src- The- Rasterto transform.
- dst- The- Rasterin which to store the results of the transformation.
- Returns:
- The transformed Raster.
- Throws:
- ImagingOpException- if the raster cannot be transformed because of a data-processing error that might be caused by an invalid image format, tile format, or image-processing operation, or any other unsupported operation.
 
- 
getBounds2DReturns the bounding box of the transformed destination. The rectangle returned is the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0, 0).- Specified by:
- getBounds2Din interface- BufferedImageOp
- Parameters:
- src- The- BufferedImageto be transformed.
- Returns:
- The Rectangle2Drepresenting the destination's bounding box.
 
- 
getBounds2DReturns the bounding box of the transformed destination. The rectangle returned will be the actual bounding box of the transformed points. The coordinates of the upper-left corner of the returned rectangle might not be (0, 0).- Specified by:
- getBounds2Din interface- RasterOp
- Parameters:
- src- The- Rasterto be transformed.
- Returns:
- The Rectangle2Drepresenting the destination's bounding box.
 
- 
createCompatibleDestImageCreates a zeroed destination image with the correct size and number of bands. ARasterFormatExceptionmay be thrown if the transformed width or height is equal to 0.If destCMis null, an appropriateColorModelis used; thisColorModelmay have an alpha channel even if the sourceColorModelis opaque.- Specified by:
- createCompatibleDestImagein interface- BufferedImageOp
- Parameters:
- src- The- BufferedImageto be transformed.
- destCM-- ColorModelof the destination. If null, an appropriate- ColorModelis used.
- Returns:
- The zeroed destination image.
 
- 
createCompatibleDestRasterCreates a zeroed destinationRasterwith the correct size and number of bands. ARasterFormatExceptionmay be thrown if the transformed width or height is equal to 0.- Specified by:
- createCompatibleDestRasterin interface- RasterOp
- Parameters:
- src- The- Rasterto be transformed.
- Returns:
- The zeroed destination Raster.
 
- 
getPoint2DReturns the location of the corresponding destination point given a point in the source. IfdstPtis specified, it is used to hold the return value.- Specified by:
- getPoint2Din interface- BufferedImageOp
- Specified by:
- getPoint2Din interface- RasterOp
- Parameters:
- srcPt- The- Point2Dthat represents the source point.
- dstPt- The- Point2Din which to store the result.
- Returns:
- The Point2Din the destination that corresponds to the specified point in the source.
 
- 
getTransformReturns the affine transform used by this transform operation.- Returns:
- The AffineTransformassociated with this op.
 
- 
getRenderingHintsReturns the rendering hints used by this transform operation.- Specified by:
- getRenderingHintsin interface- BufferedImageOp
- Specified by:
- getRenderingHintsin interface- RasterOp
- Returns:
- The RenderingHintsobject associated with this op.
 
 
-