java.awt.image

Class SampleModel

Known Direct Subclasses:
ComponentSampleModel, MultiPixelPackedSampleModel, SinglePixelPackedSampleModel

public abstract class SampleModel
extends Object

Field Summary

protected int
dataType
The DataBuffer type that is used to store the data of the image described.
protected int
height
Height of image described.
protected int
numBands
Number of bands in the image described.
protected int
width
Width of image described.

Constructor Summary

SampleModel(int dataType, int w, int h, int numBands)

Method Summary

abstract SampleModel
createCompatibleSampleModel(int w, int h)
abstract DataBuffer
createDataBuffer()
abstract SampleModel
createSubsetSampleModel(int[] bands)
Return a SampleModel with a subset of the bands in this model.
Object
getDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
abstract Object
getDataElements(int x, int y, Object obj, DataBuffer data)
This method is provided as a faster alternative to getPixel(), that can be used when there is no need to decode the pixel into separate sample values.
int
getDataType()
int
getHeight()
int
getNumBands()
abstract int
getNumDataElements()
double[]
getPixel(int x, int y, double[] dArray, DataBuffer data)
float[]
getPixel(int x, int y, float[] fArray, DataBuffer data)
int[]
getPixel(int x, int y, int[] iArray, DataBuffer data)
double[]
getPixels(int x, int y, int w, int h, double[] dArray, DataBuffer data)
float[]
getPixels(int x, int y, int w, int h, float[] fArray, DataBuffer data)
int[]
getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data)
abstract 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)
abstract int[]
getSampleSize()
abstract int
getSampleSize(int band)
double[]
getSamples(int x, int y, int w, int h, int b, double[] dArray, DataBuffer data)
float[]
getSamples(int x, int y, int w, int h, int b, float[] fArray, DataBuffer data)
int[]
getSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)
int
getTransferType()
int
getWidth()
void
setDataElements(int x, int y, int w, int h, Object obj, DataBuffer data)
abstract void
setDataElements(int x, int y, Object obj, DataBuffer data)
void
setPixel(int x, int y, double[] dArray, DataBuffer data)
void
setPixel(int x, int y, float[] fArray, DataBuffer data)
void
setPixel(int x, int y, int[] iArray, DataBuffer data)
void
setPixels(int x, int y, int w, int h, double[] dArray, DataBuffer data)
void
setPixels(int x, int y, int w, int h, float[] fArray, 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)
abstract void
setSample(int x, int y, int b, int s, DataBuffer data)
void
setSamples(int x, int y, int w, int h, int b, double[] dArray, DataBuffer data)
void
setSamples(int x, int y, int w, int h, int b, float[] fArray, DataBuffer data)
void
setSamples(int x, int y, int w, int h, int b, int[] iArray, DataBuffer data)

Methods inherited from class java.lang.Object

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

Field Details

dataType

protected int dataType
The DataBuffer type that is used to store the data of the image described.

height

protected int height
Height of image described.

numBands

protected int numBands
Number of bands in the image described. Package-private here, shadowed by ComponentSampleModel.

width

protected int width
Width of image described.

Constructor Details

SampleModel

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

Method Details

createCompatibleSampleModel

public abstract SampleModel createCompatibleSampleModel(int w,
                                                        int h)

createDataBuffer

public abstract DataBuffer createDataBuffer()

createSubsetSampleModel

public abstract SampleModel createSubsetSampleModel(int[] bands)
Return a SampleModel with a subset of the bands in this model. Selects bands.length bands from this sample model. The bands chosen are specified in the indices of bands[]. This also permits permuting the bands as well as taking a subset. Thus, giving an array with 1, 2, 3, ..., numbands, will give an identical sample model.
Parameters:
bands - Array with band indices to include.
Returns:
A new sample model

getDataElements

public Object getDataElements(int x,
                              int y,
                              int w,
                              int h,
                              Object obj,
                              DataBuffer data)

getDataElements

public abstract Object getDataElements(int x,
                                       int y,
                                       Object obj,
                                       DataBuffer data)
This method is provided as a faster alternative to getPixel(), that can be used when there is no need to decode the pixel into separate sample values.
Parameters:
obj - An array to return the pixel data in. If null, an array of the right type and size will be created.
Returns:
A single pixel as an array object of a primitive type, based on the transfer type. Eg. if transfer type is DataBuffer.TYPE_USHORT, then a short[] object is returned.

getDataType

public final int getDataType()

getHeight

public final int getHeight()

getNumBands

public final int getNumBands()

getNumDataElements

public abstract int getNumDataElements()

getPixel

public double[] getPixel(int x,
                         int y,
                         double[] dArray,
                         DataBuffer data)

getPixel

public float[] getPixel(int x,
                        int y,
                        float[] fArray,
                        DataBuffer data)

getPixel

public int[] getPixel(int x,
                      int y,
                      int[] iArray,
                      DataBuffer data)

getPixels

public double[] getPixels(int x,
                          int y,
                          int w,
                          int h,
                          double[] dArray,
                          DataBuffer data)

getPixels

public float[] getPixels(int x,
                         int y,
                         int w,
                         int h,
                         float[] fArray,
                         DataBuffer data)

getPixels

public int[] getPixels(int x,
                       int y,
                       int w,
                       int h,
                       int[] iArray,
                       DataBuffer data)

getSample

public abstract int getSample(int x,
                              int y,
                              int b,
                              DataBuffer data)

getSampleDouble

public double getSampleDouble(int x,
                              int y,
                              int b,
                              DataBuffer data)

getSampleFloat

public float getSampleFloat(int x,
                            int y,
                            int b,
                            DataBuffer data)

getSampleSize

public abstract int[] getSampleSize()

getSampleSize

public abstract int getSampleSize(int band)

getSamples

public double[] getSamples(int x,
                           int y,
                           int w,
                           int h,
                           int b,
                           double[] dArray,
                           DataBuffer data)

getSamples

public float[] getSamples(int x,
                          int y,
                          int w,
                          int h,
                          int b,
                          float[] fArray,
                          DataBuffer data)

getSamples

public int[] getSamples(int x,
                        int y,
                        int w,
                        int h,
                        int b,
                        int[] iArray,
                        DataBuffer data)

getTransferType

public int getTransferType()

getWidth

public final int getWidth()

setDataElements

public void setDataElements(int x,
                            int y,
                            int w,
                            int h,
                            Object obj,
                            DataBuffer data)

setDataElements

public abstract void setDataElements(int x,
                                     int y,
                                     Object obj,
                                     DataBuffer data)

setPixel

public void setPixel(int x,
                     int y,
                     double[] dArray,
                     DataBuffer data)

setPixel

public void setPixel(int x,
                     int y,
                     float[] fArray,
                     DataBuffer data)

setPixel

public void setPixel(int x,
                     int y,
                     int[] iArray,
                     DataBuffer data)

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      double[] dArray,
                      DataBuffer data)

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      float[] fArray,
                      DataBuffer data)

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      int[] iArray,
                      DataBuffer data)

setSample

public void setSample(int x,
                      int y,
                      int b,
                      double s,
                      DataBuffer data)

setSample

public void setSample(int x,
                      int y,
                      int b,
                      float s,
                      DataBuffer data)

setSample

public abstract void setSample(int x,
                               int y,
                               int b,
                               int s,
                               DataBuffer data)

setSamples

public void setSamples(int x,
                       int y,
                       int w,
                       int h,
                       int b,
                       double[] dArray,
                       DataBuffer data)

setSamples

public void setSamples(int x,
                       int y,
                       int w,
                       int h,
                       int b,
                       float[] fArray,
                       DataBuffer data)

setSamples

public void setSamples(int x,
                       int y,
                       int w,
                       int h,
                       int b,
                       int[] iArray,
                       DataBuffer data)

Copyright (C) 2000, 2001, 2002, 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.