Class ETC1
- java.lang.Object
-
- com.badlogic.gdx.graphics.glutils.ETC1
-
public class ETC1 extends java.lang.Object
Class 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 class
ETC1.ETC1Data
Class for storing ETC1 compressed image data.
-
Field Summary
Fields Modifier and Type Field Description static int
ETC1_RGB8_OES
static int
PKM_HEADER_SIZE
The 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 Pixmap
decodeImage(ETC1.ETC1Data etc1Data, Pixmap.Format format)
Takes ETC1 compressed image data and converts it to aPixmap.Format.RGB565
orPixmap.Format.RGB888
Pixmap
.static ETC1.ETC1Data
encodeImage(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme.static ETC1.ETC1Data
encodeImagePKM(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme.static void
formatHeader(java.nio.ByteBuffer header, int offset, int width, int height)
Writes a PKM header to theByteBuffer
.static int
getCompressedDataSize(int width, int height)
-
-
-
Method Detail
-
encodeImage
public static ETC1.ETC1Data encodeImage(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme. OnlyPixmap.Format.RGB565
andPixmap.Format.RGB888
are 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.RGB565
andPixmap.Format.RGB888
are 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.RGB565
orPixmap.Format.RGB888
Pixmap
. Does not modify the ByteBuffer's position or limit.- Parameters:
etc1Data
- theETC1.ETC1Data
instanceformat
- eitherPixmap.Format.RGB565
orPixmap.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 orderByteBuffer
offset
- the offset to the header in byteswidth
- the width in pixelsheight
- the height in pixels
-
-