java.awt.image
Class SinglePixelPackedSampleModel
A
SampleModel
used when all samples are stored in a single
data element in the
DataBuffer
, and each data element contains
samples for one pixel only.
SampleModel | createCompatibleSampleModel(int w, int h) - Creates a new
SampleModel that is compatible with this
model and has the specified width and height.
|
DataBuffer | createDataBuffer() - Creates a DataBuffer for holding pixel data in the format and
layout described by this SampleModel.
|
SampleModel | createSubsetSampleModel(int[] bands) - Creates a new
SinglePixelPackedSampleModel that accesses
the specified subset of bands.
|
boolean | equals(Object obj) - Tests this sample model for equality with an arbitrary object.
|
int[] | getBitMasks()
|
int[] | getBitOffsets()
|
Object | getDataElements(int x, int y, Object obj, DataBuffer data)
|
int | getNumDataElements() - Returns the number of data elements.
|
int | getOffset(int x, int y) - Returns the index in the data buffer that stores the pixel at (x, y).
|
int[] | getPixel(int x, int y, int[] iArray, DataBuffer data) - Returns an array containing the samples for the pixel at (x, y) in the
specified data buffer.
|
int[] | getPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data) - Returns an array containing the samples for the pixels in the region
specified by (x, y, w, h) in the specified data buffer.
|
int | getSample(int x, int y, int b, DataBuffer data) - Returns the sample value for the pixel at (x, y) in the specified data
buffer.
|
int[] | getSampleSize() - Returns an array containing the size (in bits) for each band accessed by
the
SampleModel .
|
int | getSampleSize(int band) - Returns the size (in bits) of the samples for the specified band.
|
int | getScanlineStride() - Returns the number of data elements from a pixel in one row to the
corresponding pixel in the next row.
|
int | hashCode() - Returns a hash code for this
SinglePixelPackedSampleModel .
|
void | setDataElements(int x, int y, Object obj, DataBuffer data)
|
void | setPixel(int x, int y, int[] iArray, DataBuffer data) - Sets the samples for the pixel at (x, y) in the specified data buffer to
the specified values.
|
void | setPixels(int x, int y, int w, int h, int[] iArray, DataBuffer data) - This method implements a more efficient way to set pixels than the default
implementation of the super class.
|
void | setSample(int x, int y, int b, int s, DataBuffer data) - Sets the sample value for a band for the pixel at (x, y) in the
specified data buffer.
|
String | toString() - Creates a String with some information about this 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 |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
SinglePixelPackedSampleModel
public SinglePixelPackedSampleModel(int dataType,
int w,
int h,
int scanlineStride,
int[] bitMasks)
Creates a new SinglePixelPackedSampleModel
.
dataType
- the data buffer type.w
- the width (in pixels).h
- the height (in pixels).scanlineStride
- the number of data elements between a pixel on one
row and the corresponding pixel on the next row.bitMasks
- an array containing the bit mask used to extract the
sample value for each band.
SinglePixelPackedSampleModel
public SinglePixelPackedSampleModel(int dataType,
int w,
int h,
int[] bitMasks)
Creates a new SinglePixelPackedSampleModel
.
dataType
- the data buffer type.w
- the width (in pixels).h
- the height (in pixels).bitMasks
- an array containing the bit mask used to extract the
sample value for each band.
equals
public boolean equals(Object obj)
Tests this sample model for equality with an arbitrary object. This
method returns
true
if and only if:
obj
is not null
;
obj
is an instance of
SinglePixelPackedSampleModel
;
- both models have the same:
dataType
;
width
;
height
;
numBands
;
scanlineStride
;
bitMasks
;
bitOffsets
.
- equals in interface Object
obj
- the object (null
permitted)
true
if this model is equal to obj
, and
false
otherwise.
getOffset
public int getOffset(int x,
int y)
Returns the index in the data buffer that stores the pixel at (x, y).
x
- the x-coordinate.y
- the y-coordinate.
- The index in the data buffer that stores the pixel at (x, y).
getPixel
public int[] getPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Returns an array containing the samples for the pixel at (x, y) in the
specified data buffer. If iArray
is not null
,
it will be populated with the sample values and returned as the result of
this function (this avoids allocating a new array instance).
- getPixel in interface SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.iArray
- an array to populate with the sample values and return as
the result (if null
, a new array will be allocated).data
- the data buffer (null
not permitted).
getPixels
public int[] getPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
Returns an array containing the samples for the pixels in the region
specified by (x, y, w, h) in the specified data buffer. The array is
ordered by pixels (that is, all the samples for the first pixel are
grouped together, followed by all the samples for the second pixel, and so
on). If iArray
is not null
, it will be
populated with the sample values and returned as the result of this
function (this avoids allocating a new array instance).
- getPixels in interface SampleModel
x
- the x-coordinate of the top-left pixel.y
- the y-coordinate of the top-left pixel.w
- the width of the region of pixels.h
- the height of the region of pixels.iArray
- an array to populate with the sample values and return as
the result (if null
, a new array will be allocated).data
- the data buffer (null
not permitted).
getSample
public int getSample(int x,
int y,
int b,
DataBuffer data)
Returns the sample value for the pixel at (x, y) in the specified data
buffer.
- getSample in interface SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range 0
to
getNumBands() - 1
).data
- the data buffer (null
not permitted).
getSampleSize
public int getSampleSize(int band)
Returns the size (in bits) of the samples for the specified band.
- getSampleSize in interface SampleModel
band
- the band (in the range 0
to
getNumBands() - 1
).
- The sample size (in bits).
getScanlineStride
public int getScanlineStride()
Returns the number of data elements from a pixel in one row to the
corresponding pixel in the next row.
hashCode
public int hashCode()
Returns a hash code for this SinglePixelPackedSampleModel
.
- hashCode in interface Object
setPixel
public void setPixel(int x,
int y,
int[] iArray,
DataBuffer data)
Sets the samples for the pixel at (x, y) in the specified data buffer to
the specified values.
- setPixel in interface SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.iArray
- the sample values (null
not permitted).data
- the data buffer (null
not permitted).
setPixels
public void setPixels(int x,
int y,
int w,
int h,
int[] iArray,
DataBuffer data)
This method implements a more efficient way to set pixels than the default
implementation of the super class. It copies the pixel components directly
from the input array instead of creating a intermediate buffer.
- setPixels in interface SampleModel
x
- The x-coordinate of the pixel rectangle in obj
.y
- The y-coordinate of the pixel rectangle in obj
.w
- The width of the pixel rectangle in obj
.h
- The height of the pixel rectangle in obj
.iArray
- The primitive array containing the pixels to set.data
- The DataBuffer to store the pixels into.
setSample
public void setSample(int x,
int y,
int b,
int s,
DataBuffer data)
Sets the sample value for a band for the pixel at (x, y) in the
specified data buffer.
- setSample in interface SampleModel
x
- the x-coordinate of the pixel.y
- the y-coordinate of the pixel.b
- the band (in the range 0
to
getNumBands() - 1
).s
- the sample value.data
- the data buffer (null
not permitted).
toString
public String toString()
Creates a String with some information about this SampleModel.
- toString in interface Object
- A String describing this SampleModel.
Copyright (C) 2000, 2002, 2003, 2004, 2006, 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.