# Class: CompressedTexture

Defined in: [ktx2.ts:9](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L9)

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](../functions/parseKtx2.md) 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](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L10)

#### Parameters

##### width

`number`

##### height

`number`

##### format

[`CompressedFormat`](../type-aliases/CompressedFormat.md)

##### 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`](../type-aliases/CompressedFormat.md)

Defined in: [ktx2.ts:13](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L13)

***

### height

> `readonly` **height**: `number`

Defined in: [ktx2.ts:12](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L12)

***

### levels

> `readonly` **levels**: readonly `Uint8Array`\<`ArrayBufferLike`\>[]

Defined in: [ktx2.ts:15](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L15)

Mip levels, largest first.

***

### premultiplied

> `readonly` **premultiplied**: `boolean`

Defined in: [ktx2.ts:17](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L17)

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](https://github.com/debuffjp/debuff/blob/e8a91f30e2868fb5f4bd6f64059a677d31a3bce5/packages/spryte/src/ktx2.ts#L11)
