Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

non_com.media.jai
Class RasterFactory  view RasterFactory download RasterFactory.java

java.lang.Object
  extended bynon_com.media.jai.RasterFactory

public class RasterFactory
extends java.lang.Object

A convenience class for the construction of various types of WritableRaster and SampleModel objects.

This class provides the capability of creating Rasters with the enumerated data types in the java.awt.image.DataBuffer.

In some cases, instances of ComponentSampleModelJAI, a subclass of java.awt.image.ComponentSampleModel are instantiated instead of java.awt.image.BandedSampleModel in order to work around bugs in the current release of the Java 2 SDK.


Constructor Summary
RasterFactory()
           
 
Method Summary
static java.awt.image.WritableRaster createBandedRaster(java.awt.image.DataBuffer dataBuffer, int width, int height, int scanlineStride, int[] bankIndices, int[] bandOffsets, java.awt.Point location)
          Creates a WritableRaster based on a ComponentSampleModel with the specified DataBuffer, width, height, scanline stride, bank indices, and band offsets.
static java.awt.image.WritableRaster createBandedRaster(int dataType, int width, int height, int scanlineStride, int[] bankIndices, int[] bandOffsets, java.awt.Point location)
          Creates a WritableRaster based on a ComponentSampleModel with the specified data type, width, height, scanline stride, bank indices and band offsets.
static java.awt.image.WritableRaster createBandedRaster(int dataType, int width, int height, int bands, java.awt.Point location)
          Creates a WritableRaster based on a ComponentSampleModel with the specified data type, width, height, and number of bands.
static java.awt.image.SampleModel createBandedSampleModel(int dataType, int width, int height, int numBands)
          Creates a banded SampleModel with a given data type, width, height, and number of bands.
static java.awt.image.SampleModel createBandedSampleModel(int dataType, int width, int height, int numBands, int[] bankIndices, int[] bandOffsets)
          Creates a banded SampleModel with a given data type, width, height, number of bands, bank indices, and band offsets.
static java.awt.image.ComponentColorModel createComponentColorModel(int dataType, java.awt.color.ColorSpace colorSpace, boolean useAlpha, boolean premultiplied, int transparency)
          Creates a component-based ColorModel with a given data type, color space, and transparency type.
static java.awt.image.SampleModel createComponentSampleModel(java.awt.image.SampleModel sm, int dataType, int width, int height, int numBands)
          Creates a component SampleModel with a given data type, width, height, and number of bands that is "compatible" with a given SampleModel.
static java.awt.image.WritableRaster createInterleavedRaster(java.awt.image.DataBuffer dataBuffer, int width, int height, int scanlineStride, int pixelStride, int[] bandOffsets, java.awt.Point location)
          Creates a WritableRaster based on a PixelInterleavedSampleModel with the specified DataBuffer, width, height, scanline stride, pixel stride, and band offsets.
static java.awt.image.WritableRaster createInterleavedRaster(int dataType, int width, int height, int scanlineStride, int pixelStride, int[] bandOffsets, java.awt.Point location)
          Creates a WritableRaster based on a PixelInterleavedSampleModel with the specified data type, width, height, scanline stride, pixel stride, and band offsets.
static java.awt.image.WritableRaster createInterleavedRaster(int dataType, int width, int height, int numBands, java.awt.Point location)
          Creates a WritableRaster based on a PixelInterleavedSampleModel with the specified data type, width, height, and number of bands.
static java.awt.image.WritableRaster createPackedRaster(java.awt.image.DataBuffer dataBuffer, int width, int height, int scanlineStride, int[] bandMasks, java.awt.Point location)
          Creates a WritableRaster based on a SinglePixelPackedSampleModel with the specified DataBuffer, width, height, scanline stride, and band masks.
static java.awt.image.WritableRaster createPackedRaster(java.awt.image.DataBuffer dataBuffer, int width, int height, int bitsPerPixel, java.awt.Point location)
          Creates a WritableRaster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel.
static java.awt.image.WritableRaster createPackedRaster(int dataType, int width, int height, int[] bandMasks, java.awt.Point location)
          Creates a WritableRaster based on a SinglePixelPackedSampleModel with the specified data type, width, height, and band masks.
static java.awt.image.WritableRaster createPackedRaster(int dataType, int width, int height, int numBands, int bitsPerBand, java.awt.Point location)
          Creates a WritableRaster based on a packed SampleModel with the specified data type, width, height, number of bands, and bits per band.
static java.awt.image.SampleModel createPixelInterleavedSampleModel(int dataType, int width, int height, int numBands)
          Creates a pixel interleaved SampleModel with a given data type, width, height, and number of bands.
static java.awt.image.SampleModel createPixelInterleavedSampleModel(int dataType, int width, int height, int pixelStride, int scanlineStride, int[] bandOffsets)
          Creates a pixel interleaved SampleModel with a given data type, width, height, pixel and scanline strides, and band offsets.
static java.awt.image.Raster createRaster(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Point location)
          Creates a WritableRaster with the specified SampleModel and DataBuffer.
static java.awt.image.WritableRaster createWritableChild(java.awt.image.WritableRaster raster, int parentX, int parentY, int width, int height, int childMinX, int childMinY, int[] bandList)
          Returns a new WritableRaster which shares all or part of the supplied WritableRaster's DataBuffer.
static java.awt.image.WritableRaster createWritableRaster(java.awt.image.SampleModel sampleModel, java.awt.image.DataBuffer dataBuffer, java.awt.Point location)
          Creates a WritableRaster with the specified SampleModel and DataBuffer.
static java.awt.image.WritableRaster createWritableRaster(java.awt.image.SampleModel sampleModel, java.awt.Point location)
          Creates a WritableRaster with the specified SampleModel .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterFactory

public RasterFactory()
Method Detail

createInterleavedRaster

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

The upper left corner of the WritableRaster 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.


createInterleavedRaster

public static java.awt.image.WritableRaster createInterleavedRaster(int dataType,
                                                                    int width,
                                                                    int height,
                                                                    int scanlineStride,
                                                                    int pixelStride,
                                                                    int[] bandOffsets,
                                                                    java.awt.Point location)
Creates a WritableRaster 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 WritableRaster 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.


createBandedRaster

public static java.awt.image.WritableRaster createBandedRaster(int dataType,
                                                               int width,
                                                               int height,
                                                               int bands,
                                                               java.awt.Point location)
Creates a WritableRaster based on a ComponentSampleModel with the specified data type, width, height, and number of bands.

Note that the Raster's SampleModel will be of type ComponentSampleModel, not BandedSampleModel as might be expected.

The upper left corner of the WritableRaster 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.


createBandedRaster

public static java.awt.image.WritableRaster createBandedRaster(int dataType,
                                                               int width,
                                                               int height,
                                                               int scanlineStride,
                                                               int[] bankIndices,
                                                               int[] bandOffsets,
                                                               java.awt.Point location)
Creates a WritableRaster based on a ComponentSampleModel 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.

Note that the Raster's SampleModel will be of type ComponentSampleModel, not BandedSampleModel as might be expected.

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


createPackedRaster

public static java.awt.image.WritableRaster createPackedRaster(int dataType,
                                                               int width,
                                                               int height,
                                                               int[] bandMasks,
                                                               java.awt.Point location)
Creates a WritableRaster 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 WritableRaster 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.


createPackedRaster

public static java.awt.image.WritableRaster createPackedRaster(int dataType,
                                                               int width,
                                                               int height,
                                                               int numBands,
                                                               int bitsPerBand,
                                                               java.awt.Point location)
Creates a WritableRaster 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 WritableRaster 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.


createInterleavedRaster

public static java.awt.image.WritableRaster createInterleavedRaster(java.awt.image.DataBuffer dataBuffer,
                                                                    int width,
                                                                    int height,
                                                                    int scanlineStride,
                                                                    int pixelStride,
                                                                    int[] bandOffsets,
                                                                    java.awt.Point location)
Creates a WritableRaster 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 WritableRaster is given by the location argument. If location is null, (0, 0) will be used.


createBandedRaster

public static java.awt.image.WritableRaster createBandedRaster(java.awt.image.DataBuffer dataBuffer,
                                                               int width,
                                                               int height,
                                                               int scanlineStride,
                                                               int[] bankIndices,
                                                               int[] bandOffsets,
                                                               java.awt.Point location)
Creates a WritableRaster based on a ComponentSampleModel 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 WritableRaster is given by the location argument. If location is null, (0, 0) will be used.

Note that the Raster's SampleModel will be of type ComponentSampleModel, not BandedSampleModel as might be expected.


createPackedRaster

public static java.awt.image.WritableRaster createPackedRaster(java.awt.image.DataBuffer dataBuffer,
                                                               int width,
                                                               int height,
                                                               int scanlineStride,
                                                               int[] bandMasks,
                                                               java.awt.Point location)
Creates a WritableRaster 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 WritableRaster is given by the location argument. If location is null , (0, 0) will be used.


createPackedRaster

public static java.awt.image.WritableRaster createPackedRaster(java.awt.image.DataBuffer dataBuffer,
                                                               int width,
                                                               int height,
                                                               int bitsPerPixel,
                                                               java.awt.Point location)
Creates a WritableRaster based on a MultiPixelPackedSampleModel with the specified DataBuffer, width, height, and bits per pixel. The upper left corner of the WritableRaster is given by the location argument. If location is null , (0, 0) will be used.


createRaster

public static java.awt.image.Raster createRaster(java.awt.image.SampleModel sampleModel,
                                                 java.awt.image.DataBuffer dataBuffer,
                                                 java.awt.Point location)
Creates a WritableRaster with the specified SampleModel and DataBuffer. The upper left corner of the WritableRaster is given by the location argument. If location is null, (0, 0) will be used.


createWritableRaster

public static java.awt.image.WritableRaster createWritableRaster(java.awt.image.SampleModel sampleModel,
                                                                 java.awt.Point location)
Creates a WritableRaster with the specified SampleModel . The upper left corner of the WritableRaster is given by the location argument. If location is null , (0, 0) will be used.


createWritableRaster

public static java.awt.image.WritableRaster createWritableRaster(java.awt.image.SampleModel sampleModel,
                                                                 java.awt.image.DataBuffer dataBuffer,
                                                                 java.awt.Point location)
Creates a WritableRaster with the specified SampleModel and DataBuffer. The upper left corner of the WritableRaster is given by the location argument. If location is null, (0, 0) will be used.


createWritableChild

public static java.awt.image.WritableRaster createWritableChild(java.awt.image.WritableRaster raster,
                                                                int parentX,
                                                                int parentY,
                                                                int width,
                                                                int height,
                                                                int childMinX,
                                                                int childMinY,
                                                                int[] bandList)
Returns a new WritableRaster which shares all or part of the supplied WritableRaster's DataBuffer. The new WritableRaster will possess a reference to the supplied WritableRaster, accessible through its getParent() and getWritableParent() methods.

This method provides a workaround for a bug in the implementation of WritableRaster.createWritableChild in the initial relase of the Java2 platform.

The parentX, parentY, width and height parameters form a Rectangle in this WritableRaster'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 supplied WritableRaster.

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

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

To create a new WritableRaster that contains a subregion of the supplied WritableRaster, 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.


createBandedSampleModel

public static java.awt.image.SampleModel createBandedSampleModel(int dataType,
                                                                 int width,
                                                                 int height,
                                                                 int numBands,
                                                                 int[] bankIndices,
                                                                 int[] bandOffsets)
Creates a banded SampleModel with a given data type, width, height, number of bands, bank indices, and band offsets.

Note that the returned SampleModel will be of type ComponentSampleModel , not BandedSampleModel as might be expected. Its behavior will be equivalent to that of a BandedSampleModel, and in particular its pixel stride will always be 1.


createBandedSampleModel

public static java.awt.image.SampleModel createBandedSampleModel(int dataType,
                                                                 int width,
                                                                 int height,
                                                                 int numBands)
Creates a banded SampleModel with a given data type, width, height, and number of bands. The bank indices and band offsets are set to default values.

Note that the returned SampleModel will be of type ComponentSampleModel , not BandedSampleModel as might be expected. Its behavior will be equivalent to that of a BandedSampleModel, and in particular its pixel stride will always be 1.


createPixelInterleavedSampleModel

public static java.awt.image.SampleModel createPixelInterleavedSampleModel(int dataType,
                                                                           int width,
                                                                           int height,
                                                                           int pixelStride,
                                                                           int scanlineStride,
                                                                           int[] bandOffsets)
Creates a pixel interleaved SampleModel with a given data type, width, height, pixel and scanline strides, and band offsets.


createPixelInterleavedSampleModel

public static java.awt.image.SampleModel createPixelInterleavedSampleModel(int dataType,
                                                                           int width,
                                                                           int height,
                                                                           int numBands)
Creates a pixel interleaved SampleModel with a given data type, width, height, and number of bands. The pixel stride, scanline stride, and band offsets are set to default values.


createComponentSampleModel

public static java.awt.image.SampleModel createComponentSampleModel(java.awt.image.SampleModel sm,
                                                                    int dataType,
                                                                    int width,
                                                                    int height,
                                                                    int numBands)
Creates a component SampleModel with a given data type, width, height, and number of bands that is "compatible" with a given SampleModel.


createComponentColorModel

public static java.awt.image.ComponentColorModel createComponentColorModel(int dataType,
                                                                           java.awt.color.ColorSpace colorSpace,
                                                                           boolean useAlpha,
                                                                           boolean premultiplied,
                                                                           int transparency)
Creates a component-based ColorModel with a given data type, color space, and transparency type. Currently this method does not support data type DataBuffer.TYPE_SHORT. If useAlpha is false, both premultiplied and transparency input are ignored and they are set to be false and Transparency.OPQAUE , respectively.