java.awt.image

Class Raster

Known Direct Subclasses:
WritableRaster

public class Raster
extends Object

A class representing a rectangular array of pixels. A Raster encapsulates a DataBuffer that stores the sample values and a SampleModel that describes how to locate a given sample value in a DataBuffer.

A Raster defines values for pixels occupying a particular rectangular area of the plane, not necessarily including (0, 0). The rectangle, known as the Raster's bounding rectangle and available by means of the getBounds method, is defined by minX, minY, width, and height values. The minX and minY values define the coordinate of the upper left corner of the Raster. References to pixels outside of the bounding rectangle may result in an exception being thrown, or may result in references to unintended elements of the Raster's associated DataBuffer. It is the user's responsibility to avoid accessing such pixels.

A SampleModel describes how samples of a Raster are stored in the primitive array elements of a DataBuffer. Samples may be stored one per data element, as in a PixelInterleavedSampleModel or BandedSampleModel, or packed several to an element, as in a SinglePixelPackedSampleModel or MultiPixelPackedSampleModel. The SampleModel is also controls whether samples are sign extended, allowing unsigned data to be stored in signed Java data types such as byte, short, and int.

Although a Raster may live anywhere in the plane, a SampleModel makes use of a simple coordinate system that starts at (0, 0). A Raster therefore contains a translation factor that allows pixel locations to be mapped between the Raster's coordinate system and that of the SampleModel. The translation from the SampleModel coordinate system to that of the Raster may be obtained by the getSampleModelTranslateX and getSampleModelTranslateY methods.

A Raster may share a DataBuffer with another Raster either by explicit construction or by the use of the createChild and createTranslatedChild methods. Rasters created by these methods can return a reference to the Raster they were created from by means of the getParent method. For a Raster that was not constructed by means of a call to createTranslatedChild or createChild, getParent will return null.

The createTranslatedChild method returns a new Raster that shares all of the data of the current Raster, but occupies a bounding rectangle of the same width and height but with a different starting point. For example, if the parent Raster occupied the region (10, 10) to (100, 100), and the translated Raster was defined to start at (50, 50), then pixel (20, 20) of the parent and pixel (60, 60) of the child occupy the same location in the DataBuffer shared by the two Rasters. In the first case, (-10, -10) should be added to a pixel coordinate to obtain the corresponding SampleModel coordinate, and in the second case (-50, -50) should be added.

The translation between a parent and child Raster may be determined by subtracting the child's sampleModelTranslateX and sampleModelTranslateY values from those of the parent.

The createChild method may be used to create a new Raster occupying only a subset of its parent's bounding rectangle (with the same or a translated coordinate system) or with a subset of the bands of its parent.

All constructors are protected. The correct way to create a Raster is to use one of the static create methods defined in this class. These methods create instances of Raster that use the standard Interleaved, Banded, and Packed SampleModels and that may be processed more efficiently than a Raster created by combining an externally generated SampleModel and DataBuffer.

See Also:
DataBuffer, SampleModel, PixelInterleavedSampleModel, BandedSampleModel, SinglePixelPackedSampleModel, MultiPixelPackedSampleModel

Field Summary

protected DataBuffer
dataBuffer
The DataBuffer that stores the image data.
protected int
height
The height of this Raster.
protected int
minX
The X coordinate of the upper-left pixel of this Raster.
protected int
minY
The Y coordinate of the upper-left pixel of this Raster.
protected int
numBands
The number of bands in the Raster.
protected int
numDataElements
The number of DataBuffer data elements per pixel.
protected Raster
parent
The parent of this Raster, or null.
protected SampleModel
sampleModel
The SampleModel that describes how pixels from this Raster are stored in the DataBuffer.
protected int
sampleModelTranslateX
The X translation from the coordinate space of the Raster's SampleModel to that of the Raster.
protected int
sampleModelTranslateY
The Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.
protected int
width
The width of this Raster.

Constructor Summary

Raster(SampleModel sampleModel, Point origin)
Constructs a Raster with the given SampleModel.
Raster(SampleModel sampleModel, DataBuffer dataBuffer, Point origin)
Constructs a Raster with the given SampleModel and DataBuffer.
Raster(SampleModel sampleModel, DataBuffer dataBuffer, Rectangle aRegion, Point sampleModelTranslate, Raster parent)
Constructs a Raster with the given SampleModel, DataBuffer, and parent.

Method Summary

static WritableRaster
createBandedRaster(int dataType, int w, int h, int scanlineStride, bankIndices[] , bandOffsets[] , Point location)
Creates a Raster based on a BandedSampleModel with the specified data type, width, height, scanline stride, bank indices and band offsets.
static WritableRaster
createBandedRaster(int dataType, int w, int h, int bands, Point location)
Creates a Raster based on a BandedSampleModel with the specified data type, width, height, and number of bands.
static WritableRaster
createBandedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, bankIndices[] , bandOffsets[] , Point location)
Creates a Raster based on a BandedSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets.
Raster
createChild(int parentX, int parentY, int width, int height, int childMinX, int childMinY, bandList[] )
Returns a new Raster which shares all or part of this Raster's DataBuffer.
WritableRaster
createCompatibleWritableRaster()
Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer.
WritableRaster
createCompatibleWritableRaster(int w, int h)
Create a compatible WritableRaster with the specified size, a new SampleModel, and a new initialized DataBuffer.
WritableRaster
createCompatibleWritableRaster(int x, int y, int w, int h)
Create a compatible WritableRaster with the specified location (minX, minY) and size (width, height), a new SampleModel, and a new initialized DataBuffer.
WritableRaster
createCompatibleWritableRaster(Rectangle rect)
Create a compatible WritableRaster with location (minX, minY) and size (width, height) specified by rect, a new SampleModel, and a new initialized DataBuffer.
static WritableRaster
createInterleavedRaster(int dataType, int w, int h, int scanlineStride, int pixelStride, bandOffsets[] , Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, scanline stride, pixel stride, and band offsets.
static WritableRaster
createInterleavedRaster(int dataType, int w, int h, int bands, Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, and number of bands.
static WritableRaster
createInterleavedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, int pixelStride, bandOffsets[] , Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets.
static WritableRaster
createPackedRaster(int dataType, int w, int h, bandMasks[] , Point location)
Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type, width, height, and band masks.
static WritableRaster
createPackedRaster(int dataType, int w, int h, int bands, int bitsPerBand, Point location)
Creates a Raster based on a packed SampleModel with the specified data type, width, height, number of bands, and bits per band.
static WritableRaster
createPackedRaster(DataBuffer dataBuffer, int w, int h, int scanlineStride, bandMasks[] , Point location)
Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks.
static WritableRaster
createPackedRaster(DataBuffer dataBuffer, int w, int h, int bitsPerPixel, Point location)
Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel.
static Raster
createRaster(SampleModel sm, DataBuffer db, Point location)
Creates a Raster with the specified SampleModel and DataBuffer.
Raster
createTranslatedChild(int childMinX, int childMinY)
Create a Raster with the same size, SampleModel and DataBuffer as this one, but with a different location.
static WritableRaster
createWritableRaster(SampleModel sm, Point location)
Creates a WritableRaster with the specified SampleModel.
static WritableRaster
createWritableRaster(SampleModel sm, DataBuffer db, Point location)
Creates a WritableRaster with the specified SampleModel and DataBuffer.
Rectangle
getBounds()
Returns the bounding Rectangle of this Raster.
DataBuffer
getDataBuffer()
Returns the DataBuffer associated with this Raster.
Object
getDataElements(int x, int y, int w, int h, Object outData)
Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType.
Object
getDataElements(int x, int y, Object outData)
Returns data for a single pixel in a primitive array of type TransferType.
int
getHeight()
Returns the height in pixels of the Raster.
int
getMinX()
Returns the minimum valid X coordinate of the Raster.
int
getMinY()
Returns the minimum valid Y coordinate of the Raster.
int
getNumBands()
Returns the number of bands (samples per pixel) in this Raster.
int
getNumDataElements()
Returns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods.
Raster
getParent()
Returns the parent Raster (if any) of this Raster or null.
double[]
getPixel(int x, int y, dArray[] )
Returns the samples in an array of double for the specified pixel.
float[]
getPixel(int x, int y, fArray[] )
Returns the samples in an array of float for the specified pixel.
int[]
getPixel(int x, int y, iArray[] )
Returns the samples in an array of int for the specified pixel.
double[]
getPixels(int x, int y, int w, int h, dArray[] )
Returns a double array containing all samples for a rectangle of pixels, one sample per array element.
float[]
getPixels(int x, int y, int w, int h, fArray[] )
Returns a float array containing all samples for a rectangle of pixels, one sample per array element.
int[]
getPixels(int x, int y, int w, int h, iArray[] )
Returns an int array containing all samples for a rectangle of pixels, one sample per array element.
int
getSample(int x, int y, int b)
Returns the sample in a specified band for the pixel located at (x,y) as an int.
double
getSampleDouble(int x, int y, int b)
Returns the sample in a specified band for a pixel located at (x,y) as a double.
float
getSampleFloat(int x, int y, int b)
Returns the sample in a specified band for the pixel located at (x,y) as a float.
SampleModel
getSampleModel()
Returns the SampleModel that describes the layout of the image data.
int
getSampleModelTranslateX()
Returns the X translation from the coordinate system of the SampleModel to that of the Raster.
int
getSampleModelTranslateY()
Returns the Y translation from the coordinate system of the SampleModel to that of the Raster.
double[]
getSamples(int x, int y, int w, int h, int b, dArray[] )
Returns the samples for a specified band for a specified rectangle of pixels in a double array, one sample per array element.
float[]
getSamples(int x, int y, int w, int h, int b, fArray[] )
Returns the samples for a specified band for the specified rectangle of pixels in a float array, one sample per array element.
int[]
getSamples(int x, int y, int w, int h, int b, iArray[] )
Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element.
int
getTransferType()
Returns the TransferType used to transfer pixels via the getDataElements and setDataElements methods.
int
getWidth()
Returns the width in pixels of the Raster.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

dataBuffer

protected DataBuffer dataBuffer
The DataBuffer that stores the image data.

height

protected int height
The height of this Raster.

minX

protected int minX
The X coordinate of the upper-left pixel of this Raster.

minY

protected int minY
The Y coordinate of the upper-left pixel of this Raster.

numBands

protected int numBands
The number of bands in the Raster.

numDataElements

protected int numDataElements
The number of DataBuffer data elements per pixel.

parent

protected Raster parent
The parent of this Raster, or null.

sampleModel

protected SampleModel sampleModel
The SampleModel that describes how pixels from this Raster are stored in the DataBuffer.

sampleModelTranslateX

protected int sampleModelTranslateX
The X translation from the coordinate space of the Raster's SampleModel to that of the Raster.

sampleModelTranslateY

protected int sampleModelTranslateY
The Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.

width

protected int width
The width of this Raster.

Constructor Details

Raster

protected Raster(SampleModel sampleModel,
                 Point origin)
Constructs a Raster with the given SampleModel. The Raster's upper left corner is origin and it is the same size as the SampleModel. A DataBuffer large enough to describe the Raster is automatically created.
Parameters:
sampleModel - The SampleModel that specifies the layout
origin - The Point that specified the origin
Throws:
RasterFormatException - if computing either origin.x + sampleModel.getWidth() or origin.y + sampleModel.getHeight() results in integer overflow
NullPointerException - either sampleModel or origin is null

Raster

protected Raster(SampleModel sampleModel,
                 DataBuffer dataBuffer,
                 Point origin)
Constructs a Raster with the given SampleModel and DataBuffer. The Raster's upper left corner is origin and it is the same size as the SampleModel. The DataBuffer is not initialized and must be compatible with SampleModel.
Parameters:
sampleModel - The SampleModel that specifies the layout
dataBuffer - The DataBuffer that contains the image data
origin - The Point that specifies the origin
Throws:
RasterFormatException - if computing either origin.x + sampleModel.getWidth() or origin.y + sampleModel.getHeight() results in integer overflow
NullPointerException - either sampleModel or origin is null

Raster

protected Raster(SampleModel sampleModel,
                 DataBuffer dataBuffer,
                 Rectangle aRegion,
                 Point sampleModelTranslate,
                 Raster parent)
Constructs a Raster with the given SampleModel, DataBuffer, and parent. aRegion specifies the bounding rectangle of the new Raster. When translated into the base Raster's coordinate system, aRegion must be contained by the base Raster. (The base Raster is the Raster's ancestor which has no parent.) sampleModelTranslate specifies the sampleModelTranslateX and sampleModelTranslateY values of the new Raster. Note that this constructor should generally be called by other constructors or create methods, it should not be used directly.
Parameters:
sampleModel - The SampleModel that specifies the layout
dataBuffer - The DataBuffer that contains the image data
aRegion - The Rectangle that specifies the image area
sampleModelTranslate - The Point that specifies the translation from SampleModel to Raster coordinates
parent - The parent (if any) of this raster
Throws:
NullPointerException - if any of sampleModel, dataBuffer, aRegion or sampleModelTranslate is null
RasterFormatException - if aRegion has width or height less than or equal to zero, or computing either aRegion.x + aRegion.width or aRegion.y + aRegion.height results in integer overflow

Method Details

createBandedRaster

public static WritableRaster createBandedRaster(int dataType,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                bankIndices[] ,
                                                bandOffsets[] ,
                                                Point location)
Creates a Raster based on a BandedSampleModel with the specified data type, width, height, scanline stride, bank indices and band offsets. The number of bands is inferred from bankIndices.length and bandOffsets.length, which must be the same.

The upper left corner of the Raster is given by the location argument. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT, and TYPE_INT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, scanline stride, bank indices and band offsets.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
ArrayIndexOutOfBoundsException - if bankIndices or bandOffsets is null

createBandedRaster

public static WritableRaster createBandedRaster(int dataType,
                                                int w,
                                                int h,
                                                int bands,
                                                Point location)
Creates a Raster based on a BandedSampleModel with the specified data type, width, height, and number of bands.

The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT, and TYPE_INT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height and number of bands.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
ArrayIndexOutOfBoundsException - if bands is less than 1
Usages and Demos :

View More Examples of createBandedRaster(int dataType,int w,int h,int bands,Point location)
   1: import java.util.Arrays;
   2: import java.awt.image.Raster;
   3: import java.awt.image.DataBuffer;
   4:         ...
   5:     public WritableRaster createCompatibleWritableRaster(final int width, final int height) {
   6:         return Raster.createBandedRaster(transferType, width, height, numBands, null);
   7:     }
   8:         ...
   9: 
  10:     public boolean isCompatibleRaster(final Raster raster) {
  11:         return isCompatibleSampleModel(raster.getSampleModel());

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5:     public WritableRaster createCompatibleWritableRaster(final int width, final int height) {
   6:         return Raster.createBandedRaster(transferType, width, height, numBands, null);
   7:     }
   8:         ...
   9: 
  10:     public boolean isCompatibleRaster(final Raster raster) {
  11:         return isCompatibleSampleModel(raster.getSampleModel());

View Full Code Here

createBandedRaster

public static WritableRaster createBandedRaster(DataBuffer dataBuffer,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                bankIndices[] ,
                                                bandOffsets[] ,
                                                Point location)
Creates a Raster based on a BandedSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets. The number of bands is inferred from bankIndices.length and bandOffsets.length, which must be the same. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, bank indices and band offsets.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
NullPointerException - if dataBuffer is null

createChild

public Raster createChild(int parentX,
                          int parentY,
                          int width,
                          int height,
                          int childMinX,
                          int childMinY,
                          bandList[] )
Returns a new Raster which shares all or part of this Raster's DataBuffer. The new Raster will possess a reference to the current Raster, accessible through its getParent() method.

The parentX, parentY, width and height parameters form a Rectangle in this Raster's coordinate space, indicating the area of pixels to be shared. An error will be thrown if this Rectangle is not contained with the bounds of the current Raster.

The new Raster may additionally be translated to a different coordinate system for the plane than that used by the current Raster. The childMinX and childMinY parameters give the new (x, y) coordinate of the upper-left pixel of the returned Raster; the coordinate (childMinX, childMinY) in the new Raster will map to the same pixel as the coordinate (parentX, parentY) in the current Raster.

The new Raster may be defined to contain only a subset of the bands of the current Raster, possibly reordered, by means of the bandList parameter. If bandList is null, it is taken to include all of the bands of the current Raster in their current order.

To create a new Raster that contains a subregion of the current Raster, but shares its coordinate system and bands, this method should be called with childMinX equal to parentX, childMinY equal to parentY, and bandList equal to null.

Parameters:
width - Width of the region starting at (parentX, parentY)
height - Height of the region starting at (parentX, parentY).
Returns:
a new Raster.
Throws:
RasterFormatException - if the specified subregion is outside of the raster bounds.
RasterFormatException - if width or height is less than or equal to zero, or computing any of parentX + width, parentY + height, childMinX + width, or childMinY + height results in integer overflow

createCompatibleWritableRaster

public WritableRaster createCompatibleWritableRaster()
Create a compatible WritableRaster the same size as this Raster with the same SampleModel and a new initialized DataBuffer.
Returns:
a compatible WritableRaster with the same sample model and a new data buffer.
Usages and Demos :

View More Examples of createCompatibleWritableRaster()
   1:           SampleModel sm = ri.getSampleModel();
   2:           Raster rast = ri.getData();
   3:         ...
   4:           WritableRaster ras = rast.createCompatibleWritableRaster();
   5:           ri.copyData(ras);
   6:           BufferedImage bi = new BufferedImage(cm, ras, false, null);
   7:           ImageIcon tn = new ImageIcon(bi);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9: 
  10:     public Rectangle2D getBounds2D(Raster src)
  11:     {
  12:         ...
  13: 
  14:         return src.createCompatibleWritableRaster();

View Full Code Here

createCompatibleWritableRaster

public WritableRaster createCompatibleWritableRaster(int w,
                                                     int h)
Create a compatible WritableRaster with the specified size, a new SampleModel, and a new initialized DataBuffer.
Parameters:
w - the specified width of the new WritableRaster
h - the specified height of the new WritableRaster
Returns:
a compatible WritableRaster with the specified size and a new sample model and data buffer.
Throws:
RasterFormatException - if the width or height is less than or equal to zero.

createCompatibleWritableRaster

public WritableRaster createCompatibleWritableRaster(int x,
                                                     int y,
                                                     int w,
                                                     int h)
Create a compatible WritableRaster with the specified location (minX, minY) and size (width, height), a new SampleModel, and a new initialized DataBuffer.
Parameters:
w - the specified width of the WritableRaster
h - the specified height of the WritableRaster
Returns:
a compatible WritableRaster with the specified size and location and a new sample model and data buffer.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either x + w or y + h results in integer overflow

createCompatibleWritableRaster

public WritableRaster createCompatibleWritableRaster(Rectangle rect)
Create a compatible WritableRaster with location (minX, minY) and size (width, height) specified by rect, a new SampleModel, and a new initialized DataBuffer.
Parameters:
rect - a Rectangle that specifies the size and location of the WritableRaster
Returns:
a compatible WritableRaster with the specified size and location and a new sample model and data buffer.
Throws:
RasterFormatException - if rect has width or height less than or equal to zero, or computing either rect.x + rect.width or rect.y + rect.height results in integer overflow
NullPointerException - if rect is null

createInterleavedRaster

public static WritableRaster createInterleavedRaster(int dataType,
                                                     int w,
                                                     int h,
                                                     int scanlineStride,
                                                     int pixelStride,
                                                     bandOffsets[] ,
                                                     Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, scanline stride, pixel stride, and band offsets. The number of bands is inferred from bandOffsets.length.

The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

Note that interleaved DataBuffer.TYPE_INT Rasters are not supported. To create a 1-band Raster of type DataBuffer.TYPE_INT, use Raster.createPackedRaster().

The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
pixelStride - the pixel stride of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, scanline stride, pixel stride and band offsets.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, or DataBuffer.TYPE_USHORT.

createInterleavedRaster

public static WritableRaster createInterleavedRaster(int dataType,
                                                     int w,
                                                     int h,
                                                     int bands,
                                                     Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified data type, width, height, and number of bands.

The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

Note that interleaved DataBuffer.TYPE_INT Rasters are not supported. To create a 1-band Raster of type DataBuffer.TYPE_INT, use Raster.createPackedRaster().

The only dataTypes supported currently are TYPE_BYTE and TYPE_USHORT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height and number of bands.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
Usages and Demos :

View More Examples of createInterleavedRaster(int dataType,int w,int h,int bands,Point location)
   1: import java.awt.image.DataBufferByte;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:         ByteBuffer imageBuffer = null;
   6:         WritableRaster raster;
   7:         BufferedImage texImage;
   8:         ...
   9:         if (bufferedImage.getColorModel().hasAlpha()) {
  10:             raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,texWidth,texHeight,4,null);
  11:         ...
  12:             texImage = new BufferedImage(glAlphaColorModel,raster,false,new Hashtable());

View Full Code Here
   1: import java.awt.image.DataBufferByte;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:         ByteBuffer imageBuffer = null; 
   6:         WritableRaster raster;
   7:         BufferedImage texImage;
   8:         ...
   9:         if (bufferedImage.getColorModel().hasAlpha()) {     
  10:             raster = Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,texWidth,texHeight,4,null);
  11:         ...
  12:             texImage = new BufferedImage(glAlphaColorModel,raster,false,new Hashtable());

View Full Code Here

createInterleavedRaster

public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer,
                                                     int w,
                                                     int h,
                                                     int scanlineStride,
                                                     int pixelStride,
                                                     bandOffsets[] ,
                                                     Point location)
Creates a Raster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets. The number of bands is inferred from bandOffsets.length. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.

Note that interleaved DataBuffer.TYPE_INT Rasters are not supported. To create a 1-band Raster of type DataBuffer.TYPE_INT, use Raster.createPackedRaster().

Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
pixelStride - the pixel stride of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, pixel stride and band offsets.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT
RasterFormatException - if dataBuffer has more than one bank.
NullPointerException - if dataBuffer is null

createPackedRaster

public static WritableRaster createPackedRaster(int dataType,
                                                int w,
                                                int h,
                                                bandMasks[] ,
                                                Point location)
Creates a Raster based on a SinglePixelPackedSampleModel with the specified data type, width, height, and band masks. The number of bands is inferred from bandMasks.length.

The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT, and TYPE_INT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, and band masks.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
Usages and Demos :

View More Examples of createPackedRaster(int dataType,int w,int h,bandMasks[] ,Point location)
   1:     DataBuffer db = new DataBufferByte(data, length);
   2:     WritableRaster wr = Raster.createPackedRaster(db, w, h, 1, null);
   3:     ColorModel cm = new IndexColorModel(1, 2,
   4:         new byte[] { (byte)0, (byte)255 },
   5:         new byte[] { (byte)0, (byte)255 },

View Full Code Here
   1: public class ByteRaster extends MeasuredImage implements Dimensioned, ByteLattice {
   2:   WritableRaster raster;
   3:   ColorModel colorModel;
   4:         ...
   5:     DataBuffer databuffer = new DataBufferByte(packedData, len);
   6:     raster = Raster.createPackedRaster(databuffer, nx, ny, 8, null);
   7:     colorModel = createColorModel();
   8:         ...
   9:     image = new BufferedImage(colorModel, raster, false, null);
  10:     xmin = 0;
  11:         ...
  12:     DataBuffer databuffer = new DataBufferByte(packedData, len);
  13:     raster = Raster.createPackedRaster(databuffer, nx, ny, 8, null);

View Full Code Here
   1:        DataBuffer db = new DataBufferByte(imageData, imageData.length);
   2:        WritableRaster r = Raster.createPackedRaster(db, w, h, pixelBits, null);
   3:        return new BufferedImage(cm, r, false, null);
   4:         ...
   5:        db = new DataBufferUShort(imageDataUShort, imageDataUShort.length);
   6:        wr = Raster.createPackedRaster(db, w, h, w, 
   7:                       new int[] {rMask16, gMask16, bMask16},
   8:         ...
   9:        db = new DataBufferInt(imageDataInt, imageDataInt.length);
  10:        wr = Raster.createPackedRaster(db, w, h, w, 
  11:                       new int[] {rMask32, gMask32, bMask32},

View Full Code Here
   1: public class BinaryLattice extends MeasuredImage implements ByteLattice {
   2:   WritableRaster raster;
   3:   Grid grid;
   4:         ...
   5:     DataBuffer databuffer = new DataBufferByte(packedData, len);
   6:     raster = Raster.createPackedRaster(databuffer, nx, ny, 1, null);
   7:     ColorModel colorModel = new IndexColorModel(1, 2, new byte[] {(byte) 255, (byte) 0}, new byte[] {(byte) 0, (byte) 0}, new byte[] {(byte) 0, (byte) 255});
   8:         ...
   9:     image = new BufferedImage(colorModel, raster, false, null);
  10:     xmin = 0;
  11:         ...
  12:     DataBuffer databuffer = new DataBufferByte(packedData, len);
  13:     raster = Raster.createPackedRaster(databuffer, nx, ny, 1, null);

View Full Code Here

createPackedRaster

public static WritableRaster createPackedRaster(int dataType,
                                                int w,
                                                int h,
                                                int bands,
                                                int bitsPerBand,
                                                Point location)
Creates a Raster based on a packed SampleModel with the specified data type, width, height, number of bands, and bits per band. If the number of bands is one, the SampleModel will be a MultiPixelPackedSampleModel.

If the number of bands is more than one, the SampleModel will be a SinglePixelPackedSampleModel, with each band having bitsPerBand bits. In either case, the requirements on dataType and bitsPerBand imposed by the corresponding SampleModel must be met.

The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used. The dataType parameter should be one of the enumerated values defined in the DataBuffer class.

The only dataTypes supported currently are TYPE_BYTE, TYPE_USHORT, and TYPE_INT.

Parameters:
dataType - the data type for storing samples
w - the width in pixels of the image data
h - the height in pixels of the image data
bands - the number of bands
bitsPerBand - the number of bits per band
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified data type, width, height, number of bands, and bits per band.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if the product of bitsPerBand and bands is greater than the number of bits held by dataType
IllegalArgumentException - if bitsPerBand or bands is not greater than zero
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT

createPackedRaster

public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
                                                int w,
                                                int h,
                                                int scanlineStride,
                                                bandMasks[] ,
                                                Point location)
Creates a Raster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks. The number of bands is inferred from bandMasks.length. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
scanlineStride - the line stride of the image data
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, scanline stride, and band masks.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
RasterFormatException - if dataBuffer has more than one bank.
NullPointerException - if dataBuffer is null

createPackedRaster

public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
                                                int w,
                                                int h,
                                                int bitsPerPixel,
                                                Point location)
Creates a Raster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
dataBuffer - the DataBuffer that contains the image data
w - the width in pixels of the image data
h - the height in pixels of the image data
bitsPerPixel - the number of bits for each pixel
location - the upper-left corner of the Raster
Returns:
a WritableRaster object with the specified DataBuffer, width, height, and bits per pixel.
Throws:
RasterFormatException - if w or h is less than or equal to zero, or computing either location.x + w or location.y + h results in integer overflow
IllegalArgumentException - if dataType is not one of the supported data types, which are DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT or DataBuffer.TYPE_INT
RasterFormatException - if dataBuffer has more than one bank.
NullPointerException - if dataBuffer is null
Usages and Demos :

View More Examples of createPackedRaster(DataBuffer dataBuffer,int w,int h,int bitsPerPixel,Point location)
   1:     DataBuffer db = new DataBufferByte(data, length);
   2:     WritableRaster wr = Raster.createPackedRaster(db, w, h, 1, null);
   3:     ColorModel cm = new IndexColorModel(1, 2,
   4:         new byte[] { (byte)0, (byte)255 },
   5:         new byte[] { (byte)0, (byte)255 },

View Full Code Here
   1: public class ByteRaster extends MeasuredImage implements Dimensioned, ByteLattice {
   2:   WritableRaster raster;
   3:   ColorModel colorModel;
   4:         ...
   5:     DataBuffer databuffer = new DataBufferByte(packedData, len);
   6:     raster = Raster.createPackedRaster(databuffer, nx, ny, 8, null);
   7:     colorModel = createColorModel();
   8:         ...
   9:     image = new BufferedImage(colorModel, raster, false, null);
  10:     xmin = 0;
  11:         ...
  12:     DataBuffer databuffer = new DataBufferByte(packedData, len);
  13:     raster = Raster.createPackedRaster(databuffer, nx, ny, 8, null);

View Full Code Here
   1:        DataBuffer db = new DataBufferByte(imageData, imageData.length);
   2:        WritableRaster r = Raster.createPackedRaster(db, w, h, pixelBits, null);
   3:        return new BufferedImage(cm, r, false, null);
   4:         ...
   5:        db = new DataBufferUShort(imageDataUShort, imageDataUShort.length);
   6:        wr = Raster.createPackedRaster(db, w, h, w, 
   7:                       new int[] {rMask16, gMask16, bMask16},
   8:         ...
   9:        db = new DataBufferInt(imageDataInt, imageDataInt.length);
  10:        wr = Raster.createPackedRaster(db, w, h, w, 
  11:                       new int[] {rMask32, gMask32, bMask32},

View Full Code Here
   1: public class BinaryLattice extends MeasuredImage implements ByteLattice {
   2:   WritableRaster raster;
   3:   Grid grid;
   4:         ...
   5:     DataBuffer databuffer = new DataBufferByte(packedData, len);
   6:     raster = Raster.createPackedRaster(databuffer, nx, ny, 1, null);
   7:     ColorModel colorModel = new IndexColorModel(1, 2, new byte[] {(byte) 255, (byte) 0}, new byte[] {(byte) 0, (byte) 0}, new byte[] {(byte) 0, (byte) 255});
   8:         ...
   9:     image = new BufferedImage(colorModel, raster, false, null);
  10:     xmin = 0;
  11:         ...
  12:     DataBuffer databuffer = new DataBufferByte(packedData, len);
  13:     raster = Raster.createPackedRaster(databuffer, nx, ny, 1, null);

View Full Code Here

createRaster

public static Raster createRaster(SampleModel sm,
                                  DataBuffer db,
                                  Point location)
Creates a Raster with the specified SampleModel and DataBuffer. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
sm - the specified SampleModel
db - the specified DataBuffer
location - the upper-left corner of the Raster
Returns:
a Raster with the specified SampleModel, DataBuffer, and location.
Throws:
RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow
RasterFormatException - if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel, SinglePixelPackedSampleModel, or MultiPixelPackedSampleModel.
NullPointerException - if either SampleModel or DataBuffer is null
Usages and Demos :

View More Examples of createRaster(SampleModel sm,DataBuffer db,Point location)
   1: import java.awt.image.TileObserver;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private transient Raster[] pendings;
   7:    
   8:         ...
   9: 
  10:     public synchronized Raster getTile(final int tileX, final int tileY) {
  11:         if (requests == null) {
  12:         ...
  13:         final DataBuffer buffer = getDefaultDataBuffer(sampleModel, colorModel);
  14:         final Raster     raster = Raster.createRaster(sampleModel, buffer, origin);

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterFormatException;
   4:         ...
   5: 
   6:     private transient Raster[] pendings;
   7:    
   8:         ...
   9: 
  10:     public synchronized Raster getTile(final int tileX, final int tileY) {
  11:         if (requests == null) {
  12:         ...
  13:         final DataBuffer buffer = getDefaultDataBuffer(sampleModel, colorModel);
  14:         final Raster     raster = Raster.createRaster(sampleModel, buffer, origin);

View Full Code Here

createTranslatedChild

public Raster createTranslatedChild(int childMinX,
                                    int childMinY)
Create a Raster with the same size, SampleModel and DataBuffer as this one, but with a different location. The new Raster will possess a reference to the current Raster, accessible through its getParent() method.
Parameters:
Returns:
a new Raster with the same size, SampleModel, and DataBuffer as this Raster, but with the specified location.
Throws:
RasterFormatException - if computing either childMinX + this.getWidth() or childMinY + this.getHeight() results in integer overflow
Usages and Demos :

View More Examples of createTranslatedChild(int childMinX,int childMinY)
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:     private static final Raster decodeJPEG(byte[] data,
   7:                                            JPEGDecodeParam decodeParam,
   8:         ...
   9: 
  10:         Raster jpegRaster;
  11:         try {
  12:         ...
  13: 
  14:         return jpegRaster.createTranslatedChild(minX, minY);

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:     private static final Raster decodeJPEG(byte[] data,
   7:                                            JPEGDecodeParam decodeParam,
   8:         ...
   9: 
  10:         Raster jpegRaster;
  11:         try {
  12:         ...
  13: 
  14:         return jpegRaster.createTranslatedChild(minX, minY);

View Full Code Here

createWritableRaster

public static WritableRaster createWritableRaster(SampleModel sm,
                                                  Point location)
Creates a WritableRaster with the specified SampleModel. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
sm - the specified SampleModel
location - the upper-left corner of the WritableRaster
Returns:
a WritableRaster with the specified SampleModel and location.
Throws:
RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow
Usages and Demos :

View More Examples of createWritableRaster(SampleModel sm,Point location)
   1: import java.awt.image.DirectColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:     public Raster getTile(int x, int y) {
   7:         if (me2src == null)
   8:         ...
   9:         Point pt = new Point(tx, ty);
  10:         WritableRaster wr = Raster.createWritableRaster(sm, pt);
  11:         genRect(wr);
  12:         ...
  13:             return;
  14:         Raster srcRas = src.getData(srcR.intersection(src.getBounds()));

View Full Code Here
   1: import java.awt.image.DirectColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:     public Raster getTile(int x, int y) {
   7:         int tx = tileGridXOff+x*tileWidth;
   8:         ...
   9:         Point pt = new Point(tx, ty);
  10:         WritableRaster wr = Raster.createWritableRaster(sm, pt);
  11:         genRect(wr);
  12:         ...
  13:                     Rectangle smR = crR.intersection(r);
  14:                     Raster ras = cr.getData(smR);

View Full Code Here
   1: import java.awt.image.DataBufferInt;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:     RenderedImage  tile   = null;
   6:     WritableRaster raster = null;
   7: 
   8:         ...
   9:             sm = sm.createCompatibleSampleModel(xSz, ySz);
  10:             raster = Raster.createWritableRaster
  11:                 (sm, new Point(tile.getMinX(), tile.getMinY()));
  12:         ...
  13:         Point pt = new Point(tx, ty);
  14:         WritableRaster wr = Raster.createWritableRaster(sm, pt);

View Full Code Here
   1:     Point origin = new Point(0, 0);
   2:     WritableRaster raster = createRasterForXImage(ximg, origin);
   3: 
   4:         ...
   5:     
   6:     BufferedImage bimg = new BufferedImage(imageCM,raster, false, props);
   7: 
   8:         ...
   9:     DataBuffer dataB = raster.getDataBuffer();
  10:     attachData(ximg, dataB, 0);
  11:         ...
  12: 
  13:     WritableRaster raster = Raster.createWritableRaster(imageSM, origin);

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:  public Raster getData() {
   7:      Rectangle rect = new Rectangle(getMinX(), getMinY(),
   8:         ...
   9: 
  10:  public Raster getData(Rectangle bounds) {
  11:      int startX = XToTileX(bounds.x);
  12:         ...
  13:          WritableRaster dest =
  14:              Raster.createWritableRaster(sm, bounds.getLocation());

View Full Code Here

createWritableRaster

public static WritableRaster createWritableRaster(SampleModel sm,
                                                  DataBuffer db,
                                                  Point location)
Creates a WritableRaster with the specified SampleModel and DataBuffer. The upper left corner of the Raster is given by the location argument. If location is null, (0, 0) will be used.
Parameters:
sm - the specified SampleModel
db - the specified DataBuffer
location - the upper-left corner of the WritableRaster
Returns:
a WritableRaster with the specified SampleModel, DataBuffer, and location.
Throws:
RasterFormatException - if computing either location.x + sm.getWidth() or location.y + sm.getHeight() results in integer overflow
RasterFormatException - if dataBuffer has more than one bank and the sampleModel is PixelInterleavedSampleModel, SinglePixelPackedSampleModel, or MultiPixelPackedSampleModel.
NullPointerException - if either SampleModel or DataBuffer is null
Usages and Demos :

View More Examples of createWritableRaster(SampleModel sm,DataBuffer db,Point location)
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     DataBuffer db = new DataBufferByte(data, w*h, 0);
   6:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   7:     
   8:         ...
   9:     return new BufferedImage(palette, raster, false, null);
  10:     }

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     DataBuffer db = new DataBufferByte(data, w*h, 0);
   6:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   7:     
   8:         ...
   9:     return new BufferedImage(palette, raster, false, null);
  10:     }

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     DataBuffer db = new DataBufferByte(data, size, 0);
   6:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   7:     
   8:         ...
   9:     return new BufferedImage(palette, raster, false, null);
  10:     }

View Full Code Here
   1: import java.awt.image.DirectColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     DataBuffer db = new DataBufferInt(data, w*h);
   6:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   7:     
   8:         ...
   9:     return new BufferedImage(cm, raster, false, null);
  10:     }

View Full Code Here
   1: import java.awt.image.DirectColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     DataBuffer db = new DataBufferUShort(data, w*h, 0);
   6:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   7:         ...
   8:     return new BufferedImage(cm, raster, false, null);
   9:     }

View Full Code Here

getBounds

public Rectangle getBounds()
Returns the bounding Rectangle of this Raster. This function returns the same information as getMinX/MinY/Width/Height.
Returns:
the bounding box of this Raster.
Usages and Demos :

View More Examples of getBounds()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9: 
  10:     public Rectangle2D getBounds2D(Raster src)
  11:     {
  12:         ...
  13: #if USE_ORIGINAL_CODE
  14:         return src.getBounds();

View Full Code Here
   1: import jp.ujihara.java.awt.image.DataBuffer;
   2: import jp.ujihara.java.awt.image.Raster;
   3: import jp.ujihara.java.awt.image.WritableRaster;
   4:         ...
   5: 
   6:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
   7:     {
   8:         ...
   9:       Rectangle srcRect = src.getBounds();
  10:         ...
  11:       Rectangle dstInRect = dstIn.getBounds();

View Full Code Here

getDataBuffer

public DataBuffer getDataBuffer()
Returns the DataBuffer associated with this Raster.
Returns:
the DataBuffer of this Raster.
Usages and Demos :

View More Examples of getDataBuffer()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster rr = cr.getData();
   7:         Point  pt = new Point(0,0);
   8:         ...
   9:         WritableRaster wr = Raster.createWritableRaster(rr.getSampleModel(),
  10:         ...
  11:                                                         rr.getDataBuffer(),

View Full Code Here
   1: import java.util.Arrays;
   2: import java.awt.image.Raster;
   3: import java.awt.image.DataBuffer;
   4:         ...
   5:     static SampleDimension[] create(final String         name,
   6:                                     final Raster         raster,
   7:                                     final double[]       min,
   8:         ...
   9:         create(name, (min==null || max==null) ? RectIterFactory.create(raster, null) : null,
  10:                raster.getDataBuffer().getDataType(), min, max, units, colors, dst, hints);
  11:         return dst;

View Full Code Here

getDataElements

public Object getDataElements(int x,
                              int y,
                              int w,
                              int h,
                              Object outData)
Returns the pixel data for the specified rectangle of pixels in a primitive array of type TransferType. For image data supported by the Java 2D API, this will be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. Data may be returned in a packed format, thus increasing efficiency for data transfers. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of TransferType.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
outData - An object reference to an array of type defined by getTransferType() and length w*h*getNumDataElements(). If null, an array of appropriate type and size will be allocated.
Returns:
An object reference to an array of type defined by getTransferType() with the requested pixel data.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if outData is too small to hold the output.
Usages and Demos :

View More Examples of getDataElements(int x,int y,int w,int h,Object outData)
   1: import jp.ujihara.java.awt.image.DataBuffer;
   2: import jp.ujihara.java.awt.image.Raster;
   3: import jp.ujihara.java.awt.image.WritableRaster;
   4:         ...
   5: 
   6:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
   7:     {
   8:         ...
   9:       {
  10:         src.getDataElements(aX, y + aY, width, 1, srcLine);
  11:         ...
  12:         dstIn.getDataElements(bX, y + bY, width, 1, dstLine);

View Full Code Here

getDataElements

public Object getDataElements(int x,
                              int y,
                              Object outData)
Returns data for a single pixel in a primitive array of type TransferType. For image data supported by the Java 2D(tm) API, this will be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, DataBuffer.TYPE_INT, DataBuffer.TYPE_SHORT, DataBuffer.TYPE_FLOAT, or DataBuffer.TYPE_DOUBLE. Data may be returned in a packed format, thus increasing efficiency for data transfers. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed. A ClassCastException will be thrown if the input object is non null and references anything other than an array of TransferType.
Parameters:
outData - An object reference to an array of type defined by getTransferType() and length getNumDataElements(). If null, an array of appropriate type and size will be allocated
Returns:
An object reference to an array of type defined by getTransferType() with the requested pixel data.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if outData is too small to hold the output.
Usages and Demos :

View More Examples of getDataElements(int x,int y,Object outData)
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     public Raster getRaster(int x1, int y1, int w, int h)
   7:     {
   8:         ...
   9:       float[] dest = new float[2];
  10:       Raster source = image.getData();
  11:       int minX = source.getMinX();
  12:         ...
  13:                 {
  14:                   pixel = source.getDataElements(dx, dy, pixel);

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5: 
   6:   public Raster getRaster(int x1, int y1, int w, int h)
   7:   {
   8:         ...
   9:     float[] dest = new float[2];
  10:     Raster source = image.getData();
  11:     int minX = source.getMinX();
  12:         ...
  13: 
  14:             pixel = source.getDataElements(dx, dy, pixel);

View Full Code Here
   1: import jp.ujihara.java.awt.image.DataBuffer;
   2: import jp.ujihara.java.awt.image.Raster;
   3: import jp.ujihara.java.awt.image.WritableRaster;
   4:         ...
   5: 
   6:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
   7:     {
   8:         ...
   9:         {
  10:           srcPix = src.getDataElements(x + srcRect.x, y + srcRect.y, srcPix);
  11:           dstPix = dstIn.getDataElements(x + dstInRect.x, y + dstInRect.y,

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5: 
   6:   public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
   7:   {
   8:         ...
   9:           {
  10:             srcPixel = src.getDataElements(x, y, (int[]) srcPixel);
  11:         ...
  12:             dstPixel = dstIn.getDataElements(x, y, dstPixel);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private final Raster getRasterAt(final int y, final int x) {
   7:         if (x<minX || x>=maxX || y<minY || y>=maxY) {
   8:         ...
   9:     public Object getValueAt(int y, int x) {
  10:         final Raster raster = getRasterAt(y+=minY, x+=minX);
  11:         if (raster == null) {
  12:         ...
  13:         }
  14:         pixel = raster.getDataElements(x, y, pixel);

View Full Code Here

getHeight

public final int getHeight()
Returns the height in pixels of the Raster.
Returns:
the height of this Raster.
Usages and Demos :

View More Examples of getHeight()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:     Raster ras;
   7: 
   8:         ...
   9:     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
  10:         this.ras = ras;
  11:         ...
  12:         this.tileWidth = this.width = ras.getWidth();
  13:         this.tileHeight = this.height = ras.getHeight();

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5:                    src.getSampleModel().getWidth(),
   6:                    src.getSampleModel().getHeight(),
   7:                    1, src.getSampleModel().getWidth(),
   8:         ...
   9: 
  10:         Raster srcRas = srcRed.getData(wr.getBounds());
  11:         PixelInterleavedSampleModel srcSM;
  12:         ...
  13:         if (srcRed.getColorModel().isAlphaPremultiplied()) {
  14:             for (int y=0; y<srcRas.getHeight(); y++) {

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     public Raster getRaster(int x1, int y1, int w, int h)
   7:     {
   8:         ...
   9:       float[] dest = new float[2];
  10:       Raster source = image.getData();
  11:       int minX = source.getMinX();
  12:         ...
  13:       int minY = source.getMinY();
  14:       int maxY = source.getHeight() + minY;

View Full Code Here
   1:     public static final int REPLACE        = 1;
   2:     private Raster traster;
   3:     private int txoff, tyoff;
   4:         ...
   5:         twidth = traster.getWidth();
   6:         theight = traster.getHeight();
   7: 
   8:         ...
   9: 
  10:     public WritableRaster filter(Raster src, WritableRaster dest)
  11:     {
  12:         ...
  13:         twidth = traster.getWidth();
  14:         theight = traster.getHeight();

View Full Code Here
   1:     private static void assertEquals(final double value, final GridCoverage coverage) {
   2:         final Raster data = coverage.getRenderedImage().getData();
   3:         final int xmin = data.getMinX();
   4:         ...
   5:         final int xmax = data.getWidth()  + xmin;
   6:         final int ymax = data.getHeight() + ymin;
   7:         for (int y=ymin; y<ymax; y++) {
   8:         ...
   9:             for (int x=xmin; x<xmax; x++) {
  10:                 assertEquals("Unexpected sample value in raster.",
  11:                              value, data.getSampleDouble(x,y,0), EPS);

View Full Code Here

getMinX

public final int getMinX()
Returns the minimum valid X coordinate of the Raster.
Returns:
the minimum x coordinate of this Raster.
Usages and Demos :

View More Examples of getMinX()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:     Raster ras;
   7: 
   8:         ...
   9:     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
  10:         this.ras = ras;
  11:         ...
  12: 
  13:         this.tileGridXOffset = this.minX = ras.getMinX();

View Full Code Here
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         ...
   8:         final int minX = r.getMinX();
   9:         final int minY = r.getMinY();
  10:         ...
  11: 
  12:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:               cr.getColorModel(), cr.getSampleModel(), 
   6:               cr.getTileGridXOffset()+xloc-cr.getMinX(), 
   7:               cr.getTileGridYOffset()+yloc-cr.getMinY(), 
   8:         ...
   9:               null);
  10:         deltaX = xloc-cr.getMinX();
  11:         deltaY = yloc-cr.getMinY();
  12:         ...
  13: 
  14:     public Raster getTile(int tileX, int tileY) {

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:         int destScanlineStride = destSM.getScanlineStride();
  10:         int srcX = src.getMinX() - src.getSampleModelTranslateX();
  11:         int srcY = src.getMinY() - src.getSampleModelTranslateY();
  12:         ...
  13:         int destX = dest.getMinX() - dest.getSampleModelTranslateX();

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:         Raster srcRas = srcRed.getData(wr.getBounds());
   7:         PixelInterleavedSampleModel srcSM;
   8:         ...
   9: 
  10:         int srcX0 = srcRas.getMinX()-srcRas.getSampleModelTranslateX();
  11:         int srcY0 = srcRas.getMinY()-srcRas.getSampleModelTranslateY();
  12:         ...
  13: 
  14:         int dstX0 = wr.getMinX()-wr.getSampleModelTranslateX();

View Full Code Here

getMinY

public final int getMinY()
Returns the minimum valid Y coordinate of the Raster.
Returns:
the minimum y coordinate of this Raster.
Usages and Demos :

View More Examples of getMinY()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:     Raster ras;
   7: 
   8:         ...
   9:     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
  10:         this.ras = ras;
  11:         ...
  12:         this.tileGridXOffset = this.minX = ras.getMinX();
  13:         this.tileGridYOffset = this.minY = ras.getMinY();

View Full Code Here
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         final int minX = r.getMinX();
   8:         ...
   9:         final int minY = r.getMinY();
  10:         final int w = r.getWidth();
  11:         ...
  12: 
  13:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1: import java.awt.Rectangle;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:               cr.getTileGridXOffset()+xloc-cr.getMinX(), 
   6:               cr.getTileGridYOffset()+yloc-cr.getMinY(), 
   7:               null);
   8:         ...
   9:         deltaX = xloc-cr.getMinX();
  10:         deltaY = yloc-cr.getMinY();
  11:     }
  12:         ...
  13: 
  14:     public Raster getTile(int tileX, int tileY) {

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:         int srcX = src.getMinX() - src.getSampleModelTranslateX();
  10:         int srcY = src.getMinY() - src.getSampleModelTranslateY();
  11:         int destX = dest.getMinX() - dest.getSampleModelTranslateX();
  12:         ...
  13:         int destY = dest.getMinY() - dest.getSampleModelTranslateY();

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:         Raster srcRas = srcRed.getData(wr.getBounds());
   7:         PixelInterleavedSampleModel srcSM;
   8:         ...
   9:         int srcX0 = srcRas.getMinX()-srcRas.getSampleModelTranslateX();
  10:         int srcY0 = srcRas.getMinY()-srcRas.getSampleModelTranslateY();
  11: 
  12:         ...
  13:         int dstX1 = dstX0+wr.getWidth()-1;
  14:         int dstY0 = wr.getMinY()-wr.getSampleModelTranslateY();

View Full Code Here

getNumBands

public final int getNumBands()
Returns the number of bands (samples per pixel) in this Raster.
Returns:
the number of bands of this Raster.
Usages and Demos :

View More Examples of getNumBands()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         this.band     = bandNumber;
   6:         this.numBands = model.getNumBands();
   7:         this.type     = TypeMap.getSampleDimensionType(model, bandNumber);
   8:         ...
   9:     {
  10:         final int numBands = image.getSampleModel().getNumBands();
  11:         if (src!=null && src.length!=numBands) {
  12:         ...
  13:     static GridSampleDimension[] create(final CharSequence   name,
  14:                                         final Raster         raster,

View Full Code Here
   1: import java.util.Arrays;
   2: import java.awt.image.Raster;
   3: import java.awt.image.DataBuffer;
   4:         ...
   5:         this.band     = bandNumber;
   6:         this.numBands = model.getNumBands();
   7:         this.type     = SampleDimensionType.getEnum(model, bandNumber);
   8:         ...
   9:     {
  10:         final int numBands = image.getSampleModel().getNumBands();
  11:         if (src!=null && src.length!=numBands) {
  12:         ...
  13:     static SampleDimension[] create(final String         name,
  14:                                     final Raster         raster,

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private void encodePass(OutputStream os, Raster ras,
   7:                             int xOffset,     int yOffset,
   8:         ...
   9: 
  10:         Raster ras = image.getData(new Rectangle(image.getMinX(), 
  11:                                                  image.getMinY(),
  12:         ...
  13:         if (skipAlpha) {
  14:             int numBands = ras.getNumBands() - 1;

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private void encodePass(OutputStream os, Raster ras,
   7:                             int xOffset,     int yOffset,
   8:         ...
   9: 
  10:         Raster ras = image.getData(new Rectangle(image.getMinX(), 
  11:                                                  image.getMinY(),
  12:         ...
  13:         if (skipAlpha) {
  14:             int numBands = ras.getNumBands() - 1;

View Full Code Here

getNumDataElements

public final int getNumDataElements()
Returns the number of data elements needed to transfer one pixel via the getDataElements and setDataElements methods. When pixels are transferred via these methods, they may be transferred in a packed or unpacked format, depending on the implementation of the underlying SampleModel. Using these methods, pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage data type of the DataBuffer.
Returns:
the number of data elements.

getParent

public Raster getParent()
Returns the parent Raster (if any) of this Raster or null.
Returns:
the parent Raster or null.

getPixel

public double[] getPixel(int x,
                         int y,
                         dArray[] )
Returns the samples in an array of double for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if dArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixel(int x,int y,dArray[] )
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:   protected void updateRaster(Raster raster, int x, int y, int w, int h)
   7:   {
   8:         ...
   9:               {
  10:                 pixel = raster.getPixel(tx, ty, pixel);
  11:                 zPixmap.set_red(tx - x, ty - y, pixel[0]);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image1.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:     private GridCoverage createGrid() throws Exception {
   6:         WritableRaster raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT, WIDTH,
   7:                 HEIGHT, 1, null
   8:         ...
   9:             for (int j = 0; j < WIDTH; j++) {
  10:                 raster.setSample(i, j, 0, i + j);
  11:             }
  12:         ...
  13:             for (int y = 0; y < data.getHeight(); y++) {
  14:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here

getPixel

public float[] getPixel(int x,
                        int y,
                        fArray[] )
Returns the samples in an array of float for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if fArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixel(int x,int y,fArray[] )
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:   protected void updateRaster(Raster raster, int x, int y, int w, int h)
   7:   {
   8:         ...
   9:               {
  10:                 pixel = raster.getPixel(tx, ty, pixel);
  11:                 zPixmap.set_red(tx - x, ty - y, pixel[0]);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image1.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:     private GridCoverage createGrid() throws Exception {
   6:         WritableRaster raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT, WIDTH,
   7:                 HEIGHT, 1, null
   8:         ...
   9:             for (int j = 0; j < WIDTH; j++) {
  10:                 raster.setSample(i, j, 0, i + j);
  11:             }
  12:         ...
  13:             for (int y = 0; y < data.getHeight(); y++) {
  14:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here

getPixel

public int[] getPixel(int x,
                      int y,
                      iArray[] )
Returns the samples in an array of int for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
Returns:
the samples for the specified pixel.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if iArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixel(int x,int y,iArray[] )
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:   protected void updateRaster(Raster raster, int x, int y, int w, int h)
   7:   {
   8:         ...
   9:               {
  10:                 pixel = raster.getPixel(tx, ty, pixel);
  11:                 zPixmap.set_red(tx - x, ty - y, pixel[0]);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image1.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:     private GridCoverage createGrid() throws Exception {
   6:         WritableRaster raster = RasterFactory.createBandedRaster(DataBuffer.TYPE_FLOAT, WIDTH,
   7:                 HEIGHT, 1, null
   8:         ...
   9:             for (int j = 0; j < WIDTH; j++) {
  10:                 raster.setSample(i, j, 0, i + j);
  11:             }
  12:         ...
  13:             for (int y = 0; y < data.getHeight(); y++) {
  14:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster data = image.getData();
   7:         ...
   8:         Raster data2 = image2.getData();
   9:         int[] pixel1 = null;
  10:         ...
  11:             for (int y = 0; y < data.getHeight(); y++) {
  12:                 pixel1 = data.getPixel(x, y, pixel1);

View Full Code Here

getPixels

public double[] getPixels(int x,
                          int y,
                          int w,
                          int h,
                          dArray[] )
Returns a double array containing all samples for a rectangle of pixels, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if dArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixels(int x,int y,int w,int h,dArray[] )
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         final int minX = r.getMinX();
   8:         ...
   9:         for (int y=minY; y<minY+h; y++) {
  10:             samples = r.getPixels(minX, y, w, 1, samples);
  11:             for (int x=0; x<3*w; x++) {
  12:         ...
  13: 
  14:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1:     public static final int REPLACE        = 1;
   2:     private Raster traster;
   3:     private int txoff, tyoff;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:             switch (tmode) {
  10:             case REPLACE:    src.getPixels(0,y, swidth,1, spix); break;
  11:         ...
  12:                             dest.getPixels(0,y, swidth,1, dpix); break;

View Full Code Here
   1:     @SuppressWarnings("cast")
   2:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
   3:         float a=0, ac=0;
   4:         ...
   5:         for ( int y = y0; y < y1; y++ ) {
   6:             srcPix = src.getPixels(x, y, w, 1, srcPix);
   7:         ...
   8:             dstPix = dstIn.getPixels(x, y, w, 1, dstPix);
   9:             int i = 0;

View Full Code Here
   1: import java.awt.Point;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     protected void getTilePixels( Rectangle rect ) {
   6:             Raster src = image.getData(rect);
   7:         int col=(int)rect.getX();
   8:         ...
   9:         int cols=(int)rect.getWidth();
  10:             src.getPixels(col, row, cols, rows, _pixels);
  11:     }

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private void encodePass(OutputStream os, Raster ras,
   7:                             int xOffset,     int yOffset,
   8:         ...
   9:         for (int row = minY + yOffset; row < minY + height; row += ySkip) {
  10:             ras.getPixels(minX, row, width, 1, samples);
  11: 
  12:         ...
  13: 
  14:         Raster ras = image.getData(new Rectangle(image.getMinX(), 

View Full Code Here

getPixels

public float[] getPixels(int x,
                         int y,
                         int w,
                         int h,
                         fArray[] )
Returns a float array containing all samples for a rectangle of pixels, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if fArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixels(int x,int y,int w,int h,fArray[] )
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         final int minX = r.getMinX();
   8:         ...
   9:         for (int y=minY; y<minY+h; y++) {
  10:             samples = r.getPixels(minX, y, w, 1, samples);
  11:             for (int x=0; x<3*w; x++) {
  12:         ...
  13: 
  14:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1:     public static final int REPLACE        = 1;
   2:     private Raster traster;
   3:     private int txoff, tyoff;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:             switch (tmode) {
  10:             case REPLACE:    src.getPixels(0,y, swidth,1, spix); break;
  11:         ...
  12:                             dest.getPixels(0,y, swidth,1, dpix); break;

View Full Code Here
   1:     @SuppressWarnings("cast")
   2:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
   3:         float a=0, ac=0;
   4:         ...
   5:         for ( int y = y0; y < y1; y++ ) {
   6:             srcPix = src.getPixels(x, y, w, 1, srcPix);
   7:         ...
   8:             dstPix = dstIn.getPixels(x, y, w, 1, dstPix);
   9:             int i = 0;

View Full Code Here
   1: import java.awt.Point;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     protected void getTilePixels( Rectangle rect ) {
   6:             Raster src = image.getData(rect);
   7:         int col=(int)rect.getX();
   8:         ...
   9:         int cols=(int)rect.getWidth();
  10:             src.getPixels(col, row, cols, rows, _pixels);
  11:     }

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private void encodePass(OutputStream os, Raster ras,
   7:                             int xOffset,     int yOffset,
   8:         ...
   9:         for (int row = minY + yOffset; row < minY + height; row += ySkip) {
  10:             ras.getPixels(minX, row, width, 1, samples);
  11: 
  12:         ...
  13: 
  14:         Raster ras = image.getData(new Rectangle(image.getMinX(), 

View Full Code Here

getPixels

public int[] getPixels(int x,
                       int y,
                       int w,
                       int h,
                       iArray[] )
Returns an int array containing all samples for a rectangle of pixels, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
Returns:
the samples for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates are not in bounds, or if iArray is too small to hold the output.
Usages and Demos :

View More Examples of getPixels(int x,int y,int w,int h,iArray[] )
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         final int minX = r.getMinX();
   8:         ...
   9:         for (int y=minY; y<minY+h; y++) {
  10:             samples = r.getPixels(minX, y, w, 1, samples);
  11:             for (int x=0; x<3*w; x++) {
  12:         ...
  13: 
  14:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1:     public static final int REPLACE        = 1;
   2:     private Raster traster;
   3:     private int txoff, tyoff;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:             switch (tmode) {
  10:             case REPLACE:    src.getPixels(0,y, swidth,1, spix); break;
  11:         ...
  12:                             dest.getPixels(0,y, swidth,1, dpix); break;

View Full Code Here
   1:     @SuppressWarnings("cast")
   2:     public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
   3:         float a=0, ac=0;
   4:         ...
   5:         for ( int y = y0; y < y1; y++ ) {
   6:             srcPix = src.getPixels(x, y, w, 1, srcPix);
   7:         ...
   8:             dstPix = dstIn.getPixels(x, y, w, 1, dstPix);
   9:             int i = 0;

View Full Code Here
   1: import java.awt.Point;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     protected void getTilePixels( Rectangle rect ) {
   6:             Raster src = image.getData(rect);
   7:         int col=(int)rect.getX();
   8:         ...
   9:         int cols=(int)rect.getWidth();
  10:             src.getPixels(col, row, cols, rows, _pixels);
  11:     }

View Full Code Here
   1: import java.awt.image.IndexColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private void encodePass(OutputStream os, Raster ras,
   7:                             int xOffset,     int yOffset,
   8:         ...
   9:         for (int row = minY + yOffset; row < minY + height; row += ySkip) {
  10:             ras.getPixels(minX, row, width, 1, samples);
  11: 
  12:         ...
  13: 
  14:         Raster ras = image.getData(new Rectangle(image.getMinX(), 

View Full Code Here

getSample

public int getSample(int x,
                     int y,
                     int b)
Returns the sample in a specified band for the pixel located at (x,y) as an int. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.
Usages and Demos :

View More Examples of getSample(int x,int y,int b)
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private final Raster getRasterAt(final int y, final int x) {
   7:         if (x<minX || x>=maxX || y<minY || y>=maxY) {
   8:         ...
   9:     public Object getValueAt(int y, int x) {
  10:         final Raster raster = getRasterAt(y+=minY, x+=minX);
  11:         if (raster == null) {
  12:         ...
  13:         switch (dataType) {
  14:             default:                      return new Integer(raster.getSample(x,y,band));

View Full Code Here
   1: import java.awt.image.BufferedImage;
   2: import java.awt.image.Raster;
   3: import java.io.BufferedOutputStream;
   4:         ...
   5:     public void encode() {
   6:         Raster raster = ((BufferedImage) image).getData();
   7:         int height = raster.getHeight();
   8:         ...
   9:                 for (int j = 0; j < width; j++) {
  10:                     bos.write(raster.getSample(j, i, 0));
  11:         ...
  12:                     bos.write(raster.getSample(j, i, 1));

View Full Code Here

getSampleDouble

public double getSampleDouble(int x,
                              int y,
                              int b)
Returns the sample in a specified band for a pixel located at (x,y) as a double. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.
Usages and Demos :

View More Examples of getSampleDouble(int x,int y,int b)
   1: import java.awt.geom.Point2D;
   2: import java.awt.image.Raster;
   3: import javax.media.jai.Interpolation;
   4:         ...
   5:         double[] buffer = null;
   6:         final Raster          data = coverage.getRenderedImage().getData();
   7:         final Envelope    envelope = coverage.getEnvelope();
   8:         ...
   9: 
  10:                 double r00 = data.getSampleDouble(i-0, j-0, band);
  11:         ...
  12:                 double r01 = data.getSampleDouble(i-0, j-1, band);

View Full Code Here
   1:         double[] buffer = null;
   2:         final Raster          data = coverage.getRenderedImage().getData();
   3:         final Envelope    envelope = coverage.getEnvelope();
   4:         ...
   5: 
   6:                 double r00 = data.getSampleDouble(i-0, j-0, band);
   7:         ...
   8:                 double r01 = data.getSampleDouble(i-0, j-1, band);
   9:         ...
  10:                 double r10 = data.getSampleDouble(i-1, j-0, band);

View Full Code Here
   1:     private static void assertEquals(final double value, final GridCoverage coverage) {
   2:         final Raster data = coverage.getRenderedImage().getData();
   3:         final int xmin = data.getMinX();
   4:         ...
   5:             for (int x=xmin; x<xmax; x++) {
   6:                 assertEquals("Unexpected sample value in raster.",
   7:         ...
   8:                              value, data.getSampleDouble(x,y,0), EPS);
   9:             }

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private final Raster getRasterAt(final int y, final int x) {
   7:         if (x<minX || x>=maxX || y<minY || y>=maxY) {
   8:         ...
   9:     public Object getValueAt(int y, int x) {
  10:         final Raster raster = getRasterAt(y+=minY, x+=minX);
  11:         if (raster == null) {
  12:         ...
  13:             case DataBuffer.TYPE_FLOAT:   return new Float  (raster.getSampleFloat (x,y,band));
  14:             case DataBuffer.TYPE_DOUBLE:  return new Double (raster.getSampleDouble(x,y,band));

View Full Code Here
   1: import java.awt.image.RenderedImage;
   2: import java.awt.image.Raster;
   3: import java.util.Locale;
   4:         ...
   5:                 for (int j=jmin+decimateY; --j>=jmin;) {
   6:                     final Raster tile = image.getTile(image.XToTileX(i), image.YToTileY(j));
   7:         ...
   8:                     final double x = tile.getSampleDouble(i, j, bandX);
   9:         ...
  10:                     final double y = tile.getSampleDouble(i, j, bandY);

View Full Code Here

getSampleFloat

public float getSampleFloat(int x,
                            int y,
                            int b)
Returns the sample in a specified band for the pixel located at (x,y) as a float. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
b - The band to return
Returns:
the sample in the specified band for the pixel at the specified coordinate.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds.
Usages and Demos :

View More Examples of getSampleFloat(int x,int y,int b)
   1: import java.io.IOException;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         RenderedImage targetImage    = targetCoverage.getRenderableImage(0,1).createDefaultRendering();
   6:         Raster        sourceRaster   = sourceImage.getData();
   7:         ...
   8:         Raster        targetRaster   = targetImage.getData();
   9:         assertNotSame(sourceCoverage,                                targetCoverage);
  10:         ...
  11:             for (int x=sourceRaster.getWidth(); --x>=0;) {
  12:                 final float s = sourceRaster.getSampleFloat(x, y, 0);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     private final Raster getRasterAt(final int y, final int x) {
   7:         if (x<minX || x>=maxX || y<minY || y>=maxY) {
   8:         ...
   9:     public Object getValueAt(int y, int x) {
  10:         final Raster raster = getRasterAt(y+=minY, x+=minX);
  11:         if (raster == null) {
  12:         ...
  13:             default:                      return new Integer(raster.getSample      (x,y,band));
  14:             case DataBuffer.TYPE_FLOAT:   return new Float  (raster.getSampleFloat(x,y,band));

View Full Code Here

getSampleModel

public SampleModel getSampleModel()
Returns the SampleModel that describes the layout of the image data.
Returns:
the SampleModel of this Raster.
Usages and Demos :

View More Examples of getSampleModel()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:     Raster ras;
   7: 
   8:         ...
   9:     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
  10:         this.ras = ras;
  11:         ...
  12:         this.tileHeight = this.height = ras.getHeight();
  13:         this.sampleModel = ras.getSampleModel();

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:         Raster rr = cr.getData();
   7:         Point  pt = new Point(0,0);
   8:         ...
   9:         WritableRaster wr = Raster.createWritableRaster(rr.getSampleModel(),
  10:                                                         rr.getDataBuffer(),

View Full Code Here
   1: import java.awt.image.DataBufferInt;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         srcRect = srcRect.intersection(srcBound);
   6:         final Raster r = texture.getData(srcRect);
   7: 
   8:         ...
   9:         final SinglePixelPackedSampleModel sppsm;
  10:         sppsm = (SinglePixelPackedSampleModel)r.getSampleModel();

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         super(band);
   6:         final SampleModel model = image.getSampleModel();
   7:         this.band     = bandNumber;
   8:         ...
   9:     {
  10:         final int numBands = image.getSampleModel().getNumBands();
  11:         if (src!=null && src.length!=numBands) {
  12:         ...
  13:                     defaultSD = new GridSampleDimension[numBands];
  14:                     create(name, RectIterFactory.create(image, null), image.getSampleModel(),

View Full Code Here
   1: import java.awt.image.Kernel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5:         ColorModel cm  = fixColorModel(src);
   6:         SampleModel sm = src.getSampleModel();
   7:         int tw = sm.getWidth();
   8:         ...
   9: 
  10:     private WritableRaster boxFilterH(Raster src, WritableRaster dest,
  11:                                       int skipX, int skipY, 
  12:         ...
  13:         final SinglePixelPackedSampleModel srcSPPSM = 
  14:             (SinglePixelPackedSampleModel)src.getSampleModel();

View Full Code Here

getSampleModelTranslateX

public final int getSampleModelTranslateX()
Returns the X translation from the coordinate system of the SampleModel to that of the Raster. To convert a pixel's X coordinate from the Raster coordinate system to the SampleModel coordinate system, this value must be subtracted.
Returns:
the X translation from the coordinate space of the Raster's SampleModel to that of the Raster.
Usages and Demos :

View More Examples of getSampleModelTranslateX()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:         int destScanlineStride = destSM.getScanlineStride();
  10:         int srcX = src.getMinX() - src.getSampleModelTranslateX();
  11:         int srcY = src.getMinY() - src.getSampleModelTranslateY();
  12:         ...
  13:         int destX = dest.getMinX() - dest.getSampleModelTranslateX();

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:         Raster srcRas = srcRed.getData(wr.getBounds());
   7:         PixelInterleavedSampleModel srcSM;
   8:         ...
   9: 
  10:         int srcX0 = srcRas.getMinX()-srcRas.getSampleModelTranslateX();
  11:         int srcY0 = srcRas.getMinY()-srcRas.getSampleModelTranslateY();
  12:         ...
  13: 
  14:         int dstX0 = wr.getMinX()-wr.getSampleModelTranslateX();

View Full Code Here
   1: import java.awt.image.DataBufferInt;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5:         srcRect = srcRect.intersection(srcBound);
   6:         final Raster r = texture.getData(srcRect);
   7: 
   8:         ...
   9:             (db.getOffset() +
  10:              sppsm.getOffset(srcRect.x -r.getSampleModelTranslateX(), 
  11:                              srcRect.y -r.getSampleModelTranslateY()));

View Full Code Here
   1: import java.awt.image.PackedColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SinglePixelPackedSampleModel;
   4:         ...
   5: 
   6:         protected abstract void precompose(Raster src, Raster dstIn, 
   7:                                            WritableRaster dstOut);
   8:         ...
   9:                 (srcDB.getOffset() +
  10:                  srcSPPSM.getOffset(x0-src.getSampleModelTranslateX(),
  11:                                     y0-src.getSampleModelTranslateY()));
  12:         ...
  13:                 (dstInDB.getOffset() +
  14:                  dstInSPPSM.getOffset(x0-dstIn.getSampleModelTranslateX(),

View Full Code Here

getSampleModelTranslateY

public final int getSampleModelTranslateY()
Returns the Y translation from the coordinate system of the SampleModel to that of the Raster. To convert a pixel's Y coordinate from the Raster coordinate system to the SampleModel coordinate system, this value must be subtracted.
Returns:
the Y translation from the coordinate space of the Raster's SampleModel to that of the Raster.
Usages and Demos :

View More Examples of getSampleModelTranslateY()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9:         int srcX = src.getMinX() - src.getSampleModelTranslateX();
  10:         int srcY = src.getMinY() - src.getSampleModelTranslateY();
  11:         int destX = dest.getMinX() - dest.getSampleModelTranslateX();
  12:         ...
  13:         int destY = dest.getMinY() - dest.getSampleModelTranslateY();

View Full Code Here
   1: import java.awt.image.PixelInterleavedSampleModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:         Raster srcRas = srcRed.getData(wr.getBounds());
   7:         PixelInterleavedSampleModel srcSM;
   8:         ...
   9:         int srcX0 = srcRas.getMinX()-srcRas.getSampleModelTranslateX();
  10:         int srcY0 = srcRas.getMinY()-srcRas.getSampleModelTranslateY();
  11: 
  12:         ...
  13:         int dstX1 = dstX0+wr.getWidth()-1;
  14:         int dstY0 = wr.getMinY()-wr.getSampleModelTranslateY();

View Full Code Here
   1: import java.awt.image.Kernel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SampleModel;
   4:         ...
   5: 
   6:     private WritableRaster boxFilterH(Raster src, WritableRaster dest,
   7:                                       int skipX, int skipY, 
   8:         ...
   9:                (src.getMinX()-src.getSampleModelTranslateX(),
  10:                 src.getMinY()-src.getSampleModelTranslateY()));
  11:         final int dstOff 
  12:         ...
  13:                (dest.getMinX()-dest.getSampleModelTranslateX(),
  14:                 dest.getMinY()-dest.getSampleModelTranslateY()));

View Full Code Here
   1: import java.awt.image.PackedColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.SinglePixelPackedSampleModel;
   4:         ...
   5: 
   6:         protected abstract void precompose(Raster src, Raster dstIn, 
   7:                                            WritableRaster dstOut);
   8:         ...
   9:                  srcSPPSM.getOffset(x0-src.getSampleModelTranslateX(),
  10:                                     y0-src.getSampleModelTranslateY()));
  11: 
  12:         ...
  13:                  dstInSPPSM.getOffset(x0-dstIn.getSampleModelTranslateX(),
  14:                                       y0-dstIn.getSampleModelTranslateY()));

View Full Code Here

getSamples

public double[] getSamples(int x,
                           int y,
                           int w,
                           int h,
                           int b,
                           dArray[] )
Returns the samples for a specified band for a specified rectangle of pixels in a double array, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if dArray is too small to hold the output.

getSamples

public float[] getSamples(int x,
                          int y,
                          int w,
                          int h,
                          int b,
                          fArray[] )
Returns the samples for a specified band for the specified rectangle of pixels in a float array, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if fArray is too small to hold the output.

getSamples

public int[] getSamples(int x,
                        int y,
                        int w,
                        int h,
                        int b,
                        iArray[] )
Returns the samples for a specified band for the specified rectangle of pixels in an int array, one sample per array element. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds. However, explicit bounds checking is not guaranteed.
Parameters:
w - Width of the pixel rectangle
h - Height of the pixel rectangle
b - The band to return
Returns:
the samples for the specified band for the specified rectangle of pixels.
Throws:
ArrayIndexOutOfBoundsException - if the coordinates or the band index are not in bounds, or if iArray is too small to hold the output.

getTransferType

public final int getTransferType()
Returns the TransferType used to transfer pixels via the getDataElements and setDataElements methods. When pixels are transferred via these methods, they may be transferred in a packed or unpacked format, depending on the implementation of the underlying SampleModel. Using these methods, pixels are transferred as an array of getNumDataElements() elements of a primitive type given by getTransferType(). The TransferType may or may not be the same as the storage data type of the DataBuffer. The TransferType will be one of the types defined in DataBuffer.
Returns:
this transfer type.

getWidth

public final int getWidth()
Returns the width in pixels of the Raster.
Returns:
the width of this Raster.
Usages and Demos :

View More Examples of getWidth()
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: 
   4:         ...
   5: 
   6:     Raster ras;
   7: 
   8:         ...
   9:     public SingleTileRenderedImage(Raster ras, ColorModel colorModel) {
  10:         this.ras = ras;
  11:         ...
  12:         this.tileGridYOffset = this.minY = ras.getMinY();
  13:         this.tileWidth = this.width = ras.getWidth();

View Full Code Here
   1: 
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:     
   6:     public void tallyTile(Raster r) {
   7:         final int minX = r.getMinX();
   8:         ...
   9:         final int minY = r.getMinY();
  10:         final int w = r.getWidth();
  11:         final int h = r.getHeight();
  12:         ...
  13: 
  14:                 Raster r = src.getTile(x+xt0, y+yt0);

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RasterOp;
   4:         ...
   5: 
   6:     public WritableRaster filter(Raster src, WritableRaster dest)
   7:     {
   8:         ...
   9: 
  10:         int rowSize = src.getWidth() * numBands;
  11:         int h = src.getHeight();
  12:         ...
  13: 
  14:     public Rectangle2D getBounds2D(Raster src)

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.RenderedImage;
   4:         ...
   5: 
   6:     public Raster getRaster(int x1, int y1, int w, int h)
   7:     {
   8:         ...
   9:       float[] dest = new float[2];
  10:       Raster source = image.getData();
  11:       int minX = source.getMinX();
  12:         ...
  13:       int maxX = source.getWidth() + minX;

View Full Code Here
   1: import java.awt.image.ColorModel;
   2: import java.awt.image.Raster;
   3: import java.awt.image.WritableRaster;
   4:         ...
   5:         BufferedImage image = t.getImage();
   6:         double scaleX = anchor.getWidth() / image.getWidth();
   7:         double scaleY = anchor.getHeight() / image.getHeight();
   8:         ...
   9: 
  10:   public Raster getRaster(int x1, int y1, int w, int h)
  11:   {
  12:         ...
  13:     float[] dest = new float[2];
  14:     Raster source = image.getData();

View Full Code Here