com.jogamp.nativewindow.awt

## Class DirectDataBufferInt

- java.lang.Object
- - java.awt.image.DataBuffer
  - - com.jogamp.nativewindow.awt.DirectDataBufferInt

-     public final class DirectDataBufferInt
      extends DataBuffer

  `DataBuffer` specialization using NIO direct buffer of type `DataBuffer.TYPE_INT` as storage.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DirectDataBufferInt.BufferedImageInt`
    `static class` | `DirectDataBufferInt.DirectWritableRaster`

  - ### Field Summary

    - ### Fields inherited from class java.awt.image.DataBuffer

      `TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectDataBufferInt(int size)` Constructs an nio integer-based `DataBuffer` with a single bank and the specified size.
    `DirectDataBufferInt(IntBuffer dataArray, int size)` Constructs an nio integer-based `DataBuffer` with a single bank using the specified array.
    `DirectDataBufferInt(int size, int numBanks)` Constructs an nio integer-based `DataBuffer` with the specified number of banks, all of which are the specified size.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DirectDataBufferInt.BufferedImageInt` | `createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties)` Creates a `DirectDataBufferInt.BufferedImageInt` using a `direct color model` in `sRGB color space`. It uses a `DirectDataBufferInt.DirectWritableRaster` utilizing `DirectDataBufferInt` storage.
    `IntBuffer` | `getData()` Returns the default (first) int data array in `DataBuffer`.
    `IntBuffer` | `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, getElemDouble, getElemDouble, getElemFloat, getElemFloat, getNumBanks, getOffset, getOffsets, getSize, setElemDouble, setElemDouble, setElemFloat, setElemFloat`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DirectDataBufferInt

          public DirectDataBufferInt(int size)

      Constructs an nio integer-based `DataBuffer` with a single bank and the specified size.
      Parameters:
        `size` - The size of the `DataBuffer`.

    - #### DirectDataBufferInt

          public DirectDataBufferInt(int size,
                             int numBanks)

      Constructs an nio 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 a`DataBuffer`.

    - #### DirectDataBufferInt

          public DirectDataBufferInt(IntBuffer dataArray,
                             int size)

      Constructs an nio 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:
        `dataArray` - The integer array for the `DataBuffer`.
        `size` - The size of the `DataBuffer` bank.

  - ### Method Detail

    - #### createBufferedImage

          public static DirectDataBufferInt.BufferedImageInt createBufferedImage(int width,
                                                                 int height,
                                                                 int imageType,
                                                                 Point location,
                                                                 Hashtable<?,?> properties)

      Creates a `DirectDataBufferInt.BufferedImageInt` using a `direct color model` in `sRGB color space`.
      It uses a `DirectDataBufferInt.DirectWritableRaster` utilizing `DirectDataBufferInt` storage.

      Note that due to using the custom storage type `DirectDataBufferInt`, the resulting `BufferedImage`'s `image-type` is of `TYPE_CUSTOM`. We are not able to change this detail, since the AWT image implementation associates the `image-type` with a build-in storage-type. Use `DirectDataBufferInt.BufferedImageInt.getCustomType()` to retrieve the custom image-type, which will return the `imageType` value passed here.

      Parameters:
        `width` -
        `height` -
        `imageType` - one of `TYPE_INT_ARGB`, `TYPE_INT_ARGB_PRE`, `TYPE_INT_RGB` or `TYPE_INT_BGR`.
        `location` - origin, if `null` 0/0 is assumed.
        `properties` - `Hashtable` of `String`/`Object` pairs. Used for `BufferedImage.getProperty(String)` etc.
      Returns:

    - #### getData

          public IntBuffer getData()

      Returns the default (first) int data array in `DataBuffer`.
      Returns:
        The first integer data array.

    - #### getData

          public IntBuffer 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 class `DataBuffer`
      Parameters:
        `i` - The data array element you want to get.
      Returns:
        The requested data array element as an integer.
      See Also:
        `setElem(int, int)`, `setElem(int, int, int)`

    - #### getElem

          public int getElem(int bank,
                    int i)

      Returns the requested data array element from the specified bank.
      Specified by:
        `getElem` in class `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.
      See Also:
        `setElem(int, int)`, `setElem(int, int, int)`

    - #### 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 class `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.
      See Also:
        `getElem(int)`, `getElem(int, int)`

    - #### 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`.
      Specified by:
        `setElem` in class `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.
      See Also:
        `getElem(int)`, `getElem(int, int)`

Copyright 2010 JogAmp Community.