Class ETC1
- java.lang.Object
-
- com.badlogic.gdx.graphics.glutils.ETC1
-
public class ETC1 extends java.lang.ObjectClass for encoding and decoding ETC1 compressed images. Also provides methods to add a PKM header.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classETC1.ETC1DataClass for storing ETC1 compressed image data.
-
Field Summary
Fields Modifier and Type Field Description static intETC1_RGB8_OESstatic intPKM_HEADER_SIZEThe PKM header size in bytes
-
Constructor Summary
Constructors Constructor Description ETC1()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PixmapdecodeImage(ETC1.ETC1Data etc1Data, Pixmap.Format format)Takes ETC1 compressed image data and converts it to aPixmap.Format.RGB565orPixmap.Format.RGB888Pixmap.static ETC1.ETC1DataencodeImage(Pixmap pixmap)Encodes the image via the ETC1 compression scheme.static ETC1.ETC1DataencodeImagePKM(Pixmap pixmap)Encodes the image via the ETC1 compression scheme.static voidformatHeader(java.nio.ByteBuffer header, int offset, int width, int height)Writes a PKM header to theByteBuffer.static intgetCompressedDataSize(int width, int height)
-
-
-
Method Detail
-
encodeImage
public static ETC1.ETC1Data encodeImage(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme. OnlyPixmap.Format.RGB565andPixmap.Format.RGB888are supported.- Parameters:
pixmap- thePixmap- Returns:
- the
ETC1.ETC1Data
-
encodeImagePKM
public static ETC1.ETC1Data encodeImagePKM(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme. OnlyPixmap.Format.RGB565andPixmap.Format.RGB888are supported. Adds a PKM header in front of the compressed image data.- Parameters:
pixmap- thePixmap- Returns:
- the
ETC1.ETC1Data
-
decodeImage
public static Pixmap decodeImage(ETC1.ETC1Data etc1Data, Pixmap.Format format)
Takes ETC1 compressed image data and converts it to aPixmap.Format.RGB565orPixmap.Format.RGB888Pixmap. Does not modify the ByteBuffer's position or limit.- Parameters:
etc1Data- theETC1.ETC1Datainstanceformat- eitherPixmap.Format.RGB565orPixmap.Format.RGB888- Returns:
- the Pixmap
-
getCompressedDataSize
public static int getCompressedDataSize(int width, int height)- Parameters:
width- the width in pixelsheight- the height in pixels- Returns:
- the number of bytes needed to store the compressed data
-
formatHeader
public static void formatHeader(java.nio.ByteBuffer header, int offset, int width, int height)Writes a PKM header to theByteBuffer. Does not modify the position or limit of the ByteBuffer.- Parameters:
header- the direct native orderByteBufferoffset- the offset to the header in byteswidth- the width in pixelsheight- the height in pixels
-
-