|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
java.lang.Objectjava.awt.image.SampleModel
java.awt.image.ComponentSampleModel
public class ComponentSampleModel
�����ʾ��ÿ����������ռ�� DataBuffer ��һ������Ԫ�صķ�ʽ�洢��ͼ�����ݡ����ɴ洢 N ���������� N ��������ͨ�� N ����������������Ԫ��������ء���ͬ�� band ����λ�� DataBuffer �IJ�ͬ�洢��Ԫ�С������ṩ�˴�ȡ��������˿���ֱ�Ӷ�ͼ�����ݽ��в������������֧�ֲ�ͬ���͵Ľ������� band ������ɨ���н��������ؽ����ȡ����ؼ����ͬһɨ������ͬһ band ����������֮�����������Ԫ������ɨ���м���Ǹ�����������һɨ���е�ͬһ���ж�Ӧ����֮�����������Ԫ������band ƫ������ʾ�ӱ���ÿ�� band �� DataBuffer �洢��Ԫ��һ����������Ԫ�ص� band ��һ������֮�����������Ԫ������band �� 0 �� N-1 ���б�š�������Ա�ʾ����ͼ�����ݣ�ÿ���������ǿ��� 8��16 �� 32 λ�洢������������ͼ�����ݣ��ֱ�ʹ�� DataBuffer.TYPE_BYTE
��DataBuffer.TYPE_USHORT
�� DataBuffer.TYPE_INT
����ÿ���������ǿ��� 16 λ�洢���з���������ͼ�����ݣ�ʹ�� DataBuffer.TYPE_SHORT
����ÿ�����������з��� float �� double ����ͼ�����ݣ��ֱ�ʹ�� DataBuffer.TYPE_FLOAT
�� DataBuffer.TYPE_DOUBLE
�������и����� ComponentSampleModel ����������ͬ���ľ��ȴ洢�ġ����м���ƫ��������Ϊ�Ǹ���������֧�� TYPE_BYTE
��TYPE_USHORT
��TYPE_SHORT
��TYPE_INT
��TYPE_FLOAT
�� TYPE_DOUBLE
��
PixelInterleavedSampleModel
,
BandedSampleModel
�ֶ�ժҪ | |
---|---|
protected int[] |
bandOffsets
��������Ԫ�������� band ��ƫ������ |
protected int[] |
bankIndices
�����洢ͼ������ band �Ĵ洢��Ԫ�������� |
protected int |
numBands
�� ComponentSampleModel �е� band ������ |
protected int |
numBanks
�� ComponentSampleModel �еĴ洢��Ԫ������ |
protected int |
pixelStride
�ɴ� ComponentSampleModel ��������ͼ��������������ؼ�ࣨ����������Ԫ�ر�ʾ���� |
protected int |
scanlineStride
�ɴ� ComponentSampleModel ��������ͼ������������м�ࣨ����������Ԫ�ر�ʾ���� |
���� java.awt.image.SampleModel �̳е��ֶ� |
---|
dataType, height, width |
���췽��ժҪ | |
---|---|
ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bandOffsets)
�������ָ�������� ComponentSampleModel�� |
|
ComponentSampleModel(int dataType,
int w,
int h,
int pixelStride,
int scanlineStride,
int[] bankIndices,
int[] bandOffsets)
�������ָ�������� ComponentSampleModel�� |
����ժҪ | |
---|---|
SampleModel |
createCompatibleSampleModel(int w,
int h)
��������ָ�����Ⱥ߶ȵ� ComponentSampleModel �� |
DataBuffer |
createDataBuffer()
������Ӧ�ڴ� ComponentSampleModel �� DataBuffer �� |
SampleModel |
createSubsetSampleModel(int[] bands)
�������д� ComponentSampleModel �� band �Ӽ����� ComponentSampleModel�� |
boolean |
equals(Object o)
ָʾ����ij�������Ƿ���˶�����ȡ��� |
int[] |
getBandOffsets()
�������� band �� band ƫ������ |
int[] |
getBankIndices()
�������� band �Ĵ洢��Ԫ������ |
Object |
getDataElements(int x,
int y,
Object obj,
DataBuffer data)
�� TransferType ���ͻ���������ʽ���ص������ص����ݡ� |
int |
getNumDataElements()
����ʹ�� getDataElements(int, int, Object, DataBuffer) �� setDataElements(int, int, Object, DataBuffer) ���������������������Ԫ�ص������� |
int |
getOffset(int x,
int y)
��ȡ���� (x,y) �ĵ�һ�� band ��ƫ������ |
int |
getOffset(int x,
int y,
int b)
��ȡ���� (x,y) �� band b ��ƫ������ |
int[] |
getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
���ض�Ӧ int ������ָ�����ص�����������ÿ������Ԫ�ض�Ӧһ�������� |
int[] |
getPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
���ض�Ӧ int ����������ָ���������������������ÿ������Ԫ�ض�Ӧһ���������� |
int |
getPixelStride()
���ش� ComponentSampleModel �����ؼ�ࡣ |
int |
getSample(int x,
int y,
int b,
DataBuffer data)
�� int ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص������� |
double |
getSampleDouble(int x,
int y,
int b,
DataBuffer data)
�� double ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص������� |
float |
getSampleFloat(int x,
int y,
int b,
DataBuffer data)
�� float ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص������� |
int[] |
getSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
����ָ�� band �ж�Ӧ�� int ������ָ�����ؾ��ε�������ÿ����������Ԫ��һ�������� |
int[] |
getSampleSize()
�������� band ÿ��������λ���� |
int |
getSampleSize(int band)
����ָ�� band ÿ��������λ���� |
int |
getScanlineStride()
���ش� ComponentSampleModel ��ɨ���м�ࡣ |
int |
hashCode()
���ظö���Ĺ�ϣ��ֵ�� |
void |
setDataElements(int x,
int y,
Object obj,
DataBuffer data)
���� TransferType ���ͻ�����������ָ�� DataBuffer �е������ص����ݡ� |
void |
setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
ʹ������������ int �������� DataBuffer �е����ء� |
void |
setPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
���� int ���飨ÿ������Ԫ�ذ���һ�����������ö�Ӧ�����ؾ������������������ |
void |
setSample(int x,
int y,
int b,
double s,
DataBuffer data)
ʹ������� double ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص������� |
void |
setSample(int x,
int y,
int b,
float s,
DataBuffer data)
ʹ������� float ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص������� |
void |
setSample(int x,
int y,
int b,
int s,
DataBuffer data)
ʹ������� int ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص������� |
void |
setSamples(int x,
int y,
int w,
int h,
int b,
int[] iArray,
DataBuffer data)
���� int ���飨ÿ����������Ԫ�ذ���һ������������ָ�� band �����ö�Ӧ��ָ�����ؾ��ε������� |
���� java.awt.image.SampleModel �̳еķ��� |
---|
getDataElements, getDataType, getHeight, getNumBands, getPixel, getPixel, getPixels, getPixels, getSamples, getSamples, getTransferType, getWidth, setDataElements, setPixel, setPixel, setPixels, setPixels, setSamples, setSamples |
���� java.lang.Object �̳еķ��� |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
�ֶ���ϸ��Ϣ |
---|
protected int[] bandOffsets
protected int[] bankIndices
protected int numBands
ComponentSampleModel
�е� band ������
protected int numBanks
ComponentSampleModel
�еĴ洢��Ԫ������
protected int scanlineStride
protected int pixelStride
���췽����ϸ��Ϣ |
---|
public ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bandOffsets)
dataType
- �洢��������������w
- ������ͼ����������Ŀ��ȣ�������Ϊ��λ��h
- ������ͼ����������ĸ߶ȣ�������Ϊ��λ��pixelStride
- ������ͼ��������������ؼ��scanlineStride
- ������ͼ������������м��bandOffsets
- ���� band ��ƫ����
IllegalArgumentException
- ��� w
�� h
������ 0
IllegalArgumentException
- ��� pixelStride
�� 0
IllegalArgumentException
- ��� scanlineStride
�� 0
IllegalArgumentException
- ��� numBands
�� 1
IllegalArgumentException
- ��� w
�� h
�ij˻����� Integer.MAX_VALUE
IllegalArgumentException
- ��� dataType
������֧�ֵ���������֮һpublic ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bankIndices, int[] bandOffsets)
dataType
- �洢��������������w
- ������ͼ����������Ŀ��ȣ�������Ϊ��λ��h
- ������ͼ����������ĸ߶ȣ�������Ϊ��λ��pixelStride
- ������ͼ��������������ؼ��scanlineStride
- ������ͼ������������м��bankIndices
- ���� band �Ĵ洢��Ԫ����bandOffsets
- ���� band �� band ƫ����
IllegalArgumentException
- ��� w
�� h
������ 0
IllegalArgumentException
- ��� pixelStride
�� 0
IllegalArgumentException
- ��� scanlineStride
�� 0
IllegalArgumentException
- ��� bankIndices
�ij��Ȳ����� bankOffsets
�ij���
IllegalArgumentException
- ��� bandIndices
�� band �������κ�һ��С�� 0
IllegalArgumentException
- ��� dataType
������֧�ֵ���������֮һ������ϸ��Ϣ |
---|
public SampleModel createCompatibleSampleModel(int w, int h)
ComponentSampleModel
���µ� SampleModel
������� SampleModel
��ͬ�� band �������洢�������͡��������������ؼ�ࡣ
SampleModel
�е� createCompatibleSampleModel
w
- �õ��� SampleModel
�Ŀ���h
- �õ��� SampleModel
�ĸ߶�
ComponentSampleModel
IllegalArgumentException
- ��� w
�� h
������ 0public SampleModel createSubsetSampleModel(int[] bands)
SampleModel
�е� createSubsetSampleModel
bands
- �� ComponentSampleModel
�� band �Ӽ�
ComponentSampleModel
band �Ӽ��� ComponentSampleModel
��public DataBuffer createDataBuffer()
ComponentSampleModel
�� DataBuffer
��DataBuffer
������������͡��洢��Ԫ�������ʹ�С��� ComponentSampleModel
һ�¡�
SampleModel
�е� createDataBuffer
ComponentSampleModel
һ�µ� DataBuffer
��public int getOffset(int x, int y)
ComponentSampleModel
csm
�� DataBuffer
data
�м�����������ʾ��
data.getElem(csm.getOffset(x, y));
x
- ���ص� X ����y
- ���ص� Y ����
public int getOffset(int x, int y, int b)
b
���������ԴӾ��� ComponentSampleModel
csm
�� DataBuffer
data
�м�����������ʾ��
data.getElem(csm.getOffset(x, y, b));
x
- ָ�����ص� X ����y
- ָ�����ص� Y ����b
- ָ���� band
public final int[] getSampleSize()
SampleModel
�е� getSampleSize
public final int getSampleSize(int band)
SampleModel
�е� getSampleSize
band
- ָ���� band
public final int[] getBankIndices()
public final int[] getBandOffsets()
public final int getScanlineStride()
ComponentSampleModel
��ɨ���м�ࡣpublic final int getPixelStride()
ComponentSampleModel
�����ؼ�ࡣpublic final int getNumDataElements()
getDataElements(int, int, Object, DataBuffer)
�� setDataElements(int, int, Object, DataBuffer)
���������������������Ԫ�ص����������� ComponentSampleModel
������ band ��������ͬ��
SampleModel
�е� getNumDataElements
getDataElements
�� setDataElements
���������������������Ԫ�ص�������SampleModel.getNumDataElements()
,
SampleModel.getNumBands()
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
TransferType
���ͻ���������ʽ���ص������ص����ݡ����� ComponentSampleModel
�����ص������� data ������ͬ����ÿ������Ԫ�ط���һ��������ͨ����obj
Ӧ����Ϊ null
���룬�Ա� Object
���Զ���������Ϊ��ȷ�Ļ����������͡�
���´���˵������ν����ص����ݴ� DataBuffer
db1
����洢������ ComponentSampleModel
csm1
���������䵽 DataBuffer
db2
����洢������ ComponentSampleModel
csm2
���������ô���ͨ����ʹ�� getPixel
�� setPixel
������
ComponentSampleModel csm1, csm2; DataBufferInt db1, db2; csm2.setDataElements(x, y, csm1.getDataElements(x, y, null, db1), db2);���
SampleModel
���������ͬ������ band����Ӧ band ������ͬ������ÿ����λ�������� TransferType
��ͬ����ʹ�� getDataElements
�� setDataElements
������ DataBuffer/SampleModel
��֮�䴫���ǺϷ��ġ�
��� obj
��Ϊ null
������Ӧ���� TransferType
���͵Ļ������顣�����׳� ClassCastException
��������겻�ڱ߽��ڲ������� obj
��Ϊ null
�Ҳ����Ա����������ݣ����׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� getDataElements
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����obj
- ����� null
������һ��Ҫ�����з����������ݵĻ�������data
- ����ͼ�����ݵ� DataBuffer
NullPointerException
- �������Ϊ null��
ArrayIndexOutOfBoundsException
- ������겻�ڱ߽��ڲ������� obj ̫С�����ܱ��������setDataElements(int, int, Object, DataBuffer)
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getPixel
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����iArray
- ���Ϊ�� null���ش������е�����data
- ����ͼ�����ݵ� DataBuffer
NullPointerException
- �������Ϊ null��
ArrayIndexOutOfBoundsException
- ������겻�ڱ߽��ڲ������� iArray ̫С�����ܱ��������setPixel(int, int, int[], DataBuffer)
public int[] getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getPixels
x
- ���Ͻ�����λ�õ� X ����y
- ���Ͻ�����λ�õ� Y ����w
- ���ؾ�������Ŀ���h
- ���ؾ�������ĸ߶�iArray
- ���Ϊ�� null���ش������е�����data
- ����ͼ�����ݵ� DataBuffer
setPixels(int, int, int, int, int[], DataBuffer)
public int getSample(int x, int y, int b, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getSample
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���ص� banddata
- ����ͼ�����ݵ� DataBuffer
setSample(int, int, int, int, DataBuffer)
public float getSampleFloat(int x, int y, int b, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getSampleFloat
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���ص� banddata
- ����ͼ�����ݵ� DataBuffer
public double getSampleDouble(int x, int y, int b, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getSampleDouble
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���ص� banddata
- ����ͼ�����ݵ� DataBuffer
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� getSamples
x
- ���Ͻ�����λ�õ� X ����y
- ���Ͻ�����λ�õ� Y ����w
- ���ؾ�������Ŀ���h
- ���ؾ�������ĸ߶�b
- Ҫ���ص� bandiArray
- ����� null
���ش������е�����data
- ����ͼ�����ݵ� DataBuffer
setSamples(int, int, int, int, int, int[], DataBuffer)
public void setDataElements(int x, int y, Object obj, DataBuffer data)
TransferType
���ͻ�����������ָ�� DataBuffer
�е������ص����ݡ����� ComponentSampleModel
�����õ������� data ������ͬ����ÿ������Ԫ�ش���һ��������
���´���˵������ν����ص����ݴ� DataBuffer
db1
����洢������ ComponentSampleModel
csm1
���������䵽 DataBuffer
db2
����洢������ ComponentSampleModel
csm2
���������ô���ͨ����ʹ�� getPixel
�� setPixel
������
ComponentSampleModel csm1, csm2; DataBufferInt db1, db2; csm2.setDataElements(x, y, csm1.getDataElements(x, y, null, db1), db2);���
SampleModel
���������ͬ������ band����Ӧ band ������ͬ������ÿ����λ�������� TransferType
��ͬ����ʹ�� getDataElements
�� setDataElements
������ DataBuffer/SampleModel
��֮�䴫���ǺϷ��ġ�
��� obj
���� TransferType
���ͻ������飬�� ClassCastException
��������겻�ڱ߽��ڲ������� obj
�����Ա����������ݣ����׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� setDataElements
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����obj
- �����������ݵĻ�������data
- ����ͼ�����ݵ� DataBuffergetDataElements(int, int, Object, DataBuffer)
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
DataBuffer
�е����ء�������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� setPixel
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����iArray
- int ������ʽ����������data
- ����ͼ�����ݵ� DataBuffergetPixel(int, int, int[], DataBuffer)
public void setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� setPixels
x
- ����λ�����Ͻǵ� X ����y
- ����λ�����Ͻǵ� Y ����w
- ���ؾ�������Ŀ���h
- ���ؾ�������ĸ߶�iArray
- int ������ʽ����������data
- ����ͼ�����ݵ� DataBuffergetPixels(int, int, int, int, int[], DataBuffer)
public void setSample(int x, int y, int b, int s, DataBuffer data)
DataBuffer
�� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� setSample
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���õ� bands
- int ���͵���������data
- ����ͼ�����ݵ� DataBuffergetSample(int, int, int, DataBuffer)
public void setSample(int x, int y, int b, float s, DataBuffer data)
DataBuffer
�� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� setSample
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���õ� bands
- float ���͵���������data
- ����ͼ�����ݵ� DataBuffergetSample(int, int, int, DataBuffer)
public void setSample(int x, int y, int b, double s, DataBuffer data)
DataBuffer
�� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException
��
SampleModel
�е� setSample
x
- ����λ�õ� X ����y
- ����λ�õ� Y ����b
- Ҫ���õ� bands
- double ���͵���������data
- ����ͼ�����ݵ� DataBuffergetSample(int, int, int, DataBuffer)
public void setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
ArrayIndexOutOfBoundsException
��
SampleModel
�е� setSamples
x
- ����λ�����Ͻǵ� X ����y
- ����λ�����Ͻǵ� Y ����w
- ���ؾ�������Ŀ���h
- ���ؾ�������ĸ߶�b
- Ҫ���õ� bandiArray
- int ������ʽ����������data
- ����ͼ�����ݵ� DataBuffergetSamples(int, int, int, int, int, int[], DataBuffer)
public boolean equals(Object o)
Object
���Ƶ�����
equals
�����ڷǿն���������ʵ����ȹ�ϵ��
x
��x.equals(x)
��Ӧ���� true
��
x
�� y
�����ҽ��� y.equals(x)
���� true
ʱ��x.equals(y)
��Ӧ���� true
��
x
��y
�� z
����� x.equals(y)
���� true
������ y.equals(z)
���� true
����ô x.equals(z)
Ӧ���� true
��
x
�� y
����ε��� x.equals(y) ʼ�շ��� true
��ʼ�շ��� false
��ǰ���Ƕ����� equals
�Ƚ������õ���Ϣû�б��ġ�
x
��x.equals(null)
��Ӧ���� false
��
Object
��� equals ����ʵ�ֶ����ϲ�������������ȹ�ϵ�����������κηǿ�����ֵ x
�� y
�����ҽ��� x
�� y
����ͬһ������ʱ���˷����ŷ��� true
��x == y
����ֵ true
����
ע�⣺���˷�������дʱ��ͨ���б�Ҫ��д hashCode ��������ά�� hashCode �����ij���Э������Э��������ȶ�����������ȵĹ�ϣ�롣
Object
�е� equals
o
- Ҫ��֮�Ƚϵ����ö���
true
������ false
��Object.hashCode()
,
Hashtable
public int hashCode()
Object
���Ƶ�����java.util.Hashtable
�ṩ�Ĺ�ϣ���������ܡ�
hashCode
�ij���Э���ǣ�
hashCode
����������������ͬ�����������
Object.equals(java.lang.Object)
����������������ȣ���ô�������������е���һ�����ϵ��� hashCode ������ Ҫ��һ�����ɲ�ͬ��������������ǣ�����ԱӦ����ʶ����Ϊ����ȵĶ������ɲ�ͬ�������������߹�ϣ�������ܡ�
ʵ���ϣ��� Object �ඨ��� hashCode ����ȷʵ����Բ�ͬ�Ķ��ز�ͬ������������һ����ͨ�����ö�����ڲ���ַת����һ��������ʵ�ֵģ����� JavaTM ������Բ���Ҫ����ʵ�ּ��ɡ���
Object
�е� hashCode
Object.equals(java.lang.Object)
,
Hashtable
|
JavaTM Platform Standard Ed. 6 |
|||||||||
��һ���� ��һ���� | ��� ��� ������ | |||||||||
ժҪ�� Ƕ�� | �ֶ� | ���췽�� | ���� | ��ϸ��Ϣ�� �ֶ� | ���췽�� | ���� |
��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������