public class ImageTypeSpecifier extends Object
SampleModel
和
ColorModel
)是一个方便的方式指定。
Modifier and Type | Field and Description |
---|---|
protected ColorModel |
colorModel
的
ColorModel 作为原型。
|
protected SampleModel |
sampleModel
一个
SampleModel 作为原型。
|
Constructor and Description |
---|
ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel)
构建了一个
ImageTypeSpecifier 直接从
ColorModel 和
SampleModel 。
|
ImageTypeSpecifier(RenderedImage image)
构建了一个从
RenderedImage
ImageTypeSpecifier 。
|
Modifier and Type | Method and Description |
---|---|
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)
返回一个用于灰度图像的格式,将给定的比特深度为指定的数据类型说明符数组元素的像素。
|
static ImageTypeSpecifier |
createGrayscale(int bits, int dataType, boolean isSigned, boolean isAlphaPremultiplied)
返回一个灰度加α的图像格式,将给定的比特深度为指定的数据类型说明符数组元素的像素。
|
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 存储每个像素组成短一个单独的字节说明符或int。
|
static ImageTypeSpecifier |
createPacked(ColorSpace colorSpace, int redMask, int greenMask, int blueMask, int alphaMask, int transferType, boolean isAlphaPremultiplied)
返回一个填充的图像格式,将使用一个
DirectColorModel 和填充
SampleModel 存储每个像素填充到一个单字节,短的说明符或int。
|
boolean |
equals(Object o)
返回
true 如果给定的
Object 是
ImageTypeSpecifier 具有
SampleModel 和
ColorModel 等于这些对象。
|
int |
getBitsPerBand(int band)
返回用于表示给定带的样本的比特数。
|
int |
getBufferedImageType()
返回一个int包含一个枚举常量的值从
BufferedImage 描述图像格式。
|
ColorModel |
getColorModel()
返回指定对象的
ColorModel 。
|
int |
getNumBands()
返回由该对象指定的条带数。
|
int |
getNumComponents()
返回由该对象指定的颜色组件的数量。
|
SampleModel |
getSampleModel()
返回一个
SampleModel 基于设置封装在这个对象。
|
SampleModel |
getSampleModel(int width, int height)
返回一个
SampleModel 基于设置封装在这个对象。
|
int |
hashCode()
返回此imagetypespecifier哈希代码。
|
protected ColorModel colorModel
ColorModel
作为原型。
protected SampleModel sampleModel
SampleModel
作为原型。
public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel)
ImageTypeSpecifier
直接从
ColorModel
和
SampleModel
。它是调用方的责任,提供兼容的参数。
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
存储每个像素填充到一个单字节,短的说明符或int。
colorSpace
-所需的
ColorSpace
。
redMask
-连续掩码显示红色通道的位置。
greenMask
-连续掩码表示绿色通道的位置。
blueMask
-连续掩码表示的蓝色通道的位置。
alphaMask
-连续掩码表示的alpha通道的位置。
transferType
-所需的
SampleModel
转移型。
isAlphaPremultiplied
-
true
如果颜色通道将premultipled通过Alpha通道。
ImageTypeSpecifier
。
null
colorSpace
IllegalArgumentException
。
colorSpace
IllegalArgumentException
类型不是
TYPE_RGB
。
IllegalArgumentException
-如果没有面具有至少1位。
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
存储每个像素组成短一个单独的字节说明符或int。
colorSpace
-所需的
ColorSpace
。
bandOffsets
-
int
s指示每个波段的偏移量数组。
dataType
-所需的数据类型,作为一个从
DataBuffer
类的枚举。
hasAlpha
-
true
如果alpha通道所需的。
isAlphaPremultiplied
-
true
如果颜色通道将premultipled通过Alpha通道。
ImageTypeSpecifier
。
null
colorSpace
IllegalArgumentException
。
null
bandOffsets
IllegalArgumentException
。
IllegalArgumentException
-如果
dataType
不是一个法律
DataBuffer.TYPE_*
常数。
IllegalArgumentException
-如果
bandOffsets.length
并不等于颜色空间的分量数,加1,如果
hasAlpha
是
true
。
public static ImageTypeSpecifier createBanded(ColorSpace colorSpace, int[] bankIndices, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
ComponentColorModel
和
BandedSampleModel
存储每个通道在一个独立的数组说明符。
colorSpace
-所需的
ColorSpace
。
bankIndices
-一系列
int
s指示银行在每个乐队将存储。
bandOffsets
-
int
s指示起始偏移每个乐队在其银行的数组。
dataType
-所需的数据类型,作为一个从
DataBuffer
类的枚举。
hasAlpha
-
true
如果alpha通道所需的。
isAlphaPremultiplied
-
true
如果颜色通道将premultipled通过Alpha通道。
ImageTypeSpecifier
。
null
colorSpace
IllegalArgumentException
。
null
bankIndices
IllegalArgumentException
。
null
bandOffsets
IllegalArgumentException
。
IllegalArgumentException
-如果
bankIndices
和
bandOffsets
长度不同。
IllegalArgumentException
-如果
bandOffsets.length
并不等于颜色空间的分量数,加1,如果
hasAlpha
是
true
。
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
-
true
如果亮度通道将premultipled通过Alpha通道。
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
s红。
greenLUT
-含*各指标的绿色价值观
byte
s数组。
blueLUT
-含各指标值的数组
byte
s蓝。
alphaLUT
-含各指数α值
byte
s数组,或
null
创建一个完全不透明的LUT。
bits
在每个指标的比特数。
dataType
-期望的输出类型,作为一个从
DataBuffer
类的枚举。
ImageTypeSpecifier
。
null
redLUT
IllegalArgumentException
。
null
greenLUT
IllegalArgumentException
。
null
blueLUT
IllegalArgumentException
。
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_INDEXED
public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image)
ImageTypeSpecifier
编码一个
RenderedImage
布局(这可能是一个
BufferedImage
)。
image
-
RenderedImage
。
ImageTypeSpecifier
。
null
image
IllegalArgumentException
。
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_INDEXED
public int getNumComponents()
ColorModel.getNumComponents
public int getNumBands()
SampleModel.getNumBands
public int getBitsPerBand(int band)
band
-乐队要查询的索引,为int型。
IllegalArgumentException
-如果
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_VALUE
public 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)
true
如果给定的
Object
是
ImageTypeSpecifier
具有
SampleModel
和
ColorModel
等于这些对象。
equals
方法重写,继承类
Object
o
-
Object
是比较平等。
true
如果给定的对象是一个相当
ImageTypeSpecifier
。
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.