|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.image.ImageFilter
java.awt.image.RGBImageFilter
com.davisor.graphics.FloydSteinbergImageFilter
Reduces colors and dithers image using Octree image reducer. First color reduction is done, after wchich dithering takes place.
| Field Summary | |
protected OctreeColorReducer |
M_octree
The octree |
| Fields inherited from class java.awt.image.RGBImageFilter |
canFilterIndexColorModel, newmodel, origmodel |
| Fields inherited from class java.awt.image.ImageFilter |
consumer |
| Fields inherited from interface java.awt.image.ImageConsumer |
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT |
| Constructor Summary | |
FloydSteinbergImageFilter(java.awt.image.RenderedImage image,
int maxNumOfColors)
This constructor prepares octree color reduction. |
|
| Method Summary | |
protected int |
addRGBErrors(int originalRGB,
int redError,
int greenError,
int blueError)
Helper method for adding to a RGB values color components given individualy. |
protected int |
blueError(int firstRGB,
int secondRGB)
Helper method for defining red error Error is integer between -255 and 255. |
protected void |
ditherImage(java.awt.image.RenderedImage image)
This is the main loop, responsible for dithering the image. |
int |
filterRGB(int x,
int y,
int rgb)
Return filtered RGB value In case of invalid index will return black (0). |
protected int |
findNearestColor(int currentColor)
This method will find the nearest color from the octree color palette as seen usnig squared error. |
int[][] |
getAllRGBValues()
Returns all the RGB values for the whole dithered image |
protected int |
greenError(int firstRGB,
int secondRGB)
Helper method for defining red error Error is integer between -255 and 255. |
protected int[][] |
prepareRGBArray(java.awt.image.RenderedImage image)
This helper method can be used to cnovert RenderedImage to int array containing RGB values of the corresponding pixels. |
protected int |
redError(int firstRGB,
int secondRGB)
Helper method for defining red error Error is integer between -255 and 255. |
| Methods inherited from class java.awt.image.RGBImageFilter |
filterIndexColorModel, filterRGBPixels, setColorModel, setPixels, setPixels, substituteColorModel |
| Methods inherited from class java.awt.image.ImageFilter |
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setDimensions, setHints, setProperties |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected OctreeColorReducer M_octree
| Constructor Detail |
public FloydSteinbergImageFilter(java.awt.image.RenderedImage image,
int maxNumOfColors)
| Method Detail |
public int filterRGB(int x,
int y,
int rgb)
protected int[][] prepareRGBArray(java.awt.image.RenderedImage image)
image - from which RGB values should be extracted
public int[][] getAllRGBValues()
protected void ditherImage(java.awt.image.RenderedImage image)
Error propagation is done using the standard mask:
0 * 7 3 5 1
protected int redError(int firstRGB,
int secondRGB)
protected int greenError(int firstRGB,
int secondRGB)
protected int blueError(int firstRGB,
int secondRGB)
protected int addRGBErrors(int originalRGB,
int redError,
int greenError,
int blueError)
originalRGB - to which rgb components are to be addedredError - between 0 and 255greenError - between 0 and 255blueError - between 0 and 255
protected int findNearestColor(int currentColor)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||