类 ConvolveFilter

    • 字段详细资料

      • ZERO_EDGES

        public static int ZERO_EDGES
        Treat pixels off the edge as zero.
      • CLAMP_EDGES

        public static int CLAMP_EDGES
        Clamp pixels off the edge to the nearest edge.
      • WRAP_EDGES

        public static int WRAP_EDGES
        Wrap pixels off the edge to the opposite edge.
      • kernel

        protected Kernel kernel
        The convolution kernel.
      • alpha

        protected boolean alpha
        Whether to convolve alpha.
      • premultiplyAlpha

        protected boolean premultiplyAlpha
        Whether to promultiply the alpha before convolving.
    • 构造器详细资料

      • ConvolveFilter

        public ConvolveFilter()
        Construct a filter with a null kernel. This is only useful if you're going to change the kernel later on.
      • ConvolveFilter

        public ConvolveFilter​(float[] matrix)
        Construct a filter with the given 3x3 kernel.
        参数:
        matrix - an array of 9 floats containing the kernel
      • ConvolveFilter

        public ConvolveFilter​(int rows,
                              int cols,
                              float[] matrix)
        Construct a filter with the given kernel.
        参数:
        rows - the number of rows in the kernel
        cols - the number of columns in the kernel
        matrix - an array of rows*cols floats containing the kernel
      • ConvolveFilter

        public ConvolveFilter​(Kernel kernel)
        Construct a filter with the given 3x3 kernel.
        参数:
        kernel - the convolution kernel
    • 方法详细资料

      • setKernel

        public void setKernel​(Kernel kernel)
        Set the convolution kernel.
        参数:
        kernel - the kernel
        另请参阅:
        getKernel()
      • setEdgeAction

        public void setEdgeAction​(int edgeAction)
        Set the action to perfomr for pixels off the image edges.
        参数:
        edgeAction - the action
        另请参阅:
        getEdgeAction()
      • getEdgeAction

        public int getEdgeAction()
        Get the action to perfomr for pixels off the image edges.
        返回:
        the action
        另请参阅:
        setEdgeAction(int)
      • setUseAlpha

        public void setUseAlpha​(boolean useAlpha)
        Set whether to convolve the alpha channel.
        参数:
        useAlpha - true to convolve the alpha
        另请参阅:
        getUseAlpha()
      • getUseAlpha

        public boolean getUseAlpha()
        Get whether to convolve the alpha channel.
        返回:
        true to convolve the alpha
        另请参阅:
        setUseAlpha(boolean)
      • setPremultiplyAlpha

        public void setPremultiplyAlpha​(boolean premultiplyAlpha)
        Set whether to premultiply the alpha channel.
        参数:
        premultiplyAlpha - true to premultiply the alpha
        另请参阅:
        getPremultiplyAlpha()
      • getPremultiplyAlpha

        public boolean getPremultiplyAlpha()
        Get whether to premultiply the alpha channel.
        返回:
        true to premultiply the alpha
        另请参阅:
        setPremultiplyAlpha(boolean)
      • convolve

        public static void convolve​(Kernel kernel,
                                    int[] inPixels,
                                    int[] outPixels,
                                    int width,
                                    int height,
                                    int edgeAction)
        Convolve a block of pixels.
        参数:
        kernel - the kernel
        inPixels - the input pixels
        outPixels - the output pixels
        width - the width
        height - the height
        edgeAction - what to do at the edges
      • convolve

        public static void convolve​(Kernel kernel,
                                    int[] inPixels,
                                    int[] outPixels,
                                    int width,
                                    int height,
                                    boolean alpha,
                                    int edgeAction)
        Convolve a block of pixels.
        参数:
        kernel - the kernel
        inPixels - the input pixels
        outPixels - the output pixels
        width - the width
        height - the height
        alpha - include alpha channel
        edgeAction - what to do at the edges
      • convolveHV

        public static void convolveHV​(Kernel kernel,
                                      int[] inPixels,
                                      int[] outPixels,
                                      int width,
                                      int height,
                                      boolean alpha,
                                      int edgeAction)
        Convolve with a 2D kernel.
        参数:
        kernel - the kernel
        inPixels - the input pixels
        outPixels - the output pixels
        width - the width
        height - the height
        alpha - include alpha channel
        edgeAction - what to do at the edges
      • convolveH

        public static void convolveH​(Kernel kernel,
                                     int[] inPixels,
                                     int[] outPixels,
                                     int width,
                                     int height,
                                     boolean alpha,
                                     int edgeAction)
        Convolve with a kernel consisting of one row.
        参数:
        kernel - the kernel
        inPixels - the input pixels
        outPixels - the output pixels
        width - the width
        height - the height
        alpha - include alpha channel
        edgeAction - what to do at the edges
      • convolveV

        public static void convolveV​(Kernel kernel,
                                     int[] inPixels,
                                     int[] outPixels,
                                     int width,
                                     int height,
                                     boolean alpha,
                                     int edgeAction)
        Convolve with a kernel consisting of one column.
        参数:
        kernel - the kernel
        inPixels - the input pixels
        outPixels - the output pixels
        width - the width
        height - the height
        alpha - include alpha channel
        edgeAction - what to do at the edges