Class AbstractBufferedImageOp
- All Implemented Interfaces:
BufferedImageOp
AbstractBufferedImageOp
provides a basic implementation to
implement the BufferedImageOp
interface. Basically this
abstract class deals with all the intricacies of make the images compatible
with operations on each other.
The most easy use of this class is to simply implement an appropriate
constructor and doFilter(BufferedImage, BufferedImage)
method. Other
methods need not be overwritten unless special needs arise. See the method's
documentations for more information.
- Since:
- coati
-
Method Summary
Modifier and TypeMethodDescriptioncreateCompatibleDestImage
(BufferedImage src, ColorModel destCM) Creates a zeroed destination image with the correct size and number of bands.filter
(BufferedImage src, BufferedImage dst) Performs the operation on a BufferedImage.getBounds2D
(BufferedImage src) Returns the bounding box of the filtered destination image.getPoint2D
(Point2D srcPt, Point2D dstPt) Returns the location of the destination point given a point in the source image.final RenderingHints
Returns a copy of the rendering hints for this BufferedImageOp.
-
Method Details
-
filter
Performs the operation on a BufferedImage. This implementation only cares to make the images compatible and calls thedoFilter(BufferedImage, BufferedImage)
to do the actual filtering operation.If the color models for the two images do not match, a color conversion into the destination color model will be performed. If the destination image is null, a BufferedImage with an appropriate ColorModel will be created.
Note: The dest image might be clipped if it is not big enough to take the complete resized image.
Note: Extensions to this class should not need to overwrite this method.
- Specified by:
filter
in interfaceBufferedImageOp
- Parameters:
src
- The src image to be operated upon.dst
- The dest image into which to place the modified image. This may benull
in which case a new image with the correct size will be created.- Returns:
- The newly created image (if dest was
null
) or dest into which the resized src image has been drawn. - Throws:
IllegalArgumentException
- if the dest image is the same as the src image.NullPointerException
- if the src image isnull
.
-
getBounds2D
Returns the bounding box of the filtered destination image. This implementation returns the bounding box of the source image given. This method is likely to be overwritten by extending classes which implement filtering operation resulting in the change of the image size.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
-
createCompatibleDestImage
Creates a zeroed destination image with the correct size and number of bands. This callsgetBounds2D(BufferedImage)
to decide on the size of the new image. So this method needs only be overwritten by extending class, which need more specialized operations than just to create a new image with the correct size and color model.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:
createCompatibleDestImage
in interfaceBufferedImageOp
- Parameters:
src
- Source image for the filter operation.destCM
- ColorModel of the destination. If null, the ColorModel of the source will be used.
-
getPoint2D
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. This method is likely to be overwritten by extending classes which implement filtering operation resulting in the change of the image size or in rotated images.- Specified by:
getPoint2D
in interfaceBufferedImageOp
-
getRenderingHints
Returns a copy of the rendering hints for this BufferedImageOp. Returns null if no hints have been set. Modyfing the object returned does not modify the rendering hints set on this.- Specified by:
getRenderingHints
in interfaceBufferedImageOp
- Returns:
- The rendering hints of this or
null
if none are defined.
-