android 使用etc1,ETC1 - Android SDK | Android Developers

android.opengl.ETC1

Class Overview

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

Summary

Constants

int

Size in bytes of a decoded block.

int

Size in bytes of an encoded block.

int

Accepted by the internalformat parameter of glCompressedTexImage2D.

int

Size of a PKM file header, in bytes.

Public Constructors

Public Methods

static

void

Decode a block of pixels.

static

void

Buffer in, Buffer out, int width, int height, int pixelSize, int stride)

Decode an entire image.

static

void

Buffer in, int validPixelMask, Buffer out)

Encode a block of pixels.

static

void

Buffer in, int width, int height, int pixelSize, int stride, Buffer out)

Encode an entire image.

static

void

Buffer header, int width, int height)

Format a PKM header

static

int

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

static

int

Read the image height from a PKM header

static

int

Read the image width from a PKM header

static

boolean

Check if a PKM header is correctly formatted.

[Expand]

Inherited Methods

87944d9d2f32762f87b3e5605420d927.png

From class

java.lang.Object

Creates and returns a copy of this Object.

boolean

Compares this instance with the specified object and indicates if they

are equal.

void

Invoked when the garbage collector has detected that this instance is no longer reachable.

final

Class>

Returns the unique instance of

int

Returns an integer hash code for this object.

final

void

Causes a thread which is waiting on this object's monitor (by means of

calling one of the wait() methods) to be woken up.

final

void

Causes all threads which are waiting on this object's monitor (by means

of calling one of the wait() methods) to be woken up.

Returns a string containing a concise, human-readable description of this

object.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

Constants

public

static

final

int

DECODED_BLOCK_SIZE

Size in bytes of a decoded block.

Constant Value:

48

(0x00000030)

public

static

final

int

ENCODED_BLOCK_SIZE

Size in bytes of an encoded block.

Constant Value:

8

(0x00000008)

public

static

final

int

ETC1_RGB8_OES

Accepted by the internalformat parameter of glCompressedTexImage2D.

Constant Value:

36196

(0x00008d64)

public

static

final

int

ETC_PKM_HEADER_SIZE

Size of a PKM file header, in bytes.

Constant Value:

16

(0x00000010)

Public Constructors

public

ETC1

()

Public Methods

public

static

void

decodeBlock

Decode a block of pixels.

Parameters

ina native order direct buffer of size ENCODED_BLOCK_SIZE that contains the

ETC1 compressed version of the data.

outa 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

void

decodeImage

(Buffer in, Buffer out, int width, int height, int pixelSize, int stride)

Decode an entire image.

Parameters

innative order direct buffer of the encoded data.

outnative 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.

pixelSizemust be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image,

3 is a GL_BYTE RGB image.

public

static

void

encodeBlock

(Buffer in, int validPixelMask, Buffer out)

Encode a block of pixels.

Parameters

ina 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).

validPixelMaskis 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.

outa native order direct buffer of size ENCODED_BLOCK_SIZE that receives the

ETC1 compressed version of the data.

public

static

void

encodeImage

(Buffer in, int width, int height, int pixelSize, int stride, Buffer out)

Encode an entire image.

Parameters

ina native order direct buffer of the image data. Formatted such that

pixel (x,y) is at pIn + pixelSize * x + stride * y;

pixelSizemust be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image,

3 is a GL_BYTE RGB image.

outa native order direct buffer of the encoded data.

Must be large enough to store entire encoded image.

public

static

void

formatHeader

(Buffer header, int width, int height)

Format a PKM header

Parameters

headernative order direct buffer of the header.

widththe width of the image in pixels.

heightthe height of the image in pixels.

public

static

int

getEncodedDataSize

(int width, int height)

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

public

static

int

getHeight

(Buffer header)

Read the image height from a PKM header

Parameters

headernative order direct buffer of the header.

public

static

int

getWidth

(Buffer header)

Read the image width from a PKM header

Parameters

headernative order direct buffer of the header.

public

static

boolean

isValid

(Buffer header)

Check if a PKM header is correctly formatted.

Parameters

headernative order direct buffer of the header.

Except as noted, this content is licensed under Apache 2.0.

For details and restrictions, see the Content License.

Android 4.2 r1 —

你可能感兴趣的:(android,使用etc1)