com.alibaba.simpleimage.util
类 PaletteBuilder

java.lang.Object
  继承者 com.alibaba.simpleimage.util.PaletteBuilder

public class PaletteBuilder
extends Object

Oracle的实现有bug,而且性能有待改进,所以在Oracle的基础上实现自己的版本

作者:
wendell 2011-8-18 下午02:37:44

方法摘要
static boolean canCreatePalette(ImageTypeSpecifier type)
          Returns true if PaletteBuilder is able to create palette for given image type.
static boolean canCreatePalette(RenderedImage image)
          Returns true if PaletteBuilder is able to create palette for given rendered image.
static IndexColorModel createIndexColorModel(RenderedImage img)
          Creates an palette representing colors from given image img.
static RenderedImage createIndexedImage(RenderedImage src)
          Creates an image representing given image src using IndexColorModel.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

方法详细信息

createIndexedImage

public static RenderedImage createIndexedImage(RenderedImage src)
Creates an image representing given image src using IndexColorModel. Lossless conversion is not always possible (e.g. if number of colors in the given image exceeds maximum palette size). Result image then is an approximation constructed by octree quantization method.

抛出:
IllegalArgumentException - if src is null.
UnsupportedOperationException - if implemented method is unable to create approximation of src and canCreatePalette returns false.
另请参见:
createIndexColorModel, canCreatePalette

createIndexColorModel

public static IndexColorModel createIndexColorModel(RenderedImage img)
Creates an palette representing colors from given image img. If number of colors in the given image exceeds maximum palette size closest colors would be merged.

抛出:
IllegalArgumentException - if img is null.
UnsupportedOperationException - if implemented method is unable to create approximation of img and canCreatePalette returns false.
另请参见:
createIndexedImage, canCreatePalette

canCreatePalette

public static boolean canCreatePalette(ImageTypeSpecifier type)
Returns true if PaletteBuilder is able to create palette for given image type.

参数:
type - an instance of ImageTypeSpecifier to be indexed.
返回:
true if the PaletteBuilder is likely to be able to create palette for this image type.
抛出:
IllegalArgumentException - if type is null.

canCreatePalette

public static boolean canCreatePalette(RenderedImage image)
Returns true if PaletteBuilder is able to create palette for given rendered image.

参数:
image - an instance of RenderedImage to be indexed.
返回:
true if the PaletteBuilder is likely to be able to create palette for this image type.
抛出:
IllegalArgumentException - if image is null.


Copyright © 2012–2015 Alibaba Group. All rights reserved.