# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Ctors | Methods | Inherited Methods

# ETC1

`public class ETC1`
`extends Object` ``

java.lang.Object
↳ | android.opengl.ETC1

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 also:

- `ETC1Util`

## Summary

### Constants
`int` | `DECODED_BLOCK_SIZE` Size in bytes of a decoded block.
`int` | `ENCODED_BLOCK_SIZE` Size in bytes of an encoded block.
`int` | `ETC1_RGB8_OES` Accepted by the internalformat parameter of glCompressedTexImage2D.
`int` | `ETC_PKM_HEADER_SIZE` Size of a PKM file header, in bytes.

### Public constructors
`ETC1()`

### Public methods
`static void` | `decodeBlock(Buffer in, Buffer out)` Decode a block of pixels.
`static void` | `decodeImage(Buffer in, Buffer out, int width, int height, int pixelSize, int stride)` Decode an entire image.
`static void` | `encodeBlock(Buffer in, int validPixelMask, Buffer out)` Encode a block of pixels.
`static void` | `encodeImage(Buffer in, int width, int height, int pixelSize, int stride, Buffer out)` Encode an entire image.
`static void` | `formatHeader(Buffer header, int width, int height)` Format a PKM header
`static int` | `getEncodedDataSize(int width, int height)` Return the size of the encoded image data (does not include size of PKM header).
`static int` | `getHeight(Buffer header)` Read the image height from a PKM header
`static int` | `getWidth(Buffer header)` Read the image width from a PKM header
`static boolean` | `isValid(Buffer header)` Check if a PKM header is correctly formatted.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### DECODED_BLOCK_SIZE

    public static final int DECODED_BLOCK_SIZE

Size in bytes of a decoded block.

Constant Value: 48 (0x00000030)

### ENCODED_BLOCK_SIZE

    public static final int ENCODED_BLOCK_SIZE

Size in bytes of an encoded block.

Constant Value: 8 (0x00000008)

### ETC1_RGB8_OES

    public static final int ETC1_RGB8_OES

Accepted by the internalformat parameter of glCompressedTexImage2D.

Constant Value: 36196 (0x00008d64)

### ETC_PKM_HEADER_SIZE

    public static final int ETC_PKM_HEADER_SIZE

Size of a PKM file header, in bytes.

Constant Value: 16 (0x00000010)

## Public constructors

### ETC1

    public ETC1 ()

## Public methods

### decodeBlock

    public static void decodeBlock (Buffer in,
                    Buffer out)

Decode a block of pixels.

Parameters
`in` | `Buffer`: a native order direct buffer of size ENCODED_BLOCK_SIZE that contains the ETC1 compressed version of the data.
`out` | `Buffer`: 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).

### decodeImage

    public static void decodeImage (Buffer in,
                    Buffer out,
                    int width,
                    int height,
                    int pixelSize,
                    int stride)

Decode an entire image.

Parameters
`in` | `Buffer`: native order direct buffer of the encoded data.
`out` | `Buffer`: 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.
`width` | `int`
`height` | `int`
`pixelSize` | `int`: must be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
`stride` | `int`

### encodeBlock

    public static void encodeBlock (Buffer in,
                    int validPixelMask,
                    Buffer out)

Encode a block of pixels.

Parameters
`in` | `Buffer`: 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).
`validPixelMask` | `int`: 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.
`out` | `Buffer`: a native order direct buffer of size ENCODED_BLOCK_SIZE that receives the ETC1 compressed version of the data.

### encodeImage

    public static void encodeImage (Buffer in,
                    int width,
                    int height,
                    int pixelSize,
                    int stride,
                    Buffer out)

Encode an entire image.

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

### formatHeader

    public static void formatHeader (Buffer header,
                    int width,
                    int height)

Format a PKM header

Parameters
`header` | `Buffer`: native order direct buffer of the header.
`width` | `int`: the width of the image in pixels.
`height` | `int`: the height of the image in pixels.

### getEncodedDataSize

    public static int getEncodedDataSize (int width,
                    int height)

Return the size of the encoded image data (does not include size of PKM header).

Parameters
`width` | `int`
`height` | `int`

Returns
`int` |

### getHeight

    public static int getHeight (Buffer header)

Read the image height from a PKM header

Parameters
`header` | `Buffer`: native order direct buffer of the header.

Returns
`int` |

### getWidth

    public static int getWidth (Buffer header)

Read the image width from a PKM header

Parameters
`header` | `Buffer`: native order direct buffer of the header.

Returns
`int` |

### isValid

    public static boolean isValid (Buffer header)

Check if a PKM header is correctly formatted.

Parameters
`header` | `Buffer`: native order direct buffer of the header.

Returns
`boolean` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*