libgdx API

com.badlogic.gdx.graphics.glutils
Class ETC1

java.lang.Object
  extended by 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.

Author:
mzechner

Nested Class Summary
static class ETC1.ETC1Data
          Class for storing ETC1 compressed image data.
 
Field Summary
static int ETC1_RGB8_OES
           
static int PKM_HEADER_SIZE
          The PKM header size in bytes
 
Constructor Summary
ETC1()
           
 
Method Summary
static Pixmap decodeImage(ETC1.ETC1Data etc1Data, Pixmap.Format format)
          Takes ETC1 compressed image data and converts it to a Pixmap.Format.RGB565 or Pixmap.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 the ByteBuffer.
static int getCompressedDataSize(int width, int height)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PKM_HEADER_SIZE

public static int PKM_HEADER_SIZE
The PKM header size in bytes


ETC1_RGB8_OES

public static int ETC1_RGB8_OES
Constructor Detail

ETC1

public ETC1()
Method Detail

encodeImage

public static ETC1.ETC1Data encodeImage(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme. Only Pixmap.Format.RGB565 and Pixmap.Format.RGB888 are supported.

Parameters:
pixmap - the Pixmap
Returns:
the ETC1.ETC1Data

encodeImagePKM

public static ETC1.ETC1Data encodeImagePKM(Pixmap pixmap)
Encodes the image via the ETC1 compression scheme. Only Pixmap.Format.RGB565 and Pixmap.Format.RGB888 are supported. Adds a PKM header in front of the compressed image data.

Parameters:
pixmap - the Pixmap
Returns:
the ETC1.ETC1Data

decodeImage

public static Pixmap decodeImage(ETC1.ETC1Data etc1Data,
                                 Pixmap.Format format)
Takes ETC1 compressed image data and converts it to a Pixmap.Format.RGB565 or Pixmap.Format.RGB888 Pixmap. Does not modify the ByteBuffer's position or limit.

Parameters:
etc1Data - the ETC1.ETC1Data instance
format - either Pixmap.Format.RGB565 or Pixmap.Format.RGB888
Returns:
the Pixmap

getCompressedDataSize

public static int getCompressedDataSize(int width,
                                        int height)
Parameters:
width - the width in pixels
height - 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 the ByteBuffer. Does not modify the position or limit of the ByteBuffer.

Parameters:
header - the direct native order ByteBuffer
offset - the offset to the header in bytes
width - the width in pixels
height - the height in pixels

libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)