Skip to content

Documentation / spryte / CompressedTexture

Class: CompressedTexture ​

Defined in: ktx2.ts:9

A block-compressed image, ready to upload as it is: it stays compressed in video memory, at 1 byte per pixel instead of 4. Make one with parseKtx2 and draw it like any image. Only the WebGL2 backend can draw it, and only when the GPU supports its format: check draw.compressedFormats and load another file otherwise.

Constructors ​

Constructor ​

new CompressedTexture(width, height, format, levels, premultiplied): CompressedTexture

Defined in: ktx2.ts:10

Parameters ​

width ​

number

height ​

number

format ​

CompressedFormat

levels ​

readonly Uint8Array<ArrayBufferLike>[]

Mip levels, largest first.

premultiplied ​

boolean

Whether colour was multiplied by alpha when encoded. spryte draws premultiplied colour, so encode it that way.

Returns ​

CompressedTexture

Properties ​

format ​

readonly format: CompressedFormat

Defined in: ktx2.ts:13


height ​

readonly height: number

Defined in: ktx2.ts:12


levels ​

readonly levels: readonly Uint8Array<ArrayBufferLike>[]

Defined in: ktx2.ts:15

Mip levels, largest first.


premultiplied ​

readonly premultiplied: boolean

Defined in: ktx2.ts:17

Whether colour was multiplied by alpha when encoded. spryte draws premultiplied colour, so encode it that way.


width ​

readonly width: number

Defined in: ktx2.ts:11