java.awt.image

Class ComponentSampleModel

Known Direct Subclasses:
BandedSampleModel, PixelInterleavedSampleModel

public class ComponentSampleModel
extends SampleModel

ComponentSampleModel supports a flexible organization of pixel samples in memory, permitting pixel samples to be interleaved by band, by scanline, and by pixel. A DataBuffer for this sample model has K banks of data. Pixels have N samples, so there are N bands in the DataBuffer. Each band is completely contained in one bank of data, but a bank may contain more than one band. Each pixel sample is stored in a single data element. Within a bank, each band begins at an offset stored in bandOffsets. The banks containing the band is given by bankIndices. Within the bank, there are three dimensions - band, pixel, and scanline. The dimension ordering is controlled by bandOffset, pixelStride, and scanlineStride, which means that any combination of interleavings is supported.

Field Summary

protected int[]
bandOffsets
protected int[]
bankIndices
protected int
numBands
Number of bands in the image described.
protected int
numBanks
Used when creating data buffers.
protected int
pixelStride
protected int
scanlineStride

Fields inherited from class java.awt.image.SampleModel

dataType, height, numBands, width

Constructor Summary

ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bandOffsets)
ComponentSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bankIndices, int[] bandOffsets)

Method Summary

SampleModel
createCompatibleSampleModel(int w, int h)
DataBuffer
createDataBuffer()
SampleModel
createSubsetSampleModel(int[] bands)
int[]
getBandOffsets()
int[]
getBankIndices()
Object
getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
Object
getDataElements(int x, int y, Object obj, DataBuffer data)
int
getNumDataElements()
int
getOffset(int x, int y)
int
getOffset(int x, int y, int b)
int[]
getPixel(int x, int y, int[] iArray, DataBuffer data)
int
getPixelStride()
int[]
getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
int
getSample(int x, int y, int b, DataBuffer data)
int[]
getSampleSize()
int
getSampleSize(int band)
int
getScanlineStride()
void
setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
void
setDataElements(int x, int y, Object obj, DataBuffer data)
void
setPixel(int x, int y, int[] iArray, DataBuffer data)
void
setSample(int x, int y, int b, int s, DataBuffer data)

Methods inherited from class java.awt.image.SampleModel

createCompatibleSampleModel, createDataBuffer, createSubsetSampleModel, getDataElements, getDataElements, getDataType, getHeight, getNumBands, getNumDataElements, getPixel, getPixel, getPixel, getPixels, getPixels, getPixels, getSample, getSampleDouble, getSampleFloat, getSampleSize, getSampleSize, getSamples, getSamples, getSamples, getTransferType, getWidth, setDataElements, setDataElements, setPixel, setPixel, setPixel, setPixels, setPixels, setPixels, setSample, setSample, setSample, setSamples, setSamples, setSamples

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

bandOffsets

protected int[] bandOffsets

bankIndices

protected int[] bankIndices

numBands

protected int numBands
Number of bands in the image described.

numBanks

protected int numBanks
Used when creating data buffers.

pixelStride

protected int pixelStride

scanlineStride

protected int scanlineStride

Constructor Details

ComponentSampleModel

public ComponentSampleModel(int dataType,
                            int w,
                            int h,
                            int pixelStride,
                            int scanlineStride,
                            int[] bandOffsets)

ComponentSampleModel

public ComponentSampleModel(int dataType,
                            int w,
                            int h,
                            int pixelStride,
                            int scanlineStride,
                            int[] bankIndices,
                            int[] bandOffsets)

Method Details

createCompatibleSampleModel

public SampleModel createCompatibleSampleModel(int w,
                                               int h)
Overrides:
createCompatibleSampleModel in interface SampleModel

createDataBuffer

public DataBuffer createDataBuffer()
Overrides:
createDataBuffer in interface SampleModel

createSubsetSampleModel

public SampleModel createSubsetSampleModel(int[] bands)
Overrides:
createSubsetSampleModel in interface SampleModel

getBandOffsets

public final int[] getBandOffsets()

getBankIndices

public final int[] getBankIndices()

getDataElements

public Object getDataElements(int x,
                              int y,
                              int w,
                              int h,
                              Object obj,
                              DataBuffer data)
Overrides:
getDataElements in interface SampleModel

getDataElements

public Object getDataElements(int x,
                              int y,
                              Object obj,
                              DataBuffer data)
Overrides:
getDataElements in interface SampleModel

getNumDataElements

public final int getNumDataElements()
Overrides:
getNumDataElements in interface SampleModel

getOffset

public int getOffset(int x,
                     int y)

getOffset

public int getOffset(int x,
                     int y,
                     int b)

getPixel

public int[] getPixel(int x,
                      int y,
                      int[] iArray,
                      DataBuffer data)
Overrides:
getPixel in interface SampleModel

getPixelStride

public final int getPixelStride()

getPixels

public int[] getPixels(int x,
                       int y,
                       int w,
                       int h,
                       int[] iArray,
                       DataBuffer data)
Overrides:
getPixels in interface SampleModel

getSample

public int getSample(int x,
                     int y,
                     int b,
                     DataBuffer data)
Overrides:
getSample in interface SampleModel

getSampleSize

public final int[] getSampleSize()
Overrides:
getSampleSize in interface SampleModel

getSampleSize

public final int getSampleSize(int band)
Overrides:
getSampleSize in interface SampleModel

getScanlineStride

public final int getScanlineStride()

setDataElements

public void setDataElements(int x,
                            int y,
                            int w,
                            int h,
                            Object obj,
                            DataBuffer data)
Overrides:
setDataElements in interface SampleModel

setDataElements

public void setDataElements(int x,
                            int y,
                            Object obj,
                            DataBuffer data)
Overrides:
setDataElements in interface SampleModel

setPixel

public void setPixel(int x,
                     int y,
                     int[] iArray,
                     DataBuffer data)
Overrides:
setPixel in interface SampleModel

setSample

public void setSample(int x,
                      int y,
                      int b,
                      int s,
                      DataBuffer data)
Overrides:
setSample in interface SampleModel

Copyright (C) 2000, 2002 Free Software Foundation This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.