public class ConvolveFilter extends AbstractBufferedImageOp
Modifier and Type | Field and Description |
---|---|
protected boolean |
alpha
Whether to convolve alpha.
|
static int |
CLAMP_EDGES
Clamp pixels off the edge to the nearest edge.
|
protected Kernel |
kernel
The convolution kernel.
|
protected boolean |
premultiplyAlpha
Whether to promultiply the alpha before convolving.
|
static int |
WRAP_EDGES
Wrap pixels off the edge to the opposite edge.
|
static int |
ZERO_EDGES
Treat pixels off the edge as zero.
|
filterListener
Constructor and Description |
---|
ConvolveFilter()
Construct a filter with a null kernel.
|
ConvolveFilter(float[] matrix)
Construct a filter with the given 3x3 kernel.
|
ConvolveFilter(int rows,
int cols,
float[] matrix)
Construct a filter with the given kernel.
|
ConvolveFilter(Kernel kernel)
Construct a filter with the given 3x3 kernel.
|
Modifier and Type | Method and Description |
---|---|
static void |
convolve(Kernel kernel,
int[] inPixels,
int[] outPixels,
int width,
int height,
boolean alpha,
int edgeAction)
Convolve a block of pixels.
|
static void |
convolve(Kernel kernel,
int[] inPixels,
int[] outPixels,
int width,
int height,
int edgeAction)
Convolve a block of pixels.
|
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.
|
static void |
convolveHV(Kernel kernel,
int[] inPixels,
int[] outPixels,
int width,
int height,
boolean alpha,
int edgeAction)
Convolve with a 2D kernel.
|
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.
|
BufferedImage |
createCompatibleDestImage(BufferedImage src,
ColorModel dstCM) |
BufferedImage |
filter(BufferedImage src,
BufferedImage dst) |
Rectangle2D |
getBounds2D(BufferedImage src) |
int |
getEdgeAction()
Get the action to perfomr for pixels off the image edges.
|
Kernel |
getKernel()
Get the convolution kernel.
|
Point2D |
getPoint2D(Point2D srcPt,
Point2D dstPt) |
boolean |
getPremultiplyAlpha()
Get whether to premultiply the alpha channel.
|
RenderingHints |
getRenderingHints() |
boolean |
getUseAlpha()
Get whether to convolve the alpha channel.
|
void |
setEdgeAction(int edgeAction)
Set the action to perfomr for pixels off the image edges.
|
void |
setKernel(Kernel kernel)
Set the convolution kernel.
|
void |
setPremultiplyAlpha(boolean premultiplyAlpha)
Set whether to premultiply the alpha channel.
|
void |
setUseAlpha(boolean useAlpha)
Set whether to convolve the alpha channel.
|
String |
toString() |
clone, createCompatibleDestImage, filterDone, filterInitialize, filterProgress, filterStart, getMetaData, getRGB, setFilterListener, setRGB
public static int ZERO_EDGES
public static int CLAMP_EDGES
public static int WRAP_EDGES
protected Kernel kernel
protected boolean alpha
protected boolean premultiplyAlpha
public ConvolveFilter()
public ConvolveFilter(float[] matrix)
matrix
- an array of 9 floats containing the kernelpublic ConvolveFilter(int rows, int cols, float[] matrix)
rows
- the number of rows in the kernelcols
- the number of columns in the kernelmatrix
- an array of rows*cols floats containing the kernelpublic ConvolveFilter(Kernel kernel)
kernel
- the convolution kernelpublic void setKernel(Kernel kernel)
kernel
- the kernelgetKernel()
public Kernel getKernel()
setKernel(java.awt.image.Kernel)
public void setEdgeAction(int edgeAction)
edgeAction
- the actiongetEdgeAction()
public int getEdgeAction()
setEdgeAction(int)
public void setUseAlpha(boolean useAlpha)
useAlpha
- true to convolve the alphagetUseAlpha()
public boolean getUseAlpha()
setUseAlpha(boolean)
public void setPremultiplyAlpha(boolean premultiplyAlpha)
premultiplyAlpha
- true to premultiply the alphagetPremultiplyAlpha()
public boolean getPremultiplyAlpha()
setPremultiplyAlpha(boolean)
public BufferedImage filter(BufferedImage src, BufferedImage dst)
filter
in interface BufferedImageOp
filter
in class AbstractBufferedImageOp
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM)
createCompatibleDestImage
in interface BufferedImageOp
createCompatibleDestImage
in class AbstractBufferedImageOp
public Rectangle2D getBounds2D(BufferedImage src)
getBounds2D
in interface BufferedImageOp
getBounds2D
in class AbstractBufferedImageOp
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
getPoint2D
in interface BufferedImageOp
getPoint2D
in class AbstractBufferedImageOp
public RenderingHints getRenderingHints()
getRenderingHints
in interface BufferedImageOp
getRenderingHints
in class AbstractBufferedImageOp
public static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, int edgeAction)
kernel
- the kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the widthheight
- the heightedgeAction
- what to do at the edgespublic static void convolve(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
kernel
- the kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the widthheight
- the heightalpha
- include alpha channeledgeAction
- what to do at the edgespublic static void convolveHV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
kernel
- the kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the widthheight
- the heightalpha
- include alpha channeledgeAction
- what to do at the edgespublic static void convolveH(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
kernel
- the kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the widthheight
- the heightalpha
- include alpha channeledgeAction
- what to do at the edgespublic static void convolveV(Kernel kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha, int edgeAction)
kernel
- the kernelinPixels
- the input pixelsoutPixels
- the output pixelswidth
- the widthheight
- the heightalpha
- include alpha channeledgeAction
- what to do at the edgesCopyright © 2012-2013 Bambi Software Foundation. All Rights Reserved.