com.jogamp.opengl.util

## Class PNGPixelRect

- java.lang.Object
- - javax.media.nativewindow.util.PixelRectangle.GenericPixelRect
  - - com.jogamp.opengl.util.PNGPixelRect

- All Implemented Interfaces:
    PixelRectangle

      public class PNGPixelRect
      extends PixelRectangle.GenericPixelRect

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface javax.media.nativewindow.util.PixelRectangle

      `PixelRectangle.GenericPixelRect`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PNGPixelRect(PixelFormat pixelformat, DimensionImmutable size, int strideInBytes, boolean isGLOriented, ByteBuffer pixels, double dpiX, double dpiY)` Creates a PNGPixelRect from data supplied by the end user.
    `PNGPixelRect(PixelRectangle src, double dpiX, double dpiY)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `getDpi()` Returns the dpi of the image.
    `static PNGPixelRect` | `read(InputStream in, PixelFormat ddestFmt, boolean destDirectBuffer, int destMinStrideInBytes, boolean destIsGLOriented)` Reads a PNG image from the specified InputStream.
    `void` | `write(OutputStream outstream, boolean closeOutstream)`
    `static void` | `write(PixelFormat pixelformat, DimensionImmutable size, int strideInPixels, boolean isGLOriented, IntBuffer pixels, double dpiX, double dpiY, OutputStream outstream, boolean closeOutstream)`

    - ### Methods inherited from class javax.media.nativewindow.util.PixelRectangle.GenericPixelRect

      `getPixelformat, getPixels, getSize, getStride, hashCode, isGLOriented, toString`

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

      `equals, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PNGPixelRect

          public PNGPixelRect(PixelFormat pixelformat,
                      DimensionImmutable size,
                      int strideInBytes,
                      boolean isGLOriented,
                      ByteBuffer pixels,
                      double dpiX,
                      double dpiY)

      Creates a PNGPixelRect from data supplied by the end user. Shares data with the passed ByteBuffer.
      Parameters:
        `pixelformat` -
        `size` -
        `strideInBytes` -
        `isGLOriented` - see `PixelRectangle.GenericPixelRect.isGLOriented()`.
        `pixels` -
        `dpiX` -
        `dpiY` -

    - #### PNGPixelRect

          public PNGPixelRect(PixelRectangle src,
                      double dpiX,
                      double dpiY)

  - ### Method Detail

    - #### read

          public static PNGPixelRect read(InputStream in,
                          PixelFormat ddestFmt,
                          boolean destDirectBuffer,
                          int destMinStrideInBytes,
                          boolean destIsGLOriented)
                                   throws IOException

      Reads a PNG image from the specified InputStream.

      Implicitly converts the image to match the desired:

      - `PixelFormat`, see `PixelRectangle.GenericPixelRect.getPixelformat()`
      - `destStrideInBytes`, see `PixelRectangle.GenericPixelRect.getStride()`
      - `destIsGLOriented`, see `PixelRectangle.GenericPixelRect.isGLOriented()`
      Parameters:
        `in` - input stream
        `destFmt` - desired destination `PixelFormat` incl. conversion, maybe `null` to use source `PixelFormat`
        `destDirectBuffer` - if true, using a direct NIO buffer, otherwise an array backed buffer
        `destMinStrideInBytes` - used if greater than PNG's stride, otherwise using PNG's stride. Stride is width * bytes-per-pixel.
        `destIsGLOriented` -
      Returns:
        the newly created PNGPixelRect instance
      Throws:
        `IOException`

    - #### getDpi

          public double[] getDpi()

      Returns the dpi of the image.

    - #### write

          public void write(OutputStream outstream,
                   boolean closeOutstream)
                     throws IOException

      Throws:
        `IOException`

    - #### write

          public static void write(PixelFormat pixelformat,
                   DimensionImmutable size,
                   int strideInPixels,
                   boolean isGLOriented,
                   IntBuffer pixels,
                   double dpiX,
                   double dpiY,
                   OutputStream outstream,
                   boolean closeOutstream)
                            throws IOException

      Throws:
        `IOException`

Copyright 2010 JogAmp Community.