|
JavaTM 2 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 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。