FileDocCategorySizeDatePackage
ETC1.javaAPI DocAndroid 5.1 API4919Thu Mar 12 22:22:40 GMT 2015android.opengl

ETC1

public class ETC1 extends Object
Methods for encoding and decoding ETC1 textures.

The standard for the ETC1 texture format can be found at http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt

The PKM file format is of a 16-byte header that describes the image bounds followed by the encoded ETC1 texture data.

see
ETC1Util

Fields Summary
public static final int
ENCODED_BLOCK_SIZE
Size in bytes of an encoded block.
public static final int
DECODED_BLOCK_SIZE
Size in bytes of a decoded block.
public static final int
ETC_PKM_HEADER_SIZE
Size of a PKM file header, in bytes.
public static final int
ETC1_RGB8_OES
Accepted by the internalformat parameter of glCompressedTexImage2D.
Constructors Summary
Methods Summary
public static native voiddecodeBlock(java.nio.Buffer in, java.nio.Buffer out)
Decode a block of pixels.

param
in a native order direct buffer of size ENCODED_BLOCK_SIZE that contains the ETC1 compressed version of the data.
param
out a native order direct buffer of size DECODED_BLOCK_SIZE that will receive the decoded data. The data represents a 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R value of pixel (x, y).

public static native voiddecodeImage(java.nio.Buffer in, java.nio.Buffer out, int width, int height, int pixelSize, int stride)
Decode an entire image.

param
in native order direct buffer of the encoded data.
param
out native order direct buffer of the image data. Will be written such that pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be large enough to store entire image.
param
pixelSize must be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.

public static native voidencodeBlock(java.nio.Buffer in, int validPixelMask, java.nio.Buffer out)
Encode a block of pixels.

param
in a native order direct buffer of size DECODED_BLOCK_SIZE that represent a 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R value of pixel (x, y).
param
validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
param
out a native order direct buffer of size ENCODED_BLOCK_SIZE that receives the ETC1 compressed version of the data.

public static native voidencodeImage(java.nio.Buffer in, int width, int height, int pixelSize, int stride, java.nio.Buffer out)
Encode an entire image.

param
in a native order direct buffer of the image data. Formatted such that pixel (x,y) is at pIn + pixelSize * x + stride * y;
param
out a native order direct buffer of the encoded data. Must be large enough to store entire encoded image.
param
pixelSize must be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.

public static native voidformatHeader(java.nio.Buffer header, int width, int height)
Format a PKM header

param
header native order direct buffer of the header.
param
width the width of the image in pixels.
param
height the height of the image in pixels.

public static native intgetEncodedDataSize(int width, int height)
Return the size of the encoded image data (does not include size of PKM header).

public static native intgetHeight(java.nio.Buffer header)
Read the image height from a PKM header

param
header native order direct buffer of the header.

public static native intgetWidth(java.nio.Buffer header)
Read the image width from a PKM header

param
header native order direct buffer of the header.

public static native booleanisValid(java.nio.Buffer header)
Check if a PKM header is correctly formatted.

param
header native order direct buffer of the header.