|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectzombie.core.textures.PNGDecoder
public class PNGDecoder
A PNGDecoder. The slick PNG decoder is based on this class :)
Nested Class Summary | |
---|---|
static class |
PNGDecoder.Format
|
Field Summary | |
---|---|
boolean |
bDoMask
|
boolean[] |
mask
|
int |
maskID
|
long |
readTotal
|
Constructor Summary | |
---|---|
PNGDecoder(java.io.InputStream input,
boolean bDoMask)
|
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)
Decodes the image into the specified buffer. |
void |
decodeFlipped(java.nio.ByteBuffer buffer,
int stride,
PNGDecoder.Format fmt)
Decodes the image into the specified buffer. |
int |
getHeight()
|
int |
getWidth()
|
boolean |
hasAlpha()
Checks if the image has transparency information either from an alpha channel or from a tRNS chunk. |
boolean |
hasAlphaChannel()
Checks if the image has a real alpha channel. |
boolean |
isRGB()
|
void |
overwriteTRNS(byte r,
byte g,
byte b)
Overwrites the tRNS chunk entry to make a selected color transparent. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int maskID
public boolean[] mask
public boolean bDoMask
public long readTotal
Constructor Detail |
---|
public PNGDecoder(java.io.InputStream input, boolean bDoMask) throws java.io.IOException
java.io.IOException
Method Detail |
---|
public int getHeight()
public int getWidth()
public boolean hasAlphaChannel()
hasAlpha()
public boolean hasAlpha()
hasAlphaChannel()
,
overwriteTRNS(byte, byte, byte)
public boolean isRGB()
public void overwriteTRNS(byte r, byte g, byte b)
This can only be invoked when the image has no alpha channel.
Calling this method causes hasAlpha()
to return true.
r
- the red component of the color to make transparentg
- the green component of the color to make transparentb
- the blue component of the color to make transparent
java.lang.UnsupportedOperationException
- if the tRNS chunk data can't be sethasAlphaChannel()
public PNGDecoder.Format decideTextureFormat(PNGDecoder.Format fmt)
fmt
- the desired format
java.lang.UnsupportedOperationException
- if this PNG file can't be decodedpublic void decode(java.nio.ByteBuffer buffer, int stride, PNGDecoder.Format fmt) throws java.io.IOException
buffer
- the bufferstride
- the stride in bytes from start of a line to start of the next line, can be negative.fmt
- the target format into which the image should be decoded.
java.io.IOException
- if a read or data error occurred
java.lang.IllegalArgumentException
- if the start position of a line falls outside the buffer
java.lang.UnsupportedOperationException
- if the image can't be decoded into the desired formatpublic void decodeFlipped(java.nio.ByteBuffer buffer, int stride, PNGDecoder.Format fmt) throws java.io.IOException
buffer
- the bufferstride
- the stride in bytes from start of a line to start of the next line, must be positive.fmt
- the target format into which the image should be decoded.
java.io.IOException
- if a read or data error occurred
java.lang.IllegalArgumentException
- if the start position of a line falls outside the buffer
java.lang.UnsupportedOperationException
- if the image can't be decoded into the desired format
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |