|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.awt.image.Raster
java.awt.image.WritableRaster
public class WritableRaster
此類別擴展了 Raster 以提供像素寫入功能。有關 Raster 如何存儲像素的描述,請參閱 Raster 的類別註釋。
此類別的建構子為 protected。要實例化 WritableRaster,需使用 Raster 類別中的一個 createWritableRaster 處理器方法。
| 欄位摘要 |
|---|
| 從類別 java.awt.image.Raster 繼承的欄位 |
|---|
dataBuffer, height, minX, minY, numBands, numDataElements, parent, sampleModel, sampleModelTranslateX, sampleModelTranslateY, width |
| 建構子摘要 | |
|---|---|
protected |
WritableRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Point origin)
建構具有給定 SampleModel 和 DataBuffer 的 WritableRaster。 |
protected |
WritableRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Rectangle aRegion,
Point sampleModelTranslate,
WritableRaster parent)
建構具有給定 SampleModel、DataBuffer 和父親的 WritableRaster。 |
protected |
WritableRaster(SampleModel sampleModel,
Point origin)
建構具有給定 SampleModel 的 WritableRaster。 |
| 方法摘要 | |
|---|---|
WritableRaster |
createWritableChild(int parentX,
int parentY,
int w,
int h,
int childMinX,
int childMinY,
int[] bandList)
返回新的 WritableRaster,它共享此 WritableRaster 的全部或部分 DataBuffer。 |
WritableRaster |
createWritableTranslatedChild(int childMinX,
int childMinY)
在不同的位置上創建一個與此 WritableRaster 具有相同大小、SampleModel 和 DataBuffer 的 WritableRaster。 |
WritableRaster |
getWritableParent()
返回此 WritableRaster 的父 WritableRaster(如果有),否則返回 null。 |
void |
setDataElements(int x,
int y,
int w,
int h,
Object inData)
為型別 TransferType 基本陣列中的像素矩形設置資料。 |
void |
setDataElements(int x,
int y,
Object inData)
為型別 TransferType 基本陣列中的單個像素設置資料。 |
void |
setDataElements(int x,
int y,
Raster inRaster)
為輸入 Raster 中的像素矩形設置資料。 |
void |
setPixel(int x,
int y,
double[] dArray)
使用輸入樣本的 double 型陣列設置 DataBuffer 中的像素。 |
void |
setPixel(int x,
int y,
float[] fArray)
使用輸入樣本的 float 型陣列設置 DataBuffer 中的像素。 |
void |
setPixel(int x,
int y,
int[] iArray)
使用輸入樣本的 int 型陣列設置 DataBuffer 中的像素。 |
void |
setPixels(int x,
int y,
int w,
int h,
double[] dArray)
為每個陣列元素包含一個樣本的 double 型陣列中的像素矩形設置所有樣本。 |
void |
setPixels(int x,
int y,
int w,
int h,
float[] fArray)
為每個陣列元素包含一個樣本的 float 型陣列中的像素矩形設置所有樣本。 |
void |
setPixels(int x,
int y,
int w,
int h,
int[] iArray)
為每個陣列元素包含一個樣本的 int 型陣列中的像素矩形設置所有樣本。 |
void |
setRect(int dx,
int dy,
Raster srcRaster)
將像素從 Raster srcRaster 複製到此 WritableRaster。 |
void |
setRect(Raster srcRaster)
將像素從 Raster srcRaster 複製到此 WritableRaster。 |
void |
setSample(int x,
int y,
int b,
double s)
使用 double 型的輸入樣本,在指定 band 中為位於 DataBuffer 中 (x,y) 位置的像素設置樣本。 |
void |
setSample(int x,
int y,
int b,
float s)
使用 float 型的輸入樣本,在指定 band 中為位於 DataBuffer 中 (x,y) 位置的像素設置樣本。 |
void |
setSample(int x,
int y,
int b,
int s)
使用 int 型的輸入樣本,在指定 band 中為位於 DataBuffer 中 (x,y) 位置的像素設置樣本。 |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
double[] dArray)
為每個陣列元素包含一個樣本的 double 型陣列中指定的像素矩形在指定 band 中設置樣本。 |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
float[] fArray)
為每個陣列元素包含一個樣本的 float 型陣列中指定的像素矩形在指定 band 中設置樣本。 |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray)
為每個陣列元素包含一個樣本的 int 型陣列中指定的像素矩形在指定 band 中設置樣本。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
protected WritableRaster(SampleModel sampleModel,
Point origin)
sampleModel - 指定佈局的 SampleModel。origin - 指定原點的 Point。
RasterFormatException - 如果 origin.x + sampleModel.getWidth() 或者 origin.y + sampleModel.getHeight() 的計算結果整數溢位
protected WritableRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Point origin)
sampleModel - 指定佈局的 SampleModel。dataBuffer - 套件含圖像資料的 DataBuffer。origin - 指定原點的 Point。
RasterFormatException - 如果 origin.x + sampleModel.getWidth() 或 origin.y + sampleModel.getHeight() 的計算結果整數溢位
protected WritableRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Rectangle aRegion,
Point sampleModelTranslate,
WritableRaster parent)
sampleModel - 指定佈局的 SampleModel。dataBuffer - 套件含圖像資料的 DataBuffer。aRegion - 指定圖像區域的 Rectangle。sampleModelTranslate - 指定從 SampleModel 向 Raster 進行坐標轉換的 Point。parent - 此 raster 的父親(如果有)。
RasterFormatException - 如果 aRegion 的寬度和高度小於等於 0,或者 aRegion.x + aRegion.width 或 aRegion.y + aRegion.height 的計算結果整數溢位| 方法詳細資訊 |
|---|
public WritableRaster getWritableParent()
WritableRaster 的父親,或 null。
public WritableRaster createWritableTranslatedChild(int childMinX,
int childMinY)
childMinX - 新 Raster 左上角的 X 坐標。childMinY - 新 Raster 左上角的 Y 坐標。
WritableRaster 相同的 WritableRaster。
RasterFormatException - 如果 childMinX + this.getWidth() 或 childMinY + this.getHeight() 的計算結果整數溢位
public WritableRaster createWritableChild(int parentX,
int parentY,
int w,
int h,
int childMinX,
int childMinY,
int[] bandList)
parentX、parentY、width 和 height 參數在此 WritableRaster 坐標空間中形成一個 Rectangle,指示要共享的像素區域。如果此 Rectangle 沒有包含在當前 WritableRaster 的邊界內部,則會拋出錯誤。
新 WritableRaster 可以另外轉換到與當前 WritableRaster 不同的平面坐標系中。childMinX 和 childMinY 參數給定返回的 WritableRaster 左上角像素的新 (x, y) 坐標;新 WritableRaster 中的坐標 (childMinX, childMinY) 將映射到當前 WritableRaster 中相同像素的坐標 (parentX, parentY)。
新 WritableRaster 可以定義為只包含當前 WritableRaster band 的一個子集,該子集可能通過 bandList 參數進行了重新排序。如果 bandList 為 null,則它將以其當前順序包含當前 WritableRaster 的所有 band。
要創建新的 WritableRaster,使其包含當前 WritableRaster 的子區域,但共享其坐標系和 band,此方法在調用時應該令 childMinX 等於 parentX,childMinY 等於 parentY 且 bandList 為 null。
parentX - 此 WritableRaster 坐標中左上角的 X 坐標。parentY - 此 WritableRaster 坐標中左上角的 Y 坐標。w - 從 (parentX, parentY) 開始的區域寬度。w - 從 (parentX, parentY) 開始的區域高度。childMinX - 返回的 WritableRaster 左上角的 X 坐標。childMinY - 返回的 WritableRaster 左上角的 Y 坐標。bandList - band 的索引陣列,取 null 則使用所有 band。
WritableRaster,它共享此 WritableRaster 全部或部分 DataBuffer。
RasterFormatException - 如果子區域位於光柵邊界的外部。
RasterFormatException - 如果 w 或 h 小於等於 0,或者 parentX + w、parentY + h、childMinX + w 或 childMinY + h 中任何一個的計算結果整數溢位
public void setDataElements(int x,
int y,
Object inData)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。inData - 參考型別陣列的物件,該型別由 getTransferType() 定義,並且其長度 getNumDataElements() 套件含到 x,y 位置的像素資料。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 inData 太小不能容納輸入。SampleModel.setDataElements(int, int, Object, DataBuffer)
public void setDataElements(int x,
int y,
Raster inRaster)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。inRaster - 套件含 x,y 位置資料的 Raster。
NullPointerException - 如果 inRaster 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部。
public void setDataElements(int x,
int y,
int w,
int h,
Object inData)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。inData - 參考型別陣列的物件,該型別是由 getTransferType() 定義的,並且它的長度 w*h*getNumDataElements() 套件含 x,y 和 x+w-1, y+h-1 位置之間的像素資料。
NullPointerException - 如果 inData 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 inData 太小不能容納輸入。SampleModel.setDataElements(int, int, int, int, Object, DataBuffer)public void setRect(Raster srcRaster)
如果源 Raster 和目標 Raster 的所有樣本都是整型,且大小小於等於 32 位,則調用此方法等價於對源 Raster 和目標 Raster 中所有有效的 x,y 位址執行以下程式碼。
Raster srcRaster;
WritableRaster dstRaster;
for (int b = 0; b < srcRaster.getNumBands(); b++) {
dstRaster.setSample(x, y, b, srcRaster.getSample(x, y, b));
}
因此,當將整型的源複製到整型的目標時,如果對於特定的 band 源樣本大小大於目標樣本大小,則源樣本的高位將被截斷。如果特定 band 的源樣本大小小於目標樣本大小,則根據 srcRaster 的 SampleModel 是將樣本作為有符號的量還是無符號的量,對目標樣本的高位進行零擴展或符號擴展。
當從一個 float 型或 double 型的源複製到整型的目標時,每個源樣本強制轉換為目標型別。當從整形的源複製到 float 型或 double 型的目標時,源首先使用上面的整型轉換規則轉換為 32-位的 int(如果需要的話),然後此 int 強制轉換為 float 型或 double 型。
srcRaster - 從其複製像素的 Raster。
NullPointerException - 如果 srcRaster 為 null。
public void setRect(int dx,
int dy,
Raster srcRaster)
setRect(Raster)。
dx - 從 src 空間複製到 dst 空間的 X 轉換因子。dy - 從 src 空間複製到 dst 空間的 Y 轉換因子。srcRaster - 從其複製像素的 Raster。
NullPointerException - 如果 srcRaster 為 null。
public void setPixel(int x,
int y,
int[] iArray)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。iArray - 以 int 型陣列表示的輸入樣本。
NullPointerException - 如果 iArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 iArray 太小不能容納輸入。
public void setPixel(int x,
int y,
float[] fArray)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。fArray - 以 float 型陣列表示的輸入樣本。
NullPointerException - 如果 fArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 fArray 太小不能容納輸入。
public void setPixel(int x,
int y,
double[] dArray)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。dArray - 以 double 型陣列表示的輸入樣本。
NullPointerException - 如果 dArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 dArray 太小不能容納輸入。
public void setPixels(int x,
int y,
int w,
int h,
int[] iArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。iArray - 輸入的 int 像素陣列。
NullPointerException - 如果 iArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 iArray 太小不能容納輸入。
public void setPixels(int x,
int y,
int w,
int h,
float[] fArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。fArray - 輸入的 float 型像素陣列。
NullPointerException - 如果 fArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 fArray 太小不能容納輸入。
public void setPixels(int x,
int y,
int w,
int h,
double[] dArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。dArray - 輸入的 double 型陣列。
NullPointerException - 如果 dArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標不在邊界內部,或者 dArray 太小不能容納輸入。
public void setSample(int x,
int y,
int b,
int s)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。b - 要設置的 band。s - 輸入樣本。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內部。
public void setSample(int x,
int y,
int b,
float s)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。b - 要設置的 band。s - 以 float 的形式輸入的樣本。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內部。
public void setSample(int x,
int y,
int b,
double s)
x - 像素位置的 X 坐標。y - 像素位置的 Y 坐標。b - 要設置的 band。s - 以 double 形式輸入的樣本。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內部。
public void setSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。b - 要設置的 band。iArray - 輸入的 int 型樣本陣列。
NullPointerException - 如果 iArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內部,或者 iArray 太小不能容納輸入。
public void setSamples(int x,
int y,
int w,
int h,
int b,
float[] fArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。b - 要設置的 band。fArray - 輸入的 float 型樣本陣列。
NullPointerException - 如果 fArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內部,或者 fArray 太小不能容納輸入。
public void setSamples(int x,
int y,
int w,
int h,
int b,
double[] dArray)
x - 左上角像素位置的 X 坐標。y - 左上角像素位置的 Y 坐標。w - 像素矩形的寬度。h - 像素矩形的高度。b - 要設置的 band。dArray - 輸入的 double 型樣本陣列。
NullPointerException - 如果 dArray 為 null。
ArrayIndexOutOfBoundsException - 如果坐標或 band 索引不在邊界內,或者 dArray 太小不能容納輸入。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。