Most visited

Recently visited

Added in API level 8

ETC1Util

public class ETC1Util
extends Object

java.lang.Object
   ↳ android.opengl.ETC1Util


使用ETC1压缩纹理的实用方法。

Summary

Nested classes

class ETC1Util.ETC1Texture

压缩ETC1纹理的实用程序类。

Public constructors

ETC1Util()

Public methods

static ETC1Util.ETC1Texture compressTexture(Buffer input, int width, int height, int pixelSize, int stride)

将图像压缩成ETC1纹理的辅助功能。

static ETC1Util.ETC1Texture createTexture(InputStream input)

从包含PKM格式压缩纹理的输入流创建新的ETC1Texture。

static boolean isETC1Supported()

检查活动OpenGL ES上下文是否支持ETC1纹理压缩。

static void loadTexture(int target, int level, int border, int fallbackFormat, int fallbackType, InputStream input)

加载ETC1纹理的便捷方法,无论活动OpenGL上下文是否支持ETC1纹理压缩格式。

static void loadTexture(int target, int level, int border, int fallbackFormat, int fallbackType, ETC1Util.ETC1Texture texture)

加载ETC1纹理的便捷方法,无论活动OpenGL上下文是否支持ETC1纹理压缩格式。

static void writeTexture(ETC1Util.ETC1Texture texture, OutputStream output)

将ETC1Texture写入格式化为PKM文件的输出流的Helper函数。

Inherited methods

From class java.lang.Object

Public constructors

ETC1Util

Added in API level 8
ETC1Util ()

Public methods

compressTexture

Added in API level 8
ETC1Util.ETC1Texture compressTexture (Buffer input, 
                int width, 
                int height, 
                int pixelSize, 
                int stride)

将图像压缩成ETC1纹理的辅助功能。

Parameters
input Buffer: a native order direct buffer containing the image data
width int: the width of the image in pixels
height int: the height of the image in pixels
pixelSize int: the size of a pixel in bytes (2 or 3)
stride int: the width of a line of the image in bytes
Returns
ETC1Util.ETC1Texture the ETC1 texture.

createTexture

Added in API level 8
ETC1Util.ETC1Texture createTexture (InputStream input)

从包含PKM格式压缩纹理的输入流创建新的ETC1Texture。

Parameters
input InputStream: an input stream containing a PKM formatted compressed texture.
Returns
ETC1Util.ETC1Texture an ETC1Texture read from the input stream.
Throws
IOException

isETC1Supported

Added in API level 8
boolean isETC1Supported ()

检查活动OpenGL ES上下文是否支持ETC1纹理压缩。

Returns
boolean true if the active OpenGL ES context supports ETC1 texture compression.

loadTexture

Added in API level 8
void loadTexture (int target, 
                int level, 
                int border, 
                int fallbackFormat, 
                int fallbackType, 
                InputStream input)

加载ETC1纹理的便捷方法,无论活动OpenGL上下文是否支持ETC1纹理压缩格式。

Parameters
target int: the texture target.
level int: the texture level
border int: the border size. Typically 0.
fallbackFormat int: the format to use if ETC1 texture compression is not supported. Must be GL_RGB.
fallbackType int: the type to use if ETC1 texture compression is not supported. Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel, or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.
input InputStream: the input stream containing an ETC1 texture in PKM format.
Throws
IOException

loadTexture

Added in API level 8
void loadTexture (int target, 
                int level, 
                int border, 
                int fallbackFormat, 
                int fallbackType, 
                ETC1Util.ETC1Texture texture)

加载ETC1纹理的便捷方法,无论活动OpenGL上下文是否支持ETC1纹理压缩格式。

Parameters
target int: the texture target.
level int: the texture level
border int: the border size. Typically 0.
fallbackFormat int: the format to use if ETC1 texture compression is not supported. Must be GL_RGB.
fallbackType int: the type to use if ETC1 texture compression is not supported. Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel, or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.
texture ETC1Util.ETC1Texture: the ETC1 to load.

writeTexture

Added in API level 8
void writeTexture (ETC1Util.ETC1Texture texture, 
                OutputStream output)

将ETC1Texture写入格式化为PKM文件的输出流的Helper函数。

Parameters
texture ETC1Util.ETC1Texture: the input texture.
output OutputStream: the stream to write the formatted texture data to.
Throws
IOException

Hooray!