类 PerspectiveFilter

  • 所有已实现的接口:
    BufferedImageOp, Cloneable

    public class PerspectiveFilter
    extends TransformFilter
    A filter which performs a perspective distortion on an image. Coordinates are treated as if the image was a unit square, i.e. the bottom-right corner of the image is at (1, 1). The filter maps the unit square onto an arbitrary convex quadrilateral or vice versa.
    • 构造器详细资料

      • PerspectiveFilter

        public PerspectiveFilter()
        Construct a PerspectiveFilter.
      • PerspectiveFilter

        public PerspectiveFilter​(float x0,
                                 float y0,
                                 float x1,
                                 float y1,
                                 float x2,
                                 float y2,
                                 float x3,
                                 float y3)
        Construct a PerspectiveFilter.
        参数:
        x0 - the new position of the top left corner
        y0 - the new position of the top left corner
        x1 - the new position of the top right corner
        y1 - the new position of the top right corner
        x2 - the new position of the bottom right corner
        y2 - the new position of the bottom right corner
        x3 - the new position of the bottom left corner
        y3 - the new position of the bottom left corner
    • 方法详细资料

      • setClip

        public void setClip​(boolean clip)
      • getClip

        public boolean getClip()
      • setCorners

        public void setCorners​(float x0,
                               float y0,
                               float x1,
                               float y1,
                               float x2,
                               float y2,
                               float x3,
                               float y3)
        Set the new positions of the image corners. This is the same as unitSquareToQuad, but the coordinates are in image pixels, not relative to the unit square. This method is provided as a convenience.
        参数:
        x0 - the new position of the top left corner
        y0 - the new position of the top left corner
        x1 - the new position of the top right corner
        y1 - the new position of the top right corner
        x2 - the new position of the bottom right corner
        y2 - the new position of the bottom right corner
        x3 - the new position of the bottom left corner
        y3 - the new position of the bottom left corner
      • unitSquareToQuad

        public void unitSquareToQuad​(float x0,
                                     float y0,
                                     float x1,
                                     float y1,
                                     float x2,
                                     float y2,
                                     float x3,
                                     float y3)
        Set the transform to map the unit square onto a quadrilateral. When filtering, all coordinates will be scaled by the size of the image.
        参数:
        x0 - the new position of the top left corner
        y0 - the new position of the top left corner
        x1 - the new position of the top right corner
        y1 - the new position of the top right corner
        x2 - the new position of the bottom right corner
        y2 - the new position of the bottom right corner
        x3 - the new position of the bottom left corner
        y3 - the new position of the bottom left corner
      • quadToUnitSquare

        public void quadToUnitSquare​(float x0,
                                     float y0,
                                     float x1,
                                     float y1,
                                     float x2,
                                     float y2,
                                     float x3,
                                     float y3)
        Set the transform to map a quadrilateral onto the unit square. When filtering, all coordinates will be scaled by the size of the image.
        参数:
        x0 - the old position of the top left corner
        y0 - the old position of the top left corner
        x1 - the old position of the top right corner
        y1 - the old position of the top right corner
        x2 - the old position of the bottom right corner
        y2 - the old position of the bottom right corner
        x3 - the old position of the bottom left corner
        y3 - the old position of the bottom left corner
      • transformSpace

        protected void transformSpace​(Rectangle rect)
        从类复制的说明: TransformFilter
        Forward transform a rectangle. Used to determine the size of the output image.
        覆盖:
        transformSpace 在类中 TransformFilter
        参数:
        rect - the rectangle to transform
      • getOriginX

        public float getOriginX()
        Get the origin of the output image. Use this for working out where to draw your new image.
        返回:
        the X origin.
      • getOriginY

        public float getOriginY()
        Get the origin of the output image. Use this for working out where to draw your new image.
        返回:
        the Y origin.
      • transformInverse

        protected void transformInverse​(int x,
                                        int y,
                                        float[] out)
        从类复制的说明: TransformFilter
        Inverse transform a point. This method needs to be overriden by all subclasses.
        指定者:
        transformInverse 在类中 TransformFilter
        参数:
        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