Class TwirlFilter

  • All Implemented Interfaces:
    java.awt.image.BufferedImageOp, java.lang.Cloneable

    public class TwirlFilter
    extends TransformFilter
    A Filter which distorts an image by twisting it from the centre out. The twisting is centred at the centre of the image and extends out to the smallest of the width and height. Pixels outside this radius are unaffected.
    • Constructor Detail

      • TwirlFilter

        public TwirlFilter()
        Construct a TwirlFilter with no distortion.
    • Method Detail

      • setAngle

        public void setAngle​(float angle)
        Set the angle of twirl in radians. 0 means no distortion.
        Parameters:
        angle - the angle of twirl. This is the angle by which pixels at the nearest edge of the image will move.
        See Also:
        getAngle()
      • getAngle

        public float getAngle()
        Get the angle of twist.
        Returns:
        the angle in radians.
        See Also:
        setAngle(float)
      • setCentreX

        public void setCentreX​(float centreX)
        Set the centre of the effect in the X direction as a proportion of the image size.
        Parameters:
        centreX - the center
        See Also:
        getCentreX()
      • getCentreX

        public float getCentreX()
        Get the centre of the effect in the X direction as a proportion of the image size.
        Returns:
        the center
        See Also:
        setCentreX(float)
      • setCentreY

        public void setCentreY​(float centreY)
        Set the centre of the effect in the Y direction as a proportion of the image size.
        Parameters:
        centreY - the center
        See Also:
        getCentreY()
      • getCentreY

        public float getCentreY()
        Get the centre of the effect in the Y direction as a proportion of the image size.
        Returns:
        the center
        See Also:
        setCentreY(float)
      • setCentre

        public void setCentre​(java.awt.geom.Point2D centre)
        Set the centre of the effect as a proportion of the image size.
        Parameters:
        centre - the center
        See Also:
        getCentre()
      • getCentre

        public java.awt.geom.Point2D getCentre()
        Get the centre of the effect as a proportion of the image size.
        Returns:
        the center
        See Also:
        setCentre(java.awt.geom.Point2D)
      • setRadius

        public void setRadius​(float radius)
        Set the radius of the effect.
        Parameters:
        radius - the radius. Minimum value: 0
        See Also:
        getRadius()
      • getRadius

        public float getRadius()
        Get the radius of the effect.
        Returns:
        the radius
        See Also:
        setRadius(float)
      • filter

        public java.awt.image.BufferedImage filter​(java.awt.image.BufferedImage src,
                                                   java.awt.image.BufferedImage dst)
        Specified by:
        filter in interface java.awt.image.BufferedImageOp
        Overrides:
        filter in class TransformFilter
      • transformInverse

        protected void transformInverse​(int x,
                                        int y,
                                        float[] out)
        Description copied from class: TransformFilter
        Inverse transform a point. This method needs to be overriden by all subclasses.
        Specified by:
        transformInverse in class TransformFilter
        Parameters:
        x - the X position of the pixel in the output image
        y - the Y position of the pixel in the output image
        out - the position of the pixel in the input image
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object