java.awt.image
public class RescaleOp extends Object implements BufferedImageOp, RasterOp
Constructor and Description |
---|
RescaleOp(float[] scaleFactors,
float[] offsets,
RenderingHints hints)
Create a new RescaleOp object using the given scale factors and offsets.
|
RescaleOp(float scaleFactor,
float offset,
RenderingHints hints)
Create a new RescaleOp object using the given scale factor and offset.
|
Modifier and Type | Method and Description |
---|---|
BufferedImage |
createCompatibleDestImage(BufferedImage src,
ColorModel dstCM)
Returns a new
BufferedImage that can be used by this
BufferedImageOp as the destination image when filtering
the specified source image. |
WritableRaster |
createCompatibleDestRaster(Raster src)
Returns a raster that can be used by this
RasterOp as the
destination raster when operating on the specified source raster. |
BufferedImage |
filter(BufferedImage src,
BufferedImage dst)
Converts the source image using the scale factors and offsets specified in
the constructor.
|
WritableRaster |
filter(Raster src,
WritableRaster dest)
Performs an operation on the source raster, returning the result in a
writable raster.
|
Rectangle2D |
getBounds2D(BufferedImage src)
Returns the bounds of the destination image on the basis of this
BufferedImageOp being applied to the specified source image. |
Rectangle2D |
getBounds2D(Raster src)
Returns the bounds of the destination raster on the basis of this
RasterOp being applied to the specified source raster. |
int |
getNumFactors()
Returns the number of scaling factors / offsets.
|
float[] |
getOffsets(float[] offsets)
Returns the offsets.
|
Point2D |
getPoint2D(Point2D src,
Point2D dst)
Returns the point on the destination image that corresponds to the given
point on the source image.
|
RenderingHints |
getRenderingHints()
Returns the rendering hints for this operation.
|
float[] |
getScaleFactors(float[] scaleFactors)
Returns the scaling factors.
|
public RescaleOp(float[] scaleFactors, float[] offsets, RenderingHints hints)
scaleFactors
- an array of scale factors.offsets
- an array of offsets.hints
- any rendering hints to use (can be null).NullPointerException
- if the scaleFactors or offsets array is null.public RescaleOp(float scaleFactor, float offset, RenderingHints hints)
scaleFactor
- the scale factor to use.offset
- the offset to use.hints
- any rendering hints to use (can be null).public final float[] getScaleFactors(float[] scaleFactors)
scaleFactors
- array to store the scaling factors in (can be null).public final float[] getOffsets(float[] offsets)
offsets
- array to store the offsets in (can be null).public final int getNumFactors()
public final RenderingHints getRenderingHints()
BufferedImageOp
getRenderingHints
in interface BufferedImageOp
getRenderingHints
in interface RasterOp
public final BufferedImage filter(BufferedImage src, BufferedImage dst)
filter
in interface BufferedImageOp
src
- The source image.dst
- The destination image.IllegalArgumentException
- if the rasters and/or color spaces are
incompatible.public final WritableRaster filter(Raster src, WritableRaster dest)
RasterOp
dest
is null
, a new
WritableRaster
will be created by calling the
RasterOp.createCompatibleDestRaster(Raster)
method. If dest
is not null
, the result is written to dest
then
returned (this avoids creating a new WritableRaster
each
time this method is called).public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM)
BufferedImageOp
BufferedImage
that can be used by this
BufferedImageOp
as the destination image when filtering
the specified source image.createCompatibleDestImage
in interface BufferedImageOp
src
- the source image.dstCM
- the color model for the destination image.public WritableRaster createCompatibleDestRaster(Raster src)
RasterOp
RasterOp
as the
destination raster when operating on the specified source raster.createCompatibleDestRaster
in interface RasterOp
src
- the source raster.public final Rectangle2D getBounds2D(BufferedImage src)
BufferedImageOp
BufferedImageOp
being applied to the specified source image.getBounds2D
in interface BufferedImageOp
src
- the source image.public final Rectangle2D getBounds2D(Raster src)
RasterOp
RasterOp
being applied to the specified source raster.getBounds2D
in interface RasterOp
src
- the source raster.public final Point2D getPoint2D(Point2D src, Point2D dst)
BufferedImageOp
getPoint2D
in interface BufferedImageOp
getPoint2D
in interface RasterOp
src
- the source point.dst
- the destination point (null
permitted).