|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.image.AffineTransformOp
This class uses an affine transform to perform a linear mapping from
2D coordinates in the source image or 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:
Raster
objects, the number of bands in the source must
be equal to the number of bands in the destination.
AffineTransform
,
BufferedImageFilter
,
RenderingHints.KEY_INTERPOLATION
,
RenderingHints.KEY_RENDERING
,
RenderingHints.KEY_COLOR_RENDERING
,
RenderingHints.KEY_DITHERING
Field Summary | |
static int |
TYPE_BILINEAR
Bilinear interpolation type. |
static int |
TYPE_NEAREST_NEIGHBOR
Nearest-neighbor interpolation type. |
Constructor Summary | |
AffineTransformOp(AffineTransform xform,
int interpolationType)
Constructs an AffineTransformOp given an affine transform
and the interpolation type. |
|
AffineTransformOp(AffineTransform xform,
RenderingHints hints)
Constructs an AffineTransformOp given an affine transform. |
Method Summary | |
BufferedImage |
createCompatibleDestImage(BufferedImage src,
ColorModel destCM)
Creates a zeroed destination image with the correct size and number of bands. |
WritableRaster |
createCompatibleDestRaster(Raster src)
Creates a zeroed destination Raster with the correct size
and number of bands. |
BufferedImage |
filter(BufferedImage src,
BufferedImage dst)
Transforms the source BufferedImage and stores the results
in the destination BufferedImage . |
WritableRaster |
filter(Raster src,
WritableRaster dst)
Transforms the source Raster and stores the results in
the destination Raster . |
Rectangle2D |
getBounds2D(BufferedImage src)
Returns the bounding box of the transformed destination. |
Rectangle2D |
getBounds2D(Raster src)
Returns the bounding box of the transformed destination. |
int |
getInterpolationType()
Returns the interpolation type used by this op. |
Point2D |
getPoint2D(Point2D srcPt,
Point2D dstPt)
Returns the location of the corresponding destination point given a point in the source. |
RenderingHints |
getRenderingHints()
Returns the rendering hints used by this transform operation. |
AffineTransform |
getTransform()
Returns the affine transform used by this transform operation. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int TYPE_NEAREST_NEIGHBOR
public static final int TYPE_BILINEAR
Constructor Detail |
public AffineTransformOp(AffineTransform xform, RenderingHints hints)
AffineTransformOp
given an affine transform.
The interpolation type is determined from the
RenderingHints
object. 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 is specified (hints
is null),
the interpolation type is TYPE_NEAREST_NEIGHBOR.xform
- The AffineTransform
to use for the operation.hints
- The RenderingHints
object used to specify the
interpolation type for the operation.RenderingHints.KEY_INTERPOLATION
,
RenderingHints.KEY_RENDERING
public AffineTransformOp(AffineTransform xform, int interpolationType)
AffineTransformOp
given an affine transform
and the interpolation type.xform
- The AffineTransform
to use for the operation.interpolationType
- One of the integer
interpolation type constants defined by this class: TYPE_NEAREST_NEIGHBOR,
TYPE_BILINEAR,Method Detail |
public final int getInterpolationType()
TYPE_NEAREST_NEIGHBOR
,
TYPE_BILINEAR
public final BufferedImage filter(BufferedImage src, BufferedImage dst)
BufferedImage
and stores the results
in the destination BufferedImage
.
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,
a BufferedImage
is created with the source
ColorModel
.
An IllegalArgumentException
may be thrown if the source is
the same as the destination.src
- The BufferedImage
to transform.dst
- The BufferedImage
in which to store the results
of the transformation.BufferedImage
.public final WritableRaster filter(Raster src, WritableRaster dst)
Raster
and stores the results in
the destination Raster
. This operation performs the
transform band by band.
If the destination Raster
is null, a new
Raster
is created.
An IllegalArgumentException
may 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.
src
- The Raster
to transform.dst
- The Raster
in which to store the results of the
transformation.Raster
.Raster
cannot be
transformed.public final Rectangle2D getBounds2D(BufferedImage src)
src
- The BufferedImage
to be transformed.Rectangle2D
representing the destination's
bounding box.public final Rectangle2D getBounds2D(Raster src)
src
- The Raster
to be transformed.Rectangle2D
representing the destination's
bounding box.public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM)
RasterFormatException
may be thrown if the
transformed width or height is equal to 0.
If destCM
is null,
an appropriate ColorModel
is used; this
ColorModel
may have
an alpha channel even if the source ColorModel
is opaque.
src
- The BufferedImage
to be transformed.destCM
- ColorModel
of the destination. If null,
an appropriate ColorModel
is used.public WritableRaster createCompatibleDestRaster(Raster src)
Raster
with the correct size
and number of bands. A RasterFormatException
may be thrown
if the transformed width or height is equal to 0.src
- The Raster
to be transformed.Raster
.public final Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
dstPt
is specified, it
is used to hold the return value.dstPt
- The Point2D
in which to store the result.Point2D
in the destination that corresponds to
the specified point in the source.public final AffineTransform getTransform()
AffineTransform
associated with this op.public final RenderingHints getRenderingHints()
RenderingHints
object associated with this op.
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |