Liking cljdoc? Tell your friends :D

jdk.awt.image.SinglePixelPackedSampleModel

This class represents pixel data packed such that the N samples which make up a single pixel are stored in a single data array element, and each data data array element holds samples for only one pixel. This class supports TYPE_BYTE, TYPE_USHORT, TYPE_INT data types. All data array elements reside in the first bank of a DataBuffer. Accessor methods are provided so that the image data can be manipulated directly. Scanline stride is the number of data array elements between a given sample and the corresponding sample in the same column of the next scanline. Bit masks are the masks required to extract the samples representing the bands of the pixel. Bit offsets are the offsets in bits into the data array element of the samples representing the bands of the pixel.

The following code illustrates extracting the bits of the sample representing band b for pixel x,y from DataBuffer data:

 int sample = data.getElem(y * scanlineStride  x);
 sample = (sample & bitMasks[b]) >>> bitOffsets[b];
This class represents pixel data packed such that the N samples which make
 up a single pixel are stored in a single data array element, and each data
 data array element holds samples for only one pixel.
 This class supports
 TYPE_BYTE,
 TYPE_USHORT,
 TYPE_INT data types.
 All data array elements reside
 in the first bank of a DataBuffer.  Accessor methods are provided so
 that the image data can be manipulated directly. Scanline stride is the
 number of data array elements between a given sample and the corresponding
 sample in the same column of the next scanline. Bit masks are the masks
 required to extract the samples representing the bands of the pixel.
 Bit offsets are the offsets in bits into the data array
 element of the samples representing the bands of the pixel.

The following code illustrates extracting the bits of the sample
representing band b for pixel x,y
from DataBuffer data:


     int sample = data.getElem(y * scanlineStride  x);
     sample = (sample & bitMasks[b]) >>> bitOffsets[b];
raw docstring

->single-pixel-packed-sample-modelclj

(->single-pixel-packed-sample-model data-type w h bit-masks)
(->single-pixel-packed-sample-model data-type w h scanline-stride bit-masks)

Constructor.

Constructs a SinglePixelPackedSampleModel with bitMasks.length bands and a scanline stride equal to scanlineStride data array elements. Each sample is stored in a data array element in the position of its corresponding bit mask. Each bit mask must be contiguous and masks must not overlap. Bit masks exceeding data type capacity are truncated.

data-type - The data type for storing samples. - int w - The width (in pixels) of the region of image data described. - int h - The height (in pixels) of the region of image data described. - int scanline-stride - The line stride of the image data. - int bit-masks - The bit masks for all bands. - int[]

throws: java.lang.IllegalArgumentException - if dataType is not either DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT

Constructor.

Constructs a SinglePixelPackedSampleModel with bitMasks.length bands
 and a scanline stride equal to scanlineStride data array elements.
 Each sample is stored in a data array element in the position of
 its corresponding bit mask.  Each bit mask must be contiguous and
 masks must not overlap. Bit masks exceeding data type capacity are
 truncated.

data-type - The data type for storing samples. - `int`
w - The width (in pixels) of the region of image data described. - `int`
h - The height (in pixels) of the region of image data described. - `int`
scanline-stride - The line stride of the image data. - `int`
bit-masks - The bit masks for all bands. - `int[]`

throws: java.lang.IllegalArgumentException - if dataType is not either DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or DataBuffer.TYPE_INT
raw docstring

create-compatible-sample-modelclj

(create-compatible-sample-model this w h)

Creates a new SinglePixelPackedSampleModel with the specified width and height. The new SinglePixelPackedSampleModel will have the same storage data type and bit masks as this SinglePixelPackedSampleModel.

w - the width of the resulting SampleModel - int h - the height of the resulting SampleModel - int

returns: a SinglePixelPackedSampleModel with the specified width and height. - java.awt.image.SampleModel

throws: java.lang.IllegalArgumentException - if w or h is not greater than 0

Creates a new SinglePixelPackedSampleModel with the specified
 width and height.  The new SinglePixelPackedSampleModel will have the
 same storage data type and bit masks as this
 SinglePixelPackedSampleModel.

w - the width of the resulting SampleModel - `int`
h - the height of the resulting SampleModel - `int`

returns: a SinglePixelPackedSampleModel with the
         specified width and height. - `java.awt.image.SampleModel`

throws: java.lang.IllegalArgumentException - if w or h is not greater than 0
raw docstring

create-data-bufferclj

(create-data-buffer this)

Creates a DataBuffer that corresponds to this SinglePixelPackedSampleModel. The DataBuffer's data type and size will be consistent with this SinglePixelPackedSampleModel. The DataBuffer will have a single bank.

returns: a DataBuffer corresponding to this SampleModel. - java.awt.image.DataBuffer

Creates a DataBuffer that corresponds to this
 SinglePixelPackedSampleModel.  The DataBuffer's data type and size
 will be consistent with this SinglePixelPackedSampleModel.  The
 DataBuffer will have a single bank.

returns: a DataBuffer corresponding to this
         SampleModel. - `java.awt.image.DataBuffer`
raw docstring

create-subset-sample-modelclj

(create-subset-sample-model this bands)

This creates a new SinglePixelPackedSampleModel with a subset of the bands of this SinglePixelPackedSampleModel. The new SinglePixelPackedSampleModel can be used with any DataBuffer that the existing SinglePixelPackedSampleModel can be used with. The new SinglePixelPackedSampleModel/DataBuffer combination will represent an image with a subset of the bands of the original SinglePixelPackedSampleModel/DataBuffer combination.

bands - the subset of bands of this SampleModel - int[]

returns: a SampleModel with a subset of bands of this SampleModel. - java.awt.image.SampleModel

throws: java.awt.image.RasterFormatException - if the length of the bands argument is greater than the number of bands in the sample model.

This creates a new SinglePixelPackedSampleModel with a subset of the
 bands of this SinglePixelPackedSampleModel.  The new
 SinglePixelPackedSampleModel can be used with any DataBuffer that the
 existing SinglePixelPackedSampleModel can be used with.  The new
 SinglePixelPackedSampleModel/DataBuffer combination will represent
 an image with a subset of the bands of the original
 SinglePixelPackedSampleModel/DataBuffer combination.

bands - the subset of bands of this SampleModel - `int[]`

returns: a SampleModel with a subset of bands of this
         SampleModel. - `java.awt.image.SampleModel`

throws: java.awt.image.RasterFormatException - if the length of the bands argument is greater than the number of bands in the sample model.
raw docstring

equalsclj

(equals this o)

Description copied from class: Object

o - the reference object with which to compare. - java.lang.Object

returns: true if this object is the same as the obj argument; false otherwise. - boolean

Description copied from class: Object

o - the reference object with which to compare. - `java.lang.Object`

returns: true if this object is the same as the obj
          argument; false otherwise. - `boolean`
raw docstring

get-bit-masksclj

(get-bit-masks this)

Returns the bit masks for all bands.

returns: the bit masks for all bands. - int[]

Returns the bit masks for all bands.

returns: the bit masks for all bands. - `int[]`
raw docstring

get-bit-offsetsclj

(get-bit-offsets this)

Returns the bit offsets into the data array element representing a pixel for all bands.

returns: the bit offsets representing a pixel for all bands. - int[]

Returns the bit offsets into the data array element representing
  a pixel for all bands.

returns: the bit offsets representing a pixel for all bands. - `int[]`
raw docstring

get-data-elementsclj

(get-data-elements this x y obj data)

Returns data for a single pixel in a primitive array of type TransferType. For a SinglePixelPackedSampleModel, the array will have one element, and the type will be the same as the storage data type. Generally, obj should be passed in as null, so that the Object will be created automatically and will be of the right primitive data type.

The following code illustrates transferring data for one pixel from DataBuffer db1, whose storage layout is described by SinglePixelPackedSampleModel sppsm1, to DataBuffer db2, whose storage layout is described by SinglePixelPackedSampleModel sppsm2. The transfer will generally be more efficient than using getPixel/setPixel.

   SinglePixelPackedSampleModel sppsm1, sppsm2;
   DataBufferInt db1, db2;
   sppsm2.setDataElements(x, y, sppsm1.getDataElements(x, y, null,
                          db1), db2);

Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.

If obj is non-null, it should be a primitive array of type TransferType. Otherwise, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if obj is non-null and is not large enough to hold the pixel data.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int obj - If non-null, a primitive array in which to return the pixel data. - java.lang.Object data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

returns: the data for the specified pixel. - java.lang.Object

Returns data for a single pixel in a primitive array of type
 TransferType.  For a SinglePixelPackedSampleModel, the array will
 have one element, and the type will be the same as the storage
 data type.  Generally, obj
 should be passed in as null, so that the Object will be created
 automatically and will be of the right primitive data type.

 The following code illustrates transferring data for one pixel from
 DataBuffer db1, whose storage layout is described by
 SinglePixelPackedSampleModel sppsm1, to
 DataBuffer db2, whose storage layout is described by
 SinglePixelPackedSampleModel sppsm2.
 The transfer will generally be more efficient than using
 getPixel/setPixel.


       SinglePixelPackedSampleModel sppsm1, sppsm2;
       DataBufferInt db1, db2;
       sppsm2.setDataElements(x, y, sppsm1.getDataElements(x, y, null,
                              db1), db2);
 Using getDataElements/setDataElements to transfer between two
 DataBuffer/SampleModel pairs is legitimate if the SampleModels have
 the same number of bands, corresponding bands have the same number of
 bits per sample, and the TransferTypes are the same.

 If obj is non-null, it should be a primitive array of type TransferType.
 Otherwise, a ClassCastException is thrown.  An
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds, or if obj is non-null and is not large enough to hold
 the pixel data.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
obj - If non-null, a primitive array in which to return the pixel data. - `java.lang.Object`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`

returns: the data for the specified pixel. - `java.lang.Object`
raw docstring

get-num-data-elementsclj

(get-num-data-elements this)

Returns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods. For a SinglePixelPackedSampleModel, this is one.

returns: the number of data elements. - int

Returns the number of data elements needed to transfer one pixel
 via the getDataElements and setDataElements methods.
 For a SinglePixelPackedSampleModel, this is one.

returns: the number of data elements. - `int`
raw docstring

get-offsetclj

(get-offset this x y)

Returns the offset (in data array elements) of pixel (x,y). The data element containing pixel x,y can be retrieved from a DataBuffer data with a SinglePixelPackedSampleModel sppsm as:

    data.getElem(sppsm.getOffset(x, y));

x - the X coordinate of the specified pixel - int y - the Y coordinate of the specified pixel - int

returns: the offset of the specified pixel. - int

Returns the offset (in data array elements) of pixel (x,y).
  The data element containing pixel x,y
  can be retrieved from a DataBuffer data with a
  SinglePixelPackedSampleModel sppsm as:


        data.getElem(sppsm.getOffset(x, y));

x - the X coordinate of the specified pixel - `int`
y - the Y coordinate of the specified pixel - `int`

returns: the offset of the specified pixel. - `int`
raw docstring

get-pixelclj

(get-pixel this x y i-array data)

Returns all samples in for the specified pixel in an int array. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int i-array - If non-null, returns the samples in this array - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

returns: all samples for the specified pixel. - int[]

Returns all samples in for the specified pixel in an int array.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
i-array - If non-null, returns the samples in this array - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`

returns: all samples for the specified pixel. - `int[]`
raw docstring

get-pixelsclj

(get-pixels this x y w h i-array data)

Returns all samples for the specified rectangle of pixels in an int array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the upper left pixel location. - int y - The Y coordinate of the upper left pixel location. - int w - The width of the pixel rectangle. - int h - The height of the pixel rectangle. - int i-array - If non-null, returns the samples in this array. - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

returns: all samples for the specified region of pixels. - int[]

Returns all samples for the specified rectangle of pixels in
 an int array, one sample per array element.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the upper left pixel location. - `int`
y - The Y coordinate of the upper left pixel location. - `int`
w - The width of the pixel rectangle. - `int`
h - The height of the pixel rectangle. - `int`
i-array - If non-null, returns the samples in this array. - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`

returns: all samples for the specified region of pixels. - `int[]`
raw docstring

get-sampleclj

(get-sample this x y b data)

Returns as int the sample in a specified band for the pixel located at (x,y). ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int b - The band to return. - int data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

returns: the sample in a specified band for the specified pixel. - int

Returns as int the sample in a specified band for the pixel
 located at (x,y).
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
b - The band to return. - `int`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`

returns: the sample in a specified band for the specified
         pixel. - `int`
raw docstring

get-sample-sizeclj

(get-sample-size this)
(get-sample-size this band)

Returns the number of bits per sample for the specified band.

band - the specified band - int

returns: the size of the samples of the specified band. - int

Returns the number of bits per sample for the specified band.

band - the specified band - `int`

returns: the size of the samples of the specified band. - `int`
raw docstring

get-samplesclj

(get-samples this x y w h b i-array data)

Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the upper left pixel location. - int y - The Y coordinate of the upper left pixel location. - int w - The width of the pixel rectangle. - int h - The height of the pixel rectangle. - int b - The band to return. - int i-array - If non-null, returns the samples in this array. - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

returns: the samples for the specified band for the specified region of pixels. - int[]

Returns the samples for a specified band for the specified rectangle
 of pixels in an int array, one sample per array element.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the upper left pixel location. - `int`
y - The Y coordinate of the upper left pixel location. - `int`
w - The width of the pixel rectangle. - `int`
h - The height of the pixel rectangle. - `int`
b - The band to return. - `int`
i-array - If non-null, returns the samples in this array. - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`

returns: the samples for the specified band for the specified
         region of pixels. - `int[]`
raw docstring

get-scanline-strideclj

(get-scanline-stride this)

Returns the scanline stride of this SinglePixelPackedSampleModel.

returns: the scanline stride of this SinglePixelPackedSampleModel. - int

Returns the scanline stride of this SinglePixelPackedSampleModel.

returns: the scanline stride of this
          SinglePixelPackedSampleModel. - `int`
raw docstring

hash-codeclj

(hash-code this)

Description copied from class: Object

returns: a hash code value for this object. - int

Description copied from class: Object

returns: a hash code value for this object. - `int`
raw docstring

set-data-elementsclj

(set-data-elements this x y obj data)

Sets the data for a single pixel in the specified DataBuffer from a primitive array of type TransferType. For a SinglePixelPackedSampleModel, only the first element of the array will hold valid data, and the type of the array must be the same as the storage data type of the SinglePixelPackedSampleModel.

The following code illustrates transferring data for one pixel from DataBuffer db1, whose storage layout is described by SinglePixelPackedSampleModel sppsm1, to DataBuffer db2, whose storage layout is described by SinglePixelPackedSampleModel sppsm2. The transfer will generally be more efficient than using getPixel/setPixel.

   SinglePixelPackedSampleModel sppsm1, sppsm2;
   DataBufferInt db1, db2;
   sppsm2.setDataElements(x, y, sppsm1.getDataElements(x, y, null,
                          db1), db2);

Using getDataElements/setDataElements to transfer between two DataBuffer/SampleModel pairs is legitimate if the SampleModels have the same number of bands, corresponding bands have the same number of bits per sample, and the TransferTypes are the same.

obj must be a primitive array of type TransferType. Otherwise, a ClassCastException is thrown. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds, or if obj is not large enough to hold the pixel data.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int obj - A primitive array containing pixel data. - java.lang.Object data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

Sets the data for a single pixel in the specified DataBuffer from a
 primitive array of type TransferType.  For a
 SinglePixelPackedSampleModel, only the first element of the array
 will hold valid data, and the type of the array must be the same as
 the storage data type of the SinglePixelPackedSampleModel.

 The following code illustrates transferring data for one pixel from
 DataBuffer db1, whose storage layout is described by
 SinglePixelPackedSampleModel sppsm1,
 to DataBuffer db2, whose storage layout is described by
 SinglePixelPackedSampleModel sppsm2.
 The transfer will generally be more efficient than using
 getPixel/setPixel.


       SinglePixelPackedSampleModel sppsm1, sppsm2;
       DataBufferInt db1, db2;
       sppsm2.setDataElements(x, y, sppsm1.getDataElements(x, y, null,
                              db1), db2);
 Using getDataElements/setDataElements to transfer between two
 DataBuffer/SampleModel pairs is legitimate if the SampleModels have
 the same number of bands, corresponding bands have the same number of
 bits per sample, and the TransferTypes are the same.

 obj must be a primitive array of type TransferType.  Otherwise,
 a ClassCastException is thrown.  An
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds, or if obj is not large enough to hold the pixel data.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
obj - A primitive array containing pixel data. - `java.lang.Object`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`
raw docstring

set-pixelclj

(set-pixel this x y i-array data)

Sets a pixel in the DataBuffer using an int array of samples for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int i-array - The input samples in an int array. - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

Sets a pixel in the DataBuffer using an int array of samples for input.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
i-array - The input samples in an int array. - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`
raw docstring

set-pixelsclj

(set-pixels this x y w h i-array data)

Sets all samples for a rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the upper left pixel location. - int y - The Y coordinate of the upper left pixel location. - int w - The width of the pixel rectangle. - int h - The height of the pixel rectangle. - int i-array - The input samples in an int array. - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

Sets all samples for a rectangle of pixels from an int array containing
 one sample per array element.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the upper left pixel location. - `int`
y - The Y coordinate of the upper left pixel location. - `int`
w - The width of the pixel rectangle. - `int`
h - The height of the pixel rectangle. - `int`
i-array - The input samples in an int array. - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`
raw docstring

set-sampleclj

(set-sample this x y b s data)

Sets a sample in the specified band for the pixel located at (x,y) in the DataBuffer using an int for input. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the pixel location. - int y - The Y coordinate of the pixel location. - int b - The band to set. - int s - The input sample as an int. - int data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

Sets a sample in the specified band for the pixel located at (x,y)
 in the DataBuffer using an int for input.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the pixel location. - `int`
y - The Y coordinate of the pixel location. - `int`
b - The band to set. - `int`
s - The input sample as an int. - `int`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`
raw docstring

set-samplesclj

(set-samples this x y w h b i-array data)

Sets the samples in the specified band for the specified rectangle of pixels from an int array containing one sample per array element. ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

x - The X coordinate of the upper left pixel location. - int y - The Y coordinate of the upper left pixel location. - int w - The width of the pixel rectangle. - int h - The height of the pixel rectangle. - int b - The band to set. - int i-array - The input samples in an int array. - int[] data - The DataBuffer containing the image data. - java.awt.image.DataBuffer

Sets the samples in the specified band for the specified rectangle
 of pixels from an int array containing one sample per array element.
 ArrayIndexOutOfBoundsException may be thrown if the coordinates are
 not in bounds.

x - The X coordinate of the upper left pixel location. - `int`
y - The Y coordinate of the upper left pixel location. - `int`
w - The width of the pixel rectangle. - `int`
h - The height of the pixel rectangle. - `int`
b - The band to set. - `int`
i-array - The input samples in an int array. - `int[]`
data - The DataBuffer containing the image data. - `java.awt.image.DataBuffer`
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close