| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.imageio.ImageTypeSpecifier
public class ImageTypeSpecifier
允许以便捷方式指定图像格式(尤其是其 SampleModel 和 ColorModel)的类。
| 字段摘要 | |
|---|---|
| protected  ColorModel | colorModel将用作原型的 ColorModel。 | 
| protected  SampleModel | sampleModel将用作原型的 SampleModel。 | 
| 构造方法摘要 | |
|---|---|
| ImageTypeSpecifier(ColorModel colorModel,
                   SampleModel sampleModel)直接根据 ColorModel和SampleModel构造一个ImageTypeSpecifier。 | |
| ImageTypeSpecifier(RenderedImage image)根据 RenderedImage构造一个ImageTypeSpecifier。 | |
| 方法摘要 | |
|---|---|
| static ImageTypeSpecifier | createBanded(ColorSpace colorSpace,
             int[] bankIndices,
             int[] bandOffsets,
             int dataType,
             boolean hasAlpha,
             boolean isAlphaPremultiplied)返回带状图像格式的说明符,它将使用 ComponentColorModel和BandedSampleModel来存储单独数组中的每个通道。 | 
|  BufferedImage | createBufferedImage(int width,
                    int height)根据此对象中包含的规范创建一个具有给定宽度和高度的 BufferedImage。 | 
| static ImageTypeSpecifier | createFromBufferedImageType(int bufferedImageType)返回一个 ImageTypeSpecifier,它将对某一标准BufferedImage类型(而不是TYPE_CUSTOM)进行编码。 | 
| static ImageTypeSpecifier | createFromRenderedImage(RenderedImage image)返回一个 ImageTypeSpecifier,它将对RenderedImage(可能是BufferedImage)的布局进行编码。 | 
| static ImageTypeSpecifier | createGrayscale(int bits,
                int dataType,
                boolean isSigned)返回灰度级图像格式的说明符,它会将给定位深 (bit depth) 的像素压缩成指定数据类型的数组元素。 | 
| static ImageTypeSpecifier | createGrayscale(int bits,
                int dataType,
                boolean isSigned,
                boolean isAlphaPremultiplied)返回灰度级图像格式和 alpha 图像格式的说明符,它会将给定位深的像素压缩成指定数据类型的数组元素。 | 
| static ImageTypeSpecifier | createIndexed(byte[] redLUT,
              byte[] greenLUT,
              byte[] blueLUT,
              byte[] alphaLUT,
              int bits,
              int dataType)返回索引颜色图像格式的说明符,它将给定位深的索引值压缩成指定数据类型的数组元素。 | 
| static ImageTypeSpecifier | createInterleaved(ColorSpace colorSpace,
                  int[] bandOffsets,
                  int dataType,
                  boolean hasAlpha,
                  boolean isAlphaPremultiplied)返回交错图像格式的说明符,它将使用 ComponentColorModel和PixelInterleavedSampleModel来存储单个 byte、short 或 int 值形式的每个像素组件。 | 
| static ImageTypeSpecifier | createPacked(ColorSpace colorSpace,
             int redMask,
             int greenMask,
             int blueMask,
             int alphaMask,
             int transferType,
             boolean isAlphaPremultiplied)返回压缩图像格式的说明符,它将使用 DirectColorModel和一个压缩的SampleModel来存储压缩成单个 byte、short 或 int 值的像素。 | 
|  boolean | equals(Object o)如果给定 Object是一个ImageTypeSpecifier并且具有与此对象相同的SampleModel和ColorModel,则返回true。 | 
|  int | getBitsPerBand(int band)返回用来表示给定 band 样本的位数。 | 
|  int | getBufferedImageType()返回一个 int 值,它包含某一来自 BufferedImage的描述图像的枚举常量值。 | 
|  ColorModel | getColorModel()返回此对象指定的 ColorModel。 | 
|  int | getNumBands()返回此对象指定的 band 数。 | 
|  int | getNumComponents()返回此对象指定的颜色组件的数量。 | 
|  SampleModel | getSampleModel()根据此对象中封装的设置返回一个 SampleModel。 | 
|  SampleModel | getSampleModel(int width,
               int height)根据此对象中封装的设置值返回一个 SampleModel。 | 
|  int | hashCode()返回此 ImageTypeSpecifier 的哈希码。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait | 
| 字段详细信息 | 
|---|
protected ColorModel colorModel
ColorModel。
protected SampleModel sampleModel
SampleModel。
| 构造方法详细信息 | 
|---|
public ImageTypeSpecifier(ColorModel colorModel,
                          SampleModel sampleModel)
ColorModel 和 SampleModel 构造一个 ImageTypeSpecifier。由调用者负责提供兼容的参数。
colorModel - 一个 ColorModel。sampleModel - 一个 SampleModel。
IllegalArgumentException - 如果任意一个参数为 null。
IllegalArgumentException - 如果 sampleModel 与 colorModel 不兼容。public ImageTypeSpecifier(RenderedImage image)
RenderedImage 构造一个 ImageTypeSpecifier。如果使用的是 BufferedImage,为了获得更精确的结果,应该使用 createFromRenderedImage 或 createFromBufferedImageType 这两个工厂方法之一。
image - 一个 RenderedImage。
IllegalArgumentException - 如果该参数为 null。| 方法详细信息 | 
|---|
public static ImageTypeSpecifier createPacked(ColorSpace colorSpace,
                                              int redMask,
                                              int greenMask,
                                              int blueMask,
                                              int alphaMask,
                                              int transferType,
                                              boolean isAlphaPremultiplied)
DirectColorModel 和一个压缩的 SampleModel 来存储压缩成单个 byte、short 或 int 值的像素。
colorSpace - 所需的 ColorSpace。redMask - 指示红色通道位置的邻接掩码。greenMask - 指示绿色通道位置的邻接掩码。blueMask - 指示蓝色通道位置的邻接掩码。alphaMask - 指示 alpha 通道位置的邻接掩码。transferType - 所需的 SampleModel 传输类型。isAlphaPremultiplied - 如果颜色通道将预乘以 alpha 通道,则该参数为 true。
ImageTypeSpecifier。
IllegalArgumentException - 如果 colorSpace 为 null。
IllegalArgumentException - 如果 colorSpace 的类型不是 TYPE_RGB。
IllegalArgumentException - 如果没有掩码至少有一个位集。
IllegalArgumentException - 如果 transferType 不是 DataBuffer.TYPE_BYTE、DataBuffer.TYPE_USHORT 或 DataBuffer.TYPE_INT 之一。
public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
                                                   int[] bandOffsets,
                                                   int dataType,
                                                   boolean hasAlpha,
                                                   boolean isAlphaPremultiplied)
ComponentColorModel 和 PixelInterleavedSampleModel 来存储单个 byte、short 或 int 值形式的每个像素组件。
colorSpace - 所需的 ColorSpace。bandOffsets - 指示每个 band 的偏移量的 int 数组。dataType - 所需的数据类型,它是 DataBuffer 类中的枚举之一。hasAlpha - 如果需要 alpha 通道,则该参数为 true。isAlphaPremultiplied - 如果颜色通道将预乘以 alpha 通道,则该参数为 true。
ImageTypeSpecifier。
IllegalArgumentException - 如果 colorSpace 为 null。
IllegalArgumentException - 如果 bandOffsets 为 null。
IllegalArgumentException - 如果 dataType 不是合法的 DataBuffer.TYPE_* 常量之一。
IllegalArgumentException - 如果 bandOffsets.length 不等于颜色空间组件的数量;如果 hasAlpha 为 true 时,该长度不等于组件数量加 1。
public static ImageTypeSpecifier createBanded(ColorSpace colorSpace,
                                              int[] bankIndices,
                                              int[] bandOffsets,
                                              int dataType,
                                              boolean hasAlpha,
                                              boolean isAlphaPremultiplied)
ComponentColorModel 和 BandedSampleModel 来存储单独数组中的每个通道。
colorSpace - 所需的 ColorSpace。bankIndices - 一个 int 数组,指示用来存储每个 band 的库。bandOffsets - 一个 int 数组,指示其库中每个 band 的起始偏移量。dataType - 所需的数据类型,它是 DataBuffer 类中的枚举之一。hasAlpha - 如果需要 alpha 通道,则该参数为 true。isAlphaPremultiplied - 如果颜色通道将预乘以 alpha 通道,则该参数为 true。
ImageTypeSpecifier。
IllegalArgumentException - 如果 colorSpace 为 null。
IllegalArgumentException - 如果 bankIndices 为 null。
IllegalArgumentException - 如果 bandOffsets 为 null。
IllegalArgumentException - 如果 bankIndices 和 bandOffsets 的长度不同。
IllegalArgumentException - 如果 bandOffsets.length 不等于颜色空间组件的数量;如果 hasAlpha 为 true 时,该长度不等于组件数量加 1。
IllegalArgumentException - 如果 dataType 不是合法的 DataBuffer.TYPE_* 常量之一。
public static ImageTypeSpecifier createGrayscale(int bits,
                                                 int dataType,
                                                 boolean isSigned)
bits - 每个灰度值的位数(1、2、4、8 或 16)。dataType - 所需的数据类型,它是 DataBuffer 类中的枚举之一。isSigned - 如果要表示负值,则该参数为 true。
ImageTypeSpecifier。
IllegalArgumentException - 如果 bits 不是 1、2、4、8 或 16 之一。
IllegalArgumentException - 如果 dataType 不是 DataBuffer.TYPE_BYTE、DataBuffer.TYPE_SHORT 或 DataBuffer.TYPE_USHORT 之一。
IllegalArgumentException - 如果 bits 大于给定 dataType 的位大小。
public static ImageTypeSpecifier createGrayscale(int bits,
                                                 int dataType,
                                                 boolean isSigned,
                                                 boolean isAlphaPremultiplied)
bits - 每个灰度值的位数(1、2、4、8 或 16)。dataType - 所需的数据类型,它是 DataBuffer 类中的枚举之一。isSigned - 如果要表示负值,则该参数为 true。isAlphaPremultiplied - 如果亮度通道将乘以 alpha 通道,则该参数为 true。
ImageTypeSpecifier。
IllegalArgumentException - 如果 bits 不是 1、2、4、8 或 16 之一。
IllegalArgumentException - 如果 dataType 不是 DataBuffer.TYPE_BYTE、DataBuffer.TYPE_SHORT 或 DataBuffer.TYPE_USHORT 之一。
IllegalArgumentException - 如果 bits 大于给定 dataType 的位大小。
public static ImageTypeSpecifier createIndexed(byte[] redLUT,
                                               byte[] greenLUT,
                                               byte[] blueLUT,
                                               byte[] alphaLUT,
                                               int bits,
                                               int dataType)
redLUT - 一个 byte 数组,包含每个索引的 red 值。greenLUT - 一个 byte 数组,包含每个索引的 green 值。blueLUT - 一个 byte 数组,包含每个索引的 blue 值。alphaLUT - 一个 byte 数组,包含每个索引的 alpha 值;或者为 null,表示创建一个完全不透明的 LUT。bits - 每个索引中的位数。dataType - 所需的输出类型,它是 DataBuffer 类中的枚举之一。
ImageTypeSpecifier。
IllegalArgumentException - 如果 redLUT 为 null。
IllegalArgumentException - 如果 greenLUT 为 null。
IllegalArgumentException - 如果 blueLUT 为 null。
IllegalArgumentException - 如果 bits 不是 1、2、4、8 或 16 之一。
IllegalArgumentException - 如果非 null LUT 参数的长度不能正好满足 1 << bits。
IllegalArgumentException - 如果 dataType 不是 DataBuffer.TYPE_BYTE、DataBuffer.TYPE_SHORT、DataBuffer.TYPE_USHORT 或 DataBuffer.TYPE_INT 之一。
IllegalArgumentException - 如果 bits 大于给定 dataType 的位大小。public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType)
ImageTypeSpecifier,它将对某一标准 BufferedImage 类型(而不是 TYPE_CUSTOM)进行编码。
bufferedImageType - 表示某一标准 BufferedImage 类型的 int 值。
ImageTypeSpecifier。
IllegalArgumentException - 如果 bufferedImageType 不是标准类型之一,或者它等于 TYPE_CUSTOM。BufferedImage, 
BufferedImage.TYPE_INT_RGB, 
BufferedImage.TYPE_INT_ARGB, 
BufferedImage.TYPE_INT_ARGB_PRE, 
BufferedImage.TYPE_INT_BGR, 
BufferedImage.TYPE_3BYTE_BGR, 
BufferedImage.TYPE_4BYTE_ABGR, 
BufferedImage.TYPE_4BYTE_ABGR_PRE, 
BufferedImage.TYPE_USHORT_565_RGB, 
BufferedImage.TYPE_USHORT_555_RGB, 
BufferedImage.TYPE_BYTE_GRAY, 
BufferedImage.TYPE_USHORT_GRAY, 
BufferedImage.TYPE_BYTE_BINARY, 
BufferedImage.TYPE_BYTE_INDEXEDpublic static ImageTypeSpecifier createFromRenderedImage(RenderedImage image)
ImageTypeSpecifier,它将对 RenderedImage(可能是 BufferedImage)的布局进行编码。
image - 一个 RenderedImage。
ImageTypeSpecifier。
IllegalArgumentException - 如果 image 为 null。public int getBufferedImageType()
BufferedImage 的描述图像的枚举常量值。
BufferedImage 类型的 int。BufferedImage, 
BufferedImage.TYPE_CUSTOM, 
BufferedImage.TYPE_INT_RGB, 
BufferedImage.TYPE_INT_ARGB, 
BufferedImage.TYPE_INT_ARGB_PRE, 
BufferedImage.TYPE_INT_BGR, 
BufferedImage.TYPE_3BYTE_BGR, 
BufferedImage.TYPE_4BYTE_ABGR, 
BufferedImage.TYPE_4BYTE_ABGR_PRE, 
BufferedImage.TYPE_USHORT_565_RGB, 
BufferedImage.TYPE_USHORT_555_RGB, 
BufferedImage.TYPE_BYTE_GRAY, 
BufferedImage.TYPE_USHORT_GRAY, 
BufferedImage.TYPE_BYTE_BINARY, 
BufferedImage.TYPE_BYTE_INDEXEDpublic int getNumComponents()
ColorModel.getNumComponents 返回的值。
public int getNumBands()
SampleModel.getNumBands 返回的值。
public int getBitsPerBand(int band)
band - 将被查询的 band 的索引(int 值形式)。
IllegalArgumentException - 如果 band 为负或大于最大 band 索引。public SampleModel getSampleModel()
SampleModel。SampleModel 的宽度和高度将被设置为任意值。
SampleModel。
public SampleModel getSampleModel(int width,
                                  int height)
SampleModel。SampleModel 的宽度和高度将被设置为所提供的值。
width - 返回的 SampleModel 的所需宽度。height - 返回的 SampleModel 的所需高度。
SampleModel。
IllegalArgumentException - 如果 width 或 height 为负数或零。
IllegalArgumentException - 如果 width 和 height 的值大于 Integer.MAX_VALUEpublic ColorModel getColorModel()
ColorModel。
ColorModel。
public BufferedImage createBufferedImage(int width,
                                         int height)
BufferedImage。
width - 返回的 BufferedImage 的所需宽度。height - 返回的 BufferedImage 的所需高度。
BufferedImage
IllegalArgumentException - 如果 width 或 height 为负数或零。
IllegalArgumentException - 如果 width 和 height 的值大于 Integer.MAX_VALUE,或者存储图像所需的数组元素数大于 Integer.MAX_VALUE。public boolean equals(Object o)
Object 是一个 ImageTypeSpecifier 并且具有与此对象相同的 SampleModel 和 ColorModel,则返回 true。
Object 中的 equalso - 将用于相等性比较的 Object。
ImageTypeSpecifier,则返回 true。Object.hashCode(), 
Hashtablepublic int hashCode()
Object 中的 hashCodeObject.equals(java.lang.Object), 
Hashtable| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。