Class ImageFunction2D

  • All Implemented Interfaces:
    Function2D

    public class ImageFunction2D
    extends java.lang.Object
    implements Function2D
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean alpha  
      static int CLAMP  
      protected int edgeAction  
      protected int height  
      protected int[] pixels  
      protected int width  
      static int WRAP  
      static int ZERO  
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageFunction2D​(int[] pixels, int width, int height, int edgeAction, boolean alpha)  
      ImageFunction2D​(java.awt.Image image)  
      ImageFunction2D​(java.awt.image.BufferedImage image)  
      ImageFunction2D​(java.awt.image.BufferedImage image, boolean alpha)  
      ImageFunction2D​(java.awt.image.BufferedImage image, int edgeAction, boolean alpha)  
      ImageFunction2D​(java.awt.Image image, int edgeAction, boolean alpha)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float evaluate​(float x, float y)  
      int getEdgeAction()  
      int getHeight()  
      int[] getPixels()  
      int[] getRGB​(java.awt.image.BufferedImage image, int x, int y, int width, int height, int[] pixels)
      A convenience method for getting ARGB pixels from an image.
      int getWidth()  
      void init​(int[] pixels, int width, int height, int edgeAction, boolean alpha)  
      void setEdgeAction​(int edgeAction)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pixels

        protected int[] pixels
      • width

        protected int width
      • height

        protected int height
      • edgeAction

        protected int edgeAction
      • alpha

        protected boolean alpha
    • Constructor Detail

      • ImageFunction2D

        public ImageFunction2D​(java.awt.image.BufferedImage image)
      • ImageFunction2D

        public ImageFunction2D​(java.awt.image.BufferedImage image,
                               boolean alpha)
      • ImageFunction2D

        public ImageFunction2D​(java.awt.image.BufferedImage image,
                               int edgeAction,
                               boolean alpha)
      • ImageFunction2D

        public ImageFunction2D​(int[] pixels,
                               int width,
                               int height,
                               int edgeAction,
                               boolean alpha)
      • ImageFunction2D

        public ImageFunction2D​(java.awt.Image image)
      • ImageFunction2D

        public ImageFunction2D​(java.awt.Image image,
                               int edgeAction,
                               boolean alpha)
    • Method Detail

      • getRGB

        public int[] getRGB​(java.awt.image.BufferedImage image,
                            int x,
                            int y,
                            int width,
                            int height,
                            int[] pixels)
        A convenience method for getting ARGB pixels from an image. This tries to avoid the performance penalty of BufferedImage.getRGB unmanaging the image.
        Parameters:
        image - a BufferedImage object
        x - the left edge of the pixel block
        y - the right edge of the pixel block
        width - the width of the pixel arry
        height - the height of the pixel arry
        pixels - the array to hold the returned pixels. May be null.
        Returns:
        the pixels
        See Also:
        #setRGB
      • init

        public void init​(int[] pixels,
                         int width,
                         int height,
                         int edgeAction,
                         boolean alpha)
      • evaluate

        public float evaluate​(float x,
                              float y)
        Specified by:
        evaluate in interface Function2D
      • setEdgeAction

        public void setEdgeAction​(int edgeAction)
      • getEdgeAction

        public int getEdgeAction()
      • getWidth

        public int getWidth()
      • getHeight

        public int getHeight()
      • getPixels

        public int[] getPixels()