类 QuantizeFilter
- java.lang.Object
-
- org.meteoinfo.image.filter.AbstractBufferedImageOp
-
- org.meteoinfo.image.filter.WholeImageFilter
-
- org.meteoinfo.image.filter.QuantizeFilter
-
- 所有已实现的接口:
BufferedImageOp,Cloneable
public class QuantizeFilter extends WholeImageFilter
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.
-
-
字段概要
字段 修饰符和类型 字段 说明 protected static int[]matrixFloyd-Steinberg dithering matrix.-
从类继承的字段 org.meteoinfo.image.filter.WholeImageFilter
originalSpace, transformedSpace
-
-
构造器概要
构造器 构造器 说明 QuantizeFilter()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected int[]filterPixels(int width, int height, int[] inPixels, Rectangle transformedSpace)Actually filter the pixels.booleangetDither()Return the dithering settingintgetNumColors()Get the number of colors to quantize to.booleangetSerpentine()Return the serpentine settingvoidquantize(int[] inPixels, int[] outPixels, int width, int height, int numColors, boolean dither, boolean serpentine)voidsetDither(boolean dither)Set whether to use dithering or not.voidsetNumColors(int numColors)Set the number of colors to quantize to.voidsetSerpentine(boolean serpentine)Set whether to use a serpentine pattern for return or not.StringtoString()-
从类继承的方法 org.meteoinfo.image.filter.WholeImageFilter
filter, transformSpace
-
从类继承的方法 org.meteoinfo.image.filter.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB
-
-
-
-
方法详细资料
-
setNumColors
public void setNumColors(int numColors)
Set the number of colors to quantize to.- 参数:
numColors- the number of colors. The default is 256.
-
getNumColors
public int getNumColors()
Get the number of colors to quantize to.- 返回:
- the number of colors.
-
setDither
public void setDither(boolean dither)
Set whether to use dithering or not. If not, the image is posterized.- 参数:
dither- true to use dithering
-
getDither
public boolean getDither()
Return the dithering setting- 返回:
- the current setting
-
setSerpentine
public void setSerpentine(boolean serpentine)
Set whether to use a serpentine pattern for return or not. This can reduce 'avalanche' artifacts in the output.- 参数:
serpentine- true to use serpentine pattern
-
getSerpentine
public boolean getSerpentine()
Return the serpentine setting- 返回:
- the current setting
-
quantize
public void quantize(int[] inPixels, int[] outPixels, int width, int height, int numColors, boolean dither, boolean serpentine)
-
filterPixels
protected int[] filterPixels(int width, int height, int[] inPixels, Rectangle transformedSpace)从类复制的说明:WholeImageFilterActually filter the pixels.- 指定者:
filterPixels在类中WholeImageFilter- 参数:
width- the image widthheight- the image heightinPixels- the image pixelstransformedSpace- the output bounds- 返回:
- the output pixels
-
-