java.awt.image

Class BandedSampleModel


public final class BandedSampleModel
extends ComponentSampleModel

MultiPixelPackedSampleModel provides a single band model that supports multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit per data element.

Field Summary

Fields inherited from class java.awt.image.ComponentSampleModel

bandOffsets, bankIndices, numBands, numBanks, pixelStride, scanlineStride

Fields inherited from class java.awt.image.SampleModel

dataType, height, numBands, width

Constructor Summary

BandedSampleModel(int dataType, int w, int h, int numBands)
BandedSampleModel(int dataType, int w, int h, int scanlineStride, int[] bankIndices, int[] bandOffsets)

Method Summary

SampleModel
createCompatibleSampleModel(int w, int h)
SampleModel
createSubsetSampleModel(int[] bands)
Object
getDataElements(int x, int y, Object obj, DataBuffer data)
Extract all samples of one pixel and return in an array of transfer type.
int[]
getPixel(int x, int y, int[] iArray, DataBuffer data)
int[]
getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
Copy pixels from a region into an array.
int
getSample(int x, int y, int b, DataBuffer data)
double
getSampleDouble(int x, int y, int b, DataBuffer data)
float
getSampleFloat(int x, int y, int b, DataBuffer data)
int[]
getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
Copy one band's samples from a region into an array.
void
setDataElements(int x, int y, Object obj, DataBuffer data)
Set the pixel at x, y to the value in the first element of the primitive array obj.
void
setPixel(int x, int y, int[] iArray, DataBuffer data)
void
setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
void
setSample(int x, int y, int b, double s, DataBuffer data)
void
setSample(int x, int y, int b, float s, DataBuffer data)
void
setSample(int x, int y, int b, int s, DataBuffer data)
void
setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
String
toString()
Creates a String with some information about this SampleModel.

Methods inherited from class java.awt.image.ComponentSampleModel

createCompatibleSampleModel, createDataBuffer, createSubsetSampleModel, getBandOffsets, getBankIndices, getDataElements, getDataElements, getNumDataElements, getOffset, getOffset, getPixel, getPixelStride, getPixels, getSample, getSampleSize, getSampleSize, getScanlineStride, setDataElements, setDataElements, setPixel, setSample

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

Constructor Details

BandedSampleModel

public BandedSampleModel(int dataType,
                         int w,
                         int h,
                         int numBands)

BandedSampleModel

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

Method Details

createCompatibleSampleModel

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

createSubsetSampleModel

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

getDataElements

public Object getDataElements(int x,
                              int y,
                              Object obj,
                              DataBuffer data)
Extract all samples of one pixel and return in an array of transfer type. Extracts the pixel at x, y from data and stores samples into the array obj. If obj is null, a new array of getTransferType() is created.
Overrides:
getDataElements in interface ComponentSampleModel
Parameters:
x - The x-coordinate of the pixel rectangle to store in obj.
y - The y-coordinate of the pixel rectangle to store in obj.
obj - The primitive array to store the pixels into or null to force creation.
data - The DataBuffer that is the source of the pixel data.
Returns:
The primitive array containing the pixel data.

getPixel

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

getPixels

public int[] getPixels(int x,
                       int y,
                       int w,
                       int h,
                       int[] iArray,
                       DataBuffer data)
Copy pixels from a region into an array. Copies the samples of the pixels in the rectangle starting at x, y that is w pixels wide and h scanlines high. When there is more than one band, the samples stored in order before the next pixel. This ordering isn't well specified in Sun's docs as of 1.4.2. If iArray is null, a new array is allocated, filled, and returned.
Overrides:
getPixels in interface ComponentSampleModel
Parameters:
x - The x-coordinate of the pixel rectangle to store in iArray.
y - The y-coordinate of the pixel rectangle to store in iArray.
w - The width in pixels of the rectangle.
h - The height in pixels of the rectangle.
iArray - The int array to store the pixels into or null to force creation.
data - The DataBuffer that is the source of the pixel data.
Returns:
The primitive array containing the pixel data.

getSample

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

getSampleDouble

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

getSampleFloat

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

getSamples

public int[] getSamples(int x,
                        int y,
                        int w,
                        int h,
                        int b,
                        int[] iArray,
                        DataBuffer data)
Copy one band's samples from a region into an array. Copies from one band the samples of the pixels in the rectangle starting at x, y that is w pixels wide and h scanlines high. If iArray is null, a new array is allocated, filled, and returned.
Overrides:
getSamples in interface SampleModel
Parameters:
x - The x-coordinate of the pixel rectangle to store in iArray.
y - The y-coordinate of the pixel rectangle to store in iArray.
w - The width in pixels of the rectangle.
h - The height in pixels of the rectangle.
b - The band to retrieve.
iArray - The int array to store the pixels into or null to force creation.
data - The DataBuffer that is the source of the pixel data.
Returns:
The primitive array containing the pixel data.

setDataElements

public void setDataElements(int x,
                            int y,
                            Object obj,
                            DataBuffer data)
Set the pixel at x, y to the value in the first element of the primitive array obj.
Overrides:
setDataElements in interface ComponentSampleModel
Parameters:
x - The x-coordinate of the data elements in obj.
y - The y-coordinate of the data elements in obj.
obj - The primitive array containing the data elements to set.
data - The DataBuffer to store the data elements into.

setPixel

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

setPixels

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

setSample

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

setSample

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

setSample

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

setSamples

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

toString

public String toString()
Creates a String with some information about this SampleModel.
Overrides:
toString in interface Object
Returns:
A String describing this SampleModel.

Copyright (C) 2004, 2005, 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.