Package ca.cgjennings.graphics.filters
Class MarginFilter
- java.lang.Object
-
- ca.cgjennings.graphics.filters.AbstractImageFilter
-
- ca.cgjennings.graphics.filters.MarginFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
public final class MarginFilter extends AbstractImageFilter
This filter adds or removes space around the outside of an image. The pixel values of added space depend on theEdgeHandling
mode.In-place filtering: This class does not support in-place filtering (the source and destination images must be different).
- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Constructor Summary
Constructors Constructor Description MarginFilter()
MarginFilter(int top, int left, int bottom, int right)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
int
getBottomMargin()
EdgeHandling
getEdgeHandling()
Returns the current edge handling mode.int
getLeftMargin()
java.awt.Insets
getMargin()
int
getRightMargin()
int
getTopMargin()
void
setBottomMargin(int bottom)
void
setEdgeHandling(EdgeHandling edgeMode)
Sets the edge handling mode to one of REPEAT, WRAP, or ZERO.void
setLeftMargin(int left)
void
setMargin(java.awt.Insets i)
void
setRightMargin(int right)
void
setTopMargin(int top)
-
Methods inherited from class ca.cgjennings.graphics.filters.AbstractImageFilter
clamp, clamp, clamp, clampBoth, createCompatibleDestImage, fA, fB, fG, fR, getARGB, getARGB, getARGBSynch, getBounds2D, getPoint2D, getRenderingHints, iA, iB, iG, iR, setARGB, setARGB, setARGBSynch
-
-
-
-
Method Detail
-
setMargin
public void setMargin(java.awt.Insets i)
-
getMargin
public java.awt.Insets getMargin()
-
getBottomMargin
public int getBottomMargin()
-
setBottomMargin
public void setBottomMargin(int bottom)
-
getLeftMargin
public int getLeftMargin()
-
setLeftMargin
public void setLeftMargin(int left)
-
getRightMargin
public int getRightMargin()
-
setRightMargin
public void setRightMargin(int right)
-
getTopMargin
public int getTopMargin()
-
setTopMargin
public void setTopMargin(int top)
-
setEdgeHandling
public void setEdgeHandling(EdgeHandling edgeMode)
Sets the edge handling mode to one of REPEAT, WRAP, or ZERO. The edge handling mode is used to create stand-in pixel values for pixels at the edge of the image, where part of the kernel would lie outside of the image.- Parameters:
edgeMode
- the edge handling mode- Throws:
java.lang.NullPointerException
- if the edge handling mode isnull
-
getEdgeHandling
public EdgeHandling getEdgeHandling()
Returns the current edge handling mode.- Returns:
- the edge handling mode
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
-
-