# PNGDecoder (Slick - The 2D Library)
Date: 2013-06-03

## org.newdawn.slick.opengl
Class PNGDecoder

    java.lang.Object
      org.newdawn.slick.opengl.PNGDecoder

    public class PNGDecoder

extends java.lang.Object

A PNGDecoder. The slick PNG decoder is based on this class :)

Author:
  Matthias Mann

Nested Class Summary
`static class` `PNGDecoder.Format`

Field Summary
`static PNGDecoder.Format` `ABGR`
`static PNGDecoder.Format` `ALPHA`
`static PNGDecoder.Format` `BGRA`
`static PNGDecoder.Format` `LUMINANCE`
`static PNGDecoder.Format` `LUMINANCE_ALPHA`
`static PNGDecoder.Format` `RGB`
`static PNGDecoder.Format` `RGBA`

Constructor Summary
`PNGDecoder(java.io.InputStream input)`

Method Summary
`PNGDecoder.Format` `decideTextureFormat(PNGDecoder.Format fmt)` Computes the implemented format conversion for the desired format.
`void` `decode(java.nio.ByteBuffer buffer, int stride, PNGDecoder.Format fmt)`
`int` `getHeight()`
`int` `getWidth()`
`boolean` `hasAlpha()`
`boolean` `isRGB()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ALPHA

    public static PNGDecoder.Format ALPHA

### LUMINANCE

    public static PNGDecoder.Format LUMINANCE

### LUMINANCE_ALPHA

    public static PNGDecoder.Format LUMINANCE_ALPHA

### RGB

    public static PNGDecoder.Format RGB

### RGBA

    public static PNGDecoder.Format RGBA

### BGRA

    public static PNGDecoder.Format BGRA

### ABGR

    public static PNGDecoder.Format ABGR

Constructor Detail

### PNGDecoder

    public PNGDecoder(java.io.InputStream input)
               throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getHeight

    public int getHeight()

### getWidth

    public int getWidth()

### hasAlpha

    public boolean hasAlpha()

### isRGB

    public boolean isRGB()

### decideTextureFormat

    public PNGDecoder.Format decideTextureFormat(PNGDecoder.Format fmt)

  Computes the implemented format conversion for the desired format.

  Parameters:
    `fmt` - the desired format
  Returns:
    format which best matches the desired format
  Throws:
    `java.lang.UnsupportedOperationException` - if this PNG file can't be decoded

### decode

    public void decode(java.nio.ByteBuffer buffer,
                       int stride,
                       PNGDecoder.Format fmt)
                throws java.io.IOException

  Throws:
    `java.io.IOException`

Copyright © 2006 New Dawn Software. All Rights Reserved.