Package com.day.image

Class ResizeOp

  • All Implemented Interfaces:
    java.awt.image.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 and destination must be different.
    Since:
    coati
    See Also:
    Implementation of Image Resizing
    • Constructor Summary

      Constructors 
      Constructor Description
      ResizeOp​(double scale)
      Creates a new ResizeOp with no rendering hints and the same horizontal and vertical scale factor.
      ResizeOp​(double scaleX, double scaleY)
      Creates a new ResizeOp with no rendering hints.
      ResizeOp​(double scaleX, double scaleY, java.awt.RenderingHints hints)
      Creates a new ResizeOp object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.geom.Rectangle2D getBounds2D​(java.awt.image.BufferedImage src)
      Returns the bounding box of the filtered destination image.
      java.awt.geom.Point2D getPoint2D​(java.awt.geom.Point2D srcPt, java.awt.geom.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 java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResizeOp

        public ResizeOp​(double scaleX,
                        double scaleY,
                        java.awt.RenderingHints hints)
        Creates a new ResizeOp object.
        Parameters:
        scaleX - The horizontal scale factor
        scaleY - The vertical scale factor
        hints - The rendering hints. May be null.
      • ResizeOp

        public ResizeOp​(double scaleX,
                        double scaleY)
        Creates a new ResizeOp with no rendering hints.
        Parameters:
        scaleX - The horizontal scale factor
        scaleY - The vertical scale factor
      • ResizeOp

        public ResizeOp​(double scale)
        Creates a new ResizeOp 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 java.awt.geom.Rectangle2D getBounds2D​(java.awt.image.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 interface java.awt.image.BufferedImageOp
        Overrides:
        getBounds2D in class AbstractBufferedImageOp
      • getPoint2D

        public java.awt.geom.Point2D getPoint2D​(java.awt.geom.Point2D srcPt,
                                                java.awt.geom.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 interface java.awt.image.BufferedImageOp
        Overrides:
        getPoint2D in class AbstractBufferedImageOp
      • isFast

        public boolean isFast()
      • setFast

        public void setFast​(boolean fast)