Added in API level 8

ETC1Util


open class ETC1Util
kotlin.Any
   ↳ android.opengl.ETC1Util

Utility methods for using ETC1 compressed textures.

Summary

Nested classes
open

A utility class encapsulating a compressed ETC1 texture.

Public constructors

Public methods
open static ETC1Util.ETC1Texture!
compressTexture(input: Buffer!, width: Int, height: Int, pixelSize: Int, stride: Int)

Helper function that compresses an image into an ETC1Texture.

open static ETC1Util.ETC1Texture!

Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.

open static Boolean

Check if ETC1 texture compression is supported by the active OpenGL ES context.

open static Unit
loadTexture(target: Int, level: Int, border: Int, fallbackFormat: Int, fallbackType: Int, texture: ETC1Util.ETC1Texture!)

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

open static Unit
loadTexture(target: Int, level: Int, border: Int, fallbackFormat: Int, fallbackType: Int, input: InputStream!)

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

open static Unit

Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.

Public constructors

ETC1Util

ETC1Util()

Public methods

compressTexture

Added in API level 8
open static fun compressTexture(
    input: Buffer!,
    width: Int,
    height: Int,
    pixelSize: Int,
    stride: Int
): ETC1Util.ETC1Texture!

Helper function that compresses an image into an ETC1Texture.

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
Return
ETC1Util.ETC1Texture! the ETC1 texture.

createTexture

Added in API level 8
open static fun createTexture(input: InputStream!): ETC1Util.ETC1Texture!

Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.

Parameters
input InputStream!: an input stream containing a PKM formatted compressed texture.
Return
ETC1Util.ETC1Texture! an ETC1Texture read from the input stream.
Exceptions
java.io.IOException

isETC1Supported

Added in API level 8
open static fun isETC1Supported(): Boolean

Check if ETC1 texture compression is supported by the active OpenGL ES context.

Return
Boolean true if the active OpenGL ES context supports ETC1 texture compression.

loadTexture

Added in API level 8
open static fun loadTexture(
    target: Int,
    level: Int,
    border: Int,
    fallbackFormat: Int,
    fallbackType: Int,
    texture: ETC1Util.ETC1Texture!
): Unit

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

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.

loadTexture

Added in API level 8
open static fun loadTexture(
    target: Int,
    level: Int,
    border: Int,
    fallbackFormat: Int,
    fallbackType: Int,
    input: InputStream!
): Unit

Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.

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.
Exceptions
java.io.IOException

writeTexture

Added in API level 8
open static fun writeTexture(
    texture: ETC1Util.ETC1Texture!,
    output: OutputStream!
): Unit

Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.

Parameters
texture ETC1Util.ETC1Texture!: the input texture.
output OutputStream!: the stream to write the formatted texture data to.
Exceptions
java.io.IOException