JavaTM Platform
Standard Ed. 6

java.awt.image
�� ComponentSampleModel

java.lang.Object
  �̳��� java.awt.image.SampleModel
      �̳��� java.awt.image.ComponentSampleModel
ֱ����֪���ࣺ
BandedSampleModel, PixelInterleavedSampleModel

public class ComponentSampleModel
extends SampleModel

�����ʾ��ÿ����������ռ�� 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
 

�ֶ���ϸ��Ϣ

bandOffsets

protected int[] bandOffsets
��������Ԫ�������� band ��ƫ������


bankIndices

protected int[] bankIndices
�����洢ͼ������ band �Ĵ洢��Ԫ��������


numBands

protected int numBands
�� ComponentSampleModel �е� band ������


numBanks

protected int numBanks
�� ComponentSampleModel �еĴ洢��Ԫ������


scanlineStride

protected int scanlineStride
�ɴ� ComponentSampleModel ��������ͼ������������м�ࣨ����������Ԫ�ر�ʾ����


pixelStride

protected int pixelStride
�ɴ� ComponentSampleModel ��������ͼ��������������ؼ�ࣨ����������Ԫ�ر�ʾ����

���췽����ϸ��Ϣ

ComponentSampleModel

public ComponentSampleModel(int dataType,
                            int w,
                            int h,
                            int pixelStride,
                            int scanlineStride,
                            int[] bandOffsets)
�������ָ�������� ComponentSampleModel��band �������� bandOffsets ����ij��ȸ��������� band �����洢�� DataBuffer �ĵ�һ���洢��Ԫ�С�

������
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 ������֧�ֵ���������֮һ

ComponentSampleModel

public ComponentSampleModel(int dataType,
                            int w,
                            int h,
                            int pixelStride,
                            int scanlineStride,
                            int[] bankIndices,
                            int[] bandOffsets)
�������ָ�������� ComponentSampleModel��band �������� bandOffsets ����ij��ȸ�������ͬ�� band ���Դ洢�� DataBuffer �IJ�ͬ�洢��Ԫ�С�

������
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 ������֧�ֵ���������֮һ
������ϸ��Ϣ

createCompatibleSampleModel

public SampleModel createCompatibleSampleModel(int w,
                                               int h)
��������ָ�����Ⱥ͸߶ȵ� ComponentSampleModel���µ� SampleModel ������� SampleModel ��ͬ�� band �������洢�������͡��������������ؼ�ࡣ

ָ���ߣ�
�� SampleModel �е� createCompatibleSampleModel
������
w - �õ��� SampleModel �Ŀ���
h - �õ��� SampleModel �ĸ߶�
���أ�
����ָ����С�� ComponentSampleModel
�׳���
IllegalArgumentException - ��� w �� h ������ 0

createSubsetSampleModel

public SampleModel createSubsetSampleModel(int[] bands)
�������д� ComponentSampleModel �� band �Ӽ����� ComponentSampleModel���µ� ComponentSampleModel �������κ����� ComponentSampleModel ����֮һ��ʹ�õ� DataBuffer һ��ʹ�á��µ� ComponentSampleModel/DataBuffer ��ϱ�ʾ����ԭ ComponentSampleModel/DataBuffer ��� band �Ӽ���ͼ��

ָ���ߣ�
�� SampleModel �е� createSubsetSampleModel
������
bands - �� ComponentSampleModel �� band �Ӽ�
���أ�
�Ѵ����ľ��д� ComponentSampleModel band �Ӽ��� ComponentSampleModel��

createDataBuffer

public DataBuffer createDataBuffer()
������Ӧ�ڴ� ComponentSampleModel �� DataBuffer��DataBuffer ������������͡��洢��Ԫ�������ʹ�С��� ComponentSampleModel һ�¡�

ָ���ߣ�
�� SampleModel �е� createDataBuffer
���أ�
�������͡��洢��Ԫ�������ʹ�С��� ComponentSampleModel һ�µ� DataBuffer��

getOffset

public int getOffset(int x,
                     int y)
��ȡ���� (x,y) �ĵ�һ�� band ��ƫ��������һ�� band ���������ԴӾ��� ComponentSampleModel csm �� DataBuffer data �м�����������ʾ��
        data.getElem(csm.getOffset(x, y));
 

������
x - ���ص� X ����
y - ���ص� Y ����
���أ�
ָ�����ص�һ�� band ��ƫ������

getOffset

public int getOffset(int x,
                     int y,
                     int b)
��ȡ���� (x,y) �� band b ��ƫ������band b ���������ԴӾ��� ComponentSampleModel csm �� DataBuffer data �м�����������ʾ��
       data.getElem(csm.getOffset(x, y, b));
 

������
x - ָ�����ص� X ����
y - ָ�����ص� Y ����
b - ָ���� band
���أ�
ָ�����ص�ָ�� band ��ƫ������

getSampleSize

public final int[] getSampleSize()
�������� band ÿ��������λ����

ָ���ߣ�
�� SampleModel �е� getSampleSize
���أ�
�������� band ÿ����λ�������飬������ÿ��Ԫ�ض���ʾһ�� band��

getSampleSize

public final int getSampleSize(int band)
����ָ�� band ÿ��������λ����

ָ���ߣ�
�� SampleModel �е� getSampleSize
������
band - ָ���� band
���أ�
ָ�� band ÿ��������λ����

getBankIndices

public final int[] getBankIndices()
�������� band �Ĵ洢��Ԫ������

���أ�
���� band �Ĵ洢��Ԫ������

getBandOffsets

public final int[] getBandOffsets()
�������� band �� band ƫ������

���أ�
���� band �� band ƫ������

getScanlineStride

public final int getScanlineStride()
���ش� ComponentSampleModel ��ɨ���м�ࡣ

���أ�
�� ComponentSampleModel ��ɨ���м�ࡣ

getPixelStride

public final int getPixelStride()
���ش� ComponentSampleModel �����ؼ�ࡣ

���أ�
�� ComponentSampleModel �����ؼ�ࡣ

getNumDataElements

public final int getNumDataElements()
����ʹ�� getDataElements(int, int, Object, DataBuffer) �� setDataElements(int, int, Object, DataBuffer) ���������������������Ԫ�ص����������� ComponentSampleModel������ band ��������ͬ��

ָ���ߣ�
�� SampleModel �е� getNumDataElements
���أ�
ʹ�� getDataElements �� setDataElements ���������������������Ԫ�ص�������
������
SampleModel.getNumDataElements(), SampleModel.getNumBands()

getDataElements

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)

getPixel

public int[] getPixel(int x,
                      int y,
                      int[] iArray,
                      DataBuffer data)
���ض�Ӧ int ������ָ�����ص�����������ÿ������Ԫ�ض�Ӧһ��������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� getPixel
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
iArray - ���Ϊ�� null���򷵻ش������е�����
data - ����ͼ�����ݵ� DataBuffer
���أ�
ָ�����ص�������
�׳���
NullPointerException - �������Ϊ null��
ArrayIndexOutOfBoundsException - ������겻�ڱ߽��ڲ������� iArray ̫С�����ܱ��������
������
setPixel(int, int, int[], DataBuffer)

getPixels

public int[] getPixels(int x,
                       int y,
                       int w,
                       int h,
                       int[] iArray,
                       DataBuffer data)
���ض�Ӧ int ����������ָ���������������������ÿ������Ԫ�ض�Ӧһ����������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� getPixels
������
x - ���Ͻ�����λ�õ� X ����
y - ���Ͻ�����λ�õ� Y ����
w - ���ؾ�������Ŀ���
h - ���ؾ�������ĸ߶�
iArray - ���Ϊ�� null���򷵻ش������е�����
data - ����ͼ�����ݵ� DataBuffer
���أ�
ָ�������ڵ����ص�������
������
setPixels(int, int, int, int, int[], DataBuffer)

getSample

public int getSample(int x,
                     int y,
                     int b,
                     DataBuffer data)
�� int ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص�������������겻�ڱ߽��ڲ���������׳� ArrayIndexOutOfBoundsException��

ָ���ߣ�
�� SampleModel �е� getSample
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���ص� band
data - ����ͼ�����ݵ� DataBuffer
���أ�
ָ�����ص�ָ�� band �е�����
������
setSample(int, int, int, int, DataBuffer)

getSampleFloat

public float getSampleFloat(int x,
                            int y,
                            int b,
                            DataBuffer data)
�� float ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� getSampleFloat
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���ص� band
data - ����ͼ�����ݵ� DataBuffer
���أ�
��ʾָ�����ص�ָ�� band �������� float ֵ��

getSampleDouble

public double getSampleDouble(int x,
                              int y,
                              int b,
                              DataBuffer data)
�� double ��ʽ����ָ�� band �ж�Ӧ�� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� getSampleDouble
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���ص� band
data - ����ͼ�����ݵ� DataBuffer
���أ�
��ʾָ�����ص�ָ�� band �������� double ֵ��

getSamples

public int[] getSamples(int x,
                        int y,
                        int w,
                        int h,
                        int b,
                        int[] iArray,
                        DataBuffer data)
����ָ�� band �ж�Ӧ�� int ������ָ�����ؾ��ε�������ÿ����������Ԫ��һ��������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� getSamples
������
x - ���Ͻ�����λ�õ� X ����
y - ���Ͻ�����λ�õ� Y ����
w - ���ؾ�������Ŀ���
h - ���ؾ�������ĸ߶�
b - Ҫ���ص� band
iArray - ���Ϊ�� null���򷵻ش������е�����
data - ����ͼ�����ݵ� DataBuffer
���أ�
ָ�����ص�ָ�� band �е�����
������
setSamples(int, int, int, int, int, int[], DataBuffer)

setDataElements

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 - ����ͼ�����ݵ� DataBuffer
������
getDataElements(int, int, Object, DataBuffer)

setPixel

public void setPixel(int x,
                     int y,
                     int[] iArray,
                     DataBuffer data)
ʹ������������ int �������� DataBuffer �е����ء�������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� setPixel
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
iArray - int ������ʽ����������
data - ����ͼ�����ݵ� DataBuffer
������
getPixel(int, int, int[], DataBuffer)

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      int[] iArray,
                      DataBuffer data)
���� int ���飨ÿ������Ԫ�ذ���һ�����������ö�Ӧ�����ؾ������������������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� setPixels
������
x - ����λ�����Ͻǵ� X ����
y - ����λ�����Ͻǵ� Y ����
w - ���ؾ�������Ŀ���
h - ���ؾ�������ĸ߶�
iArray - int ������ʽ����������
data - ����ͼ�����ݵ� DataBuffer
������
getPixels(int, int, int, int, int[], DataBuffer)

setSample

public void setSample(int x,
                      int y,
                      int b,
                      int s,
                      DataBuffer data)
ʹ������� int ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

ָ���ߣ�
�� SampleModel �е� setSample
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���õ� band
s - int ���͵���������
data - ����ͼ�����ݵ� DataBuffer
������
getSample(int, int, int, DataBuffer)

setSample

public void setSample(int x,
                      int y,
                      int b,
                      float s,
                      DataBuffer data)
ʹ������� float ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� setSample
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���õ� band
s - float ���͵���������
data - ����ͼ�����ݵ� DataBuffer
������
getSample(int, int, int, DataBuffer)

setSample

public void setSample(int x,
                      int y,
                      int b,
                      double s,
                      DataBuffer data)
ʹ������� double ֵ����ָ�� band �����ö�Ӧ�� DataBuffer �� (x,y) �����ص�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� setSample
������
x - ����λ�õ� X ����
y - ����λ�õ� Y ����
b - Ҫ���õ� band
s - double ���͵���������
data - ����ͼ�����ݵ� DataBuffer
������
getSample(int, int, int, DataBuffer)

setSamples

public void setSamples(int x,
                       int y,
                       int w,
                       int h,
                       int b,
                       int[] iArray,
                       DataBuffer data)
���� int ���飨ÿ����������Ԫ�ذ���һ������������ָ�� band �����ö�Ӧ��ָ�����ؾ��ε�������������겻�ڱ߽��ڲ������׳� ArrayIndexOutOfBoundsException��

���ǣ�
�� SampleModel �е� setSamples
������
x - ����λ�����Ͻǵ� X ����
y - ����λ�����Ͻǵ� Y ����
w - ���ؾ�������Ŀ���
h - ���ؾ�������ĸ߶�
b - Ҫ���õ� band
iArray - int ������ʽ����������
data - ����ͼ�����ݵ� DataBuffer
������
getSamples(int, int, int, int, int, int[], DataBuffer)

equals

public boolean equals(Object o)
���� Object ���Ƶ�����
ָʾ����ij�������Ƿ���˶�����ȡ���

equals �����ڷǿն���������ʵ����ȹ�ϵ��

Object ��� equals ����ʵ�ֶ����ϲ�������������ȹ�ϵ�����������κηǿ�����ֵ x �� y�����ҽ��� x �� y ����ͬһ������ʱ���˷����ŷ��� true��x == y ����ֵ true����

ע�⣺���˷�������дʱ��ͨ���б�Ҫ��д hashCode ��������ά�� hashCode �����ij���Э������Э��������ȶ�����������ȵĹ�ϣ�롣

���ǣ�
�� Object �е� equals
������
o - Ҫ��֮�Ƚϵ����ö���
���أ�
����˶����� obj ������ͬ���򷵻� true�����򷵻� false��
������
Object.hashCode(), Hashtable

hashCode

public int hashCode()
���� Object ���Ƶ�����
���ظö���Ĺ�ϣ��ֵ��֧�ִ˷�����Ϊ����߹�ϣ�������� java.util.Hashtable �ṩ�Ĺ�ϣ���������ܡ�

hashCode �ij���Э���ǣ�

ʵ���ϣ��� Object �ඨ��� hashCode ����ȷʵ����Բ�ͬ�Ķ��󷵻ز�ͬ������������һ����ͨ�����ö�����ڲ���ַת����һ��������ʵ�ֵģ����� JavaTM ������Բ���Ҫ����ʵ�ּ��ɡ���

���ǣ�
�� Object �е� hashCode
���أ�
�˶����һ����ϣ��ֵ��
������
Object.equals(java.lang.Object), Hashtable

JavaTM Platform
Standard Ed. 6

�ύ��������
�йظ���� API �ο����ϺͿ�����Ա�ĵ�������� Java SE ������Ա�ĵ������ĵ���������ϸ�ġ����򿪷���Ա���������Լ�������������ﶨ�塢ʹ�ü��ɺ͹�������ʾ����

��Ȩ���� 2007 Sun Microsystems, Inc. ��������Ȩ���� ����������֤��������������ĵ����·ַ�������