Package ca.cgjennings.graphics.filters
Class AbstractRowwiseFilter
- java.lang.Object
-
- ca.cgjennings.graphics.filters.AbstractImageFilter
-
- ca.cgjennings.graphics.filters.AbstractRowwiseFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
- Direct Known Subclasses:
CheckeredScreenFilter
,StencilFilter
public abstract class AbstractRowwiseFilter extends AbstractImageFilter
An abstract superclass for filters that work on a row-by-row basis. It is similar toAbstractPixelwiseFilter
but it guarantees that an entire row is filtered at a time and it provides the current y-index.
-
-
Constructor Summary
Constructors Constructor Description AbstractRowwiseFilter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
abstract void
filterPixels(int y, int[] argb)
This method is called with a block of ARGB values to be filtered.protected float
workFactor()
Returns a factor representing the amount of work performed by this filter relative to a filter that simply copies the source image by reading and writing each pixel.-
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
-
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
-
filterPixels
public abstract void filterPixels(int y, int[] argb)
This method is called with a block of ARGB values to be filtered. Subclasses should override this method to implement the actual filtering algorithm, replacing each pixel in the supplied array with its filtered value.
-
workFactor
protected float workFactor()
Returns a factor representing the amount of work performed by this filter relative to a filter that simply copies the source image by reading and writing each pixel. For example, a filter that implemented a 3x3 convolution might return the value 9. The work factor value helps determine when an image should be processed in parallel. (There is significant overhead involved in running a filter in parallel, so it is only worth doing if the image is relatively large or the amount of processing per pixel is relatively high.)Note: The work factor may vary depending on the current filter settings.
- Returns:
- the approximate amount of work per pixel, relative to simply copying the pixel values
-
-