uk.co.silentsoftware.core.converters.image.errordiffusionstrategy
Class AbstractErrorDiffusionDitherStrategy
java.lang.Object
uk.co.silentsoftware.core.converters.image.errordiffusionstrategy.AbstractErrorDiffusionDitherStrategy
- Direct Known Subclasses:
- AtkinsonDitherStrategy, BurkesDitherStrategy, FloydSteinbergDitherStrategy, JarvisJudiceNinkeDitherStrategy, LowErrorAtkinsonDitherStrategy, StuckiDitherStrategy
public abstract class AbstractErrorDiffusionDitherStrategy
- extends java.lang.Object
|
Method Summary |
protected int |
calculateAdjustedRGB(int oldPixel,
int newPixel,
int diffusePixel,
float fraction)
Calculates the error diffusion given by the fraction against
the diffused pixel. |
protected boolean |
isInBounds(java.awt.image.BufferedImage image,
int x,
int y)
Verify the x and y coordinates are with the image's width and height |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractErrorDiffusionDitherStrategy
public AbstractErrorDiffusionDitherStrategy()
calculateAdjustedRGB
protected int calculateAdjustedRGB(int oldPixel,
int newPixel,
int diffusePixel,
float fraction)
- Calculates the error diffusion given by the fraction against
the diffused pixel. The error is taken from the currently
processed pixel whose original colour and new Spectrum colour
values are given in original and new pixel respectively.
A percentage of the error is then applied to the diffusePixel
as per the error distribution around the currently processed pixel.
- Parameters:
oldPixel - newPixel - diffusePixel - fraction -
- Returns:
isInBounds
protected boolean isInBounds(java.awt.image.BufferedImage image,
int x,
int y)
- Verify the x and y coordinates are with the image's width and height
- Parameters:
image - x - y -
- Returns: