Package com.day.image
Class ResizeOp
- java.lang.Object
-
- com.day.image.AbstractBufferedImageOp
-
- com.day.image.ResizeOp
-
- All Implemented Interfaces:
BufferedImageOp
public class ResizeOp extends AbstractBufferedImageOp
The ResizeOp class implements a weighted resize filter which produces better results than the scaling AffineTransformOp and is faster than a blurring ConvolveOp with a following scaling AffineTransformOp.The
RenderingHints
defined at construction time are used if the destination color model has to be adapted for the filter operation.Note that the following constraints have to be met
- The
source
anddestination
must be different.
- Since:
- coati
- See Also:
- Implementation of Image Resizing
-
-
Constructor Summary
Constructors Constructor Description ResizeOp(double scale)
Creates a newResizeOp
with no rendering hints and the same horizontal and vertical scale factor.ResizeOp(double scaleX, double scaleY)
Creates a newResizeOp
with no rendering hints.ResizeOp(double scaleX, double scaleY, RenderingHints hints)
Creates a newResizeOp
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rectangle2D
getBounds2D(BufferedImage src)
Returns the bounding box of the filtered destination image.Point2D
getPoint2D(Point2D srcPt, Point2D dstPt)
Returns the location of the destination point given a point in the source image.boolean
isFast()
void
setFast(boolean fast)
-
Methods inherited from class com.day.image.AbstractBufferedImageOp
createCompatibleDestImage, filter, getRenderingHints
-
-
-
-
Constructor Detail
-
ResizeOp
public ResizeOp(double scaleX, double scaleY, RenderingHints hints)
Creates a newResizeOp
object.- Parameters:
scaleX
- The horizontal scale factorscaleY
- The vertical scale factorhints
- The rendering hints. May benull
.
-
ResizeOp
public ResizeOp(double scaleX, double scaleY)
Creates a newResizeOp
with no rendering hints.- Parameters:
scaleX
- The horizontal scale factorscaleY
- The vertical scale factor
-
ResizeOp
public ResizeOp(double scale)
Creates a newResizeOp
with no rendering hints and the same horizontal and vertical scale factor.- Parameters:
scale
- The scale factor used for both horizontal and vertical scaling.
-
-
Method Detail
-
getBounds2D
public Rectangle2D getBounds2D(BufferedImage src)
Returns the bounding box of the filtered destination image. The IllegalArgumentException may be thrown if the source image is incompatible with the types of images allowed by the class implementing this filter.- Specified by:
getBounds2D
in interfaceBufferedImageOp
- Overrides:
getBounds2D
in classAbstractBufferedImageOp
-
getPoint2D
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
Returns the location of the destination point given a point in the source image. If dstPt is non-null, it will be used to hold the return value.- Specified by:
getPoint2D
in interfaceBufferedImageOp
- Overrides:
getPoint2D
in classAbstractBufferedImageOp
-
isFast
public boolean isFast()
-
setFast
public void setFast(boolean fast)
-
-