org.geotoolkit.image
Class SampleModels

Object
  extended by Static
      extended by SampleModels

public final class SampleModels
extends Static

A set of static methods working on SampleModel.

Since:
3.07
Version:
3.07
Author:
Martin Desruisseaux (Geomatys)
Module:
coverage/geotk-coverage (download)    View source code for this class

Method Summary
static int getDataTypeSize(SampleModel model)
          Returns the size (in bits) of the data type for the given sample model.
static int getPixelBitStride(SampleModel model)
          Returns the pixel stride of the given sample model in bits.
static float getPixelStride(SampleModel model)
          Returns the pixel stride of the given sample model.
static int getScanlineStride(SampleModel model)
          Returns the scan line stride of the given sample model.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDataTypeSize

public static int getDataTypeSize(SampleModel model)
Returns the size (in bits) of the data type for the given sample model. This is a convenience method for:
return DataBuffer.getDataTypeSize(model.getDataType());

Parameters:
model - The sample model for which to get the size of data type.
Returns:
The size of data type, in bits.
See Also:
DataBuffer.getDataTypeSize(int)

getScanlineStride

public static int getScanlineStride(SampleModel model)
                             throws IllegalArgumentException
Returns the scan line stride of the given sample model. The 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.

Parameters:
model - The sample model from which to get the scan line stride.
Returns:
The scan line stride.
Throws:
IllegalArgumentException - If the given model is not of a known type.

getPixelStride

public static float getPixelStride(SampleModel model)
                            throws IllegalArgumentException
Returns the pixel stride of the given sample model. The pixel stride is the number of data array elements between two samples for the same band on the same scanline.

If the given model is an instance of MultiPixelPackedSampleModel, then the stride can be fractional. Note that the returned value still exact since the ratio of an integer with a power of 2 has exact representations in IEEE 754.

Parameters:
model - The sample model from which to get the pixel stride.
Returns:
The pixel stride, rounded toward positive infinity if necessary.
Throws:
IllegalArgumentException - If the given model is not of a known type.

getPixelBitStride

public static int getPixelBitStride(SampleModel model)
                             throws IllegalArgumentException
Returns the pixel stride of the given sample model in bits. This is the number of bits between two samples for the same band on the same scanline.

Parameters:
model - The sample model from which to get the pixel stride.
Returns:
The pixel stride in bits.
Throws:
IllegalArgumentException - If the given model is not of a known type.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.