|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.image.ImageFilter
org.jscience.media.pictures.filters.WholeImageFilter
org.jscience.media.pictures.filters.QuantizeFilter
public class QuantizeFilter
A filter which quantizes an image to a set number of colors - useful for producing images which are to be encoded using an index color model. The filter can perform Floyd-Steinberg error-diffusion dithering if required. At present, the quantization is done using an octtree algorithm but I eventually hope to add more quantization methods such as median cut. Note: at present, the filter produces an image which uses the RGB color model (because the application it was written for required it). I hope to extend it to produce an IndexColorModel by request.
| Field Summary | |
|---|---|
protected static int[] |
matrix
Floyd-Steinberg ditherin gmatrix. |
| Fields inherited from class org.jscience.media.pictures.filters.WholeImageFilter |
|---|
canFilterIndexColorModel, defaultRGBModel, inBytePixels, inPixels, originalSpace, transformedSpace |
| 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 | |
|---|---|
QuantizeFilter()
|
|
| Method Summary | |
|---|---|
boolean |
getDither()
Return the dithering setting |
int |
getNumColors()
Get the number of colors to quantize to. |
boolean |
getSerpentine()
Return the serpentine setting |
void |
imageComplete(int status)
DOCUMENT ME! |
void |
quantize(int[] inPixels,
int[] outPixels,
int width,
int height,
int numColors,
boolean dither,
boolean serpentine)
DOCUMENT ME! |
void |
setDither(boolean dither)
Set whether to use dithering or not. |
void |
setNumColors(int numColors)
Set the number of colors to quantize to. |
void |
setSerpentine(boolean serpentine)
Set whether to use a serpentine pattern for return or not. |
java.lang.String |
toString()
DOCUMENT ME! |
| Methods inherited from class org.jscience.media.pictures.filters.WholeImageFilter |
|---|
setColorModel, setDimensions, setPixels, setPixels, transformSpace |
| Methods inherited from class java.awt.image.ImageFilter |
|---|
clone, getFilterInstance, resendTopDownLeftRight, setHints, setProperties |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int[] matrix
| Constructor Detail |
|---|
public QuantizeFilter()
| Method Detail |
|---|
public void setNumColors(int numColors)
numColors - the number of colors. The default is 256.public int getNumColors()
public void setDither(boolean dither)
dither - true to use ditheringpublic boolean getDither()
public void setSerpentine(boolean serpentine)
serpentine - true to use serpentine patternpublic boolean getSerpentine()
public void quantize(int[] inPixels,
int[] outPixels,
int width,
int height,
int numColors,
boolean dither,
boolean serpentine)
inPixels - DOCUMENT ME!outPixels - DOCUMENT ME!width - DOCUMENT ME!height - DOCUMENT ME!numColors - DOCUMENT ME!dither - DOCUMENT ME!serpentine - DOCUMENT ME!public void imageComplete(int status)
imageComplete in interface java.awt.image.ImageConsumerimageComplete in class java.awt.image.ImageFilterstatus - DOCUMENT ME!public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||