java.awt.image

Class DataBufferInt


public final class DataBufferInt
extends DataBuffer

This class extends DataBuffer and stores data internally as integers.

Field Summary

Fields inherited from class java.awt.image.DataBuffer

TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT, banks, dataType, offset, offsets, size

Constructor Summary

DataBufferInt(dataArray[] , int size)
Constructs an integer-based DataBuffer with a single bank using the specified array.
DataBufferInt(dataArray[] , int size, int offset)
Constructs an integer-based DataBuffer with a single bank using the specified array, size, and offset.
DataBufferInt(dataArray[][] , int size)
Constructs an integer-based DataBuffer with the specified arrays.
DataBufferInt(dataArray[][] , int size, offsets[] )
Constructs an integer-based DataBuffer with the specified arrays, size, and offsets.
DataBufferInt(int size)
Constructs an integer-based DataBuffer with a single bank and the specified size.
DataBufferInt(int size, int numBanks)
Constructs an integer-based DataBuffer with the specified number of banks, all of which are the specified size.

Method Summary

int[][]
getBankData()
Returns the data arrays for all banks.
int[]
getData()
Returns the default (first) int data array in DataBuffer.
int[]
getData(int bank)
Returns the data array for the specified bank.
int
getElem(int i)
Returns the requested data array element from the first (default) bank.
int
getElem(int bank, int i)
Returns the requested data array element from the specified bank.
void
setElem(int i, int val)
Sets the requested data array element in the first (default) bank to the specified value.
void
setElem(int bank, int i, int val)
Sets the requested data array element in the specified bank to the integer value i.

Methods inherited from class java.awt.image.DataBuffer

getDataType, getDataTypeSize, getElem, getElem, getElemDouble, getElemDouble, getElemFloat, getElemFloat, getNumBanks, getOffset, getOffsets, getSize, setElem, setElem, setElemDouble, setElemDouble, setElemFloat, setElemFloat

Methods inherited from class java.lang.Object

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

Constructor Details

DataBufferInt

public DataBufferInt(dataArray[] ,
                     int size)
Constructs an integer-based DataBuffer with a single bank using the specified array. Only the first size elements should be used by accessors of this DataBuffer. dataArray must be large enough to hold size elements.
Parameters:
size - The size of the DataBuffer bank.
Usages and Demos :

View More Examples of DataBufferInt(dataArray[] ,int size)
   1:                               bitmasks);
   2:     DataBuffer db = new DataBufferInt(data, w*h);
   3:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   4:     
   5:     return new BufferedImage(cm, raster, false, null);

View Full Code Here
   1:             case DataBuffer.TYPE_INT:
   2:                 return new DataBufferInt(size, numBanks);
   3:             case DataBuffer.TYPE_FLOAT:
   4:                 return new DataBufferFloat(size, numBanks);
   5:             case DataBuffer.TYPE_DOUBLE:

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:        dcm = new DirectColorModel(32, rMask32, gMask32, bMask32);
   2:        db = new DataBufferInt(imageDataInt, imageDataInt.length);
   3:        wr = Raster.createPackedRaster(db, w, h, w, 
   4:                       new int[] {rMask32, gMask32, bMask32},
   5:                       null);

View Full Code Here

DataBufferInt

public DataBufferInt(dataArray[] ,
                     int size,
                     int offset)
Constructs an integer-based DataBuffer with a single bank using the specified array, size, and offset. dataArray must have at least offset + size elements. Only elements offset through offset + size - 1 should be used by accessors of this DataBuffer.
Parameters:
size - The size of the DataBuffer bank.
offset - The offset into the dataArray.
Usages and Demos :

View More Examples of DataBufferInt(dataArray[] ,int size,int offset)
   1:     {
   2:         DataBuffer j2DBuf = new DataBufferInt(buf, sizeX * sizeY, 0);
   3:         
   4:         SinglePixelPackedSampleModel sampleModel =
   5:             new SinglePixelPackedSampleModel(

View Full Code Here

DataBufferInt

public DataBufferInt(dataArray[][] ,
                     int size)
Constructs an integer-based DataBuffer with the specified arrays. The number of banks will be equal to dataArray.length. Only the first size elements of each array should be used by accessors of this DataBuffer.
Parameters:
size - The size of the banks in the DataBuffer.
Usages and Demos :

View More Examples of DataBufferInt(dataArray[][] ,int size)
   1:                               bitmasks);
   2:     DataBuffer db = new DataBufferInt(data, w*h);
   3:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   4:     
   5:     return new BufferedImage(cm, raster, false, null);

View Full Code Here
   1:             case DataBuffer.TYPE_INT:
   2:                 return new DataBufferInt(size, numBanks);
   3:             case DataBuffer.TYPE_FLOAT:
   4:                 return new DataBufferFloat(size, numBanks);
   5:             case DataBuffer.TYPE_DOUBLE:

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:        dcm = new DirectColorModel(32, rMask32, gMask32, bMask32);
   2:        db = new DataBufferInt(imageDataInt, imageDataInt.length);
   3:        wr = Raster.createPackedRaster(db, w, h, w, 
   4:                       new int[] {rMask32, gMask32, bMask32},
   5:                       null);

View Full Code Here

DataBufferInt

public DataBufferInt(dataArray[][] ,
                     int size,
                     offsets[] )
Constructs an integer-based DataBuffer with the specified arrays, size, and offsets. The number of banks is equal to dataArray.length. Each array must be at least as large as size + the corresponding offset. There must be an entry in the offset array for each dataArray entry. For each bank, only elements offset through offset + size - 1 should be used by accessors of this DataBuffer.
Parameters:
size - The size of the banks in the DataBuffer.
Usages and Demos :

View More Examples of DataBufferInt(dataArray[][] ,int size,offsets[] )
   1:     {
   2:         DataBuffer j2DBuf = new DataBufferInt(buf, sizeX * sizeY, 0);
   3:         
   4:         SinglePixelPackedSampleModel sampleModel =
   5:             new SinglePixelPackedSampleModel(

View Full Code Here

DataBufferInt

public DataBufferInt(int size)
Constructs an integer-based DataBuffer with a single bank and the specified size.
Parameters:
size - The size of the DataBuffer.
Usages and Demos :

View More Examples of DataBufferInt(int size)
   1:             case DataBuffer.TYPE_INT:
   2:                 return new DataBufferInt((int[])data, size);
   3:             case DataBuffer.TYPE_FLOAT:
   4:                 return new DataBufferFloat((float[])data, size);
   5:             case DataBuffer.TYPE_DOUBLE:

View Full Code Here
   1:     {
   2:         return new DataBufferInt(getPixelDataArray(frame), size);
   3:     }
   4: 
   5:     public int[][][] getPixelDataArray()

View Full Code Here
   1:     }
   2:     DataBufferInt dbi = new DataBufferInt(maxSz);
   3:     int [] masks = { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 };
   4:     boolean use_INT_PACK = GraphicsUtil.is_INT_PACK_Data
   5:         (wr.getSampleModel(), false);

View Full Code Here

DataBufferInt

public DataBufferInt(int size,
                     int numBanks)
Constructs an integer-based DataBuffer with the specified number of banks, all of which are the specified size.
Parameters:
size - The size of the banks in the DataBuffer.
numBanks - The number of banks in the aDataBuffer.
Usages and Demos :

View More Examples of DataBufferInt(int size,int numBanks)
   1:                               bitmasks);
   2:     DataBuffer db = new DataBufferInt(data, w*h);
   3:     WritableRaster raster = Raster.createWritableRaster(sm, db, null);
   4:     
   5:     return new BufferedImage(cm, raster, false, null);

View Full Code Here
   1:             case DataBuffer.TYPE_INT:
   2:                 return new DataBufferInt(size, numBanks);
   3:             case DataBuffer.TYPE_FLOAT:
   4:                 return new DataBufferFloat(size, numBanks);
   5:             case DataBuffer.TYPE_DOUBLE:

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:                     }
   2:                     db = new DataBufferInt(bankData, (int) size);
   3:                 }
   4:                     break;
   5:                 case DataBuffer.TYPE_FLOAT: {

View Full Code Here
   1:        dcm = new DirectColorModel(32, rMask32, gMask32, bMask32);
   2:        db = new DataBufferInt(imageDataInt, imageDataInt.length);
   3:        wr = Raster.createPackedRaster(db, w, h, w, 
   4:                       new int[] {rMask32, gMask32, bMask32},
   5:                       null);

View Full Code Here

Method Details

getBankData

public int[][] getBankData()
Returns the data arrays for all banks.
Returns:
All of the data arrays.
Usages and Demos :

View More Examples of getBankData()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.PixelInterleavedSampleModel;
   4:         ...
   5:         if (forceTransparentWhite) {
   6:             DataBufferInt biDB=(DataBufferInt)img.getRaster().getDataBuffer();
   7:             int scanStride = sppsm.getScanlineStride();
   8:         ...
   9:             int dbOffset = biDB.getOffset();
  10:             int pixels[] = biDB.getBankData()[0];
  11:             int p = dbOffset;

View Full Code Here
   1: import java.awt.image.BufferedImage;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.SinglePixelPackedSampleModel;
   4:         ...
   5:             int w = img.getWidth(), h = img.getHeight();
   6:             DataBufferInt biDB = (DataBufferInt)img.getRaster().getDataBuffer();
   7:             int scanStride = ((SinglePixelPackedSampleModel)
   8:         ...
   9:             int dbOffset = biDB.getOffset();
  10:             int pixels[] = biDB.getBankData()[0];
  11:             int p = dbOffset;

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.Raster;
   4:         ...
   5:             (SinglePixelPackedSampleModel)wr.getSampleModel();
   6:         DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
   7: 
   8:         ...
   9:                             wr.getMinY()-wr.getSampleModelTranslateY()));
  10:         final int pixels[]   = db.getBankData()[0];
  11:         final int width      = wr.getWidth();

View Full Code Here
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.Raster;
   4:         ...
   5:             (SinglePixelPackedSampleModel)wr.getSampleModel();
   6:         DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
   7: 
   8:         ...
   9:                             wr.getMinY()-wr.getSampleModelTranslateY()));
  10:         final int pixels[]   = db.getBankData()[0];
  11:         final int width      = wr.getWidth();

View Full Code Here
   1: import java.awt.image.DataBufferByte;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.PixelInterleavedSampleModel;
   4:         ...
   5:             
   6:         final byte alpPixels[] = alpDB.getBankData()[0];
   7: 
   8:         ...
   9: 
  10:         DataBufferInt srcDB   = (DataBufferInt)wr.getDataBuffer();
  11:         final int     srcBase 
  12:         ...
  13: 
  14:         final int srcPixels[] = srcDB.getBankData()[0];

View Full Code Here

getData

public int[] getData()
Returns the default (first) int data array in DataBuffer.
Returns:
The first integer data array.
Usages and Demos :

View More Examples of getData()
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.FilteredImageSource;
   4:         ...
   5:     if (raster.getSampleModel ().getDataType () == DataBuffer.TYPE_INT 
   6:         && db instanceof DataBufferInt 
   7:         && db.getNumBanks () == 1)
   8:         ...
   9: 
  10:         DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer ();
  11: 
  12:         ...
  13:                  return drawRaster (b.getColorModel (), 
  14:                                     b.getData(), 

View Full Code Here

getData

public int[] getData(int bank)
Returns the data array for the specified bank.
Parameters:
bank - The bank whose data array you want to get.
Returns:
The data array for the specified bank.

getElem

public int getElem(int i)
Returns the requested data array element from the first (default) bank.
Overrides:
getElem in interface DataBuffer
Parameters:
i - The data array element you want to get.
Returns:
The requested data array element as an integer.

getElem

public int getElem(int bank,
                   int i)
Returns the requested data array element from the specified bank.
Overrides:
getElem in interface DataBuffer
Parameters:
bank - The bank from which you want to get a data array element.
i - The data array element you want to get.
Returns:
The requested data array element as an integer.

setElem

public void setElem(int i,
                    int val)
Sets the requested data array element in the first (default) bank to the specified value.
Overrides:
setElem in interface DataBuffer
Parameters:
i - The data array element you want to set.
val - The integer value to which you want to set the data array element.
Usages and Demos :

View More Examples of setElem(int i,int val)
   1: import java.awt.image.DataBuffer;
   2: import java.awt.image.DataBufferInt;
   3: import java.awt.image.FilteredImageSource;
   4:         ...
   5:     if (raster.getSampleModel ().getDataType () == DataBuffer.TYPE_INT 
   6:         && db instanceof DataBufferInt 
   7:         && db.getNumBanks () == 1)
   8:         ...
   9: 
  10:         DataBufferInt dbi = (DataBufferInt) raster.getDataBuffer ();
  11: 
  12:         ...
  13:         for (int i=0; i < pixels.length; i++) 
  14:           dbi.setElem(i, pixels[i]);

View Full Code Here

setElem

public void setElem(int bank,
                    int i,
                    int val)
Sets the requested data array element in the specified bank to the integer value i.
Overrides:
setElem in interface DataBuffer
Parameters:
bank - The bank in which you want to set the data array element.
i - The data array element you want to set.
val - The integer value to which you want to set the specified data array element.