# TextureHandler

Class · extends [`ResourceHandler`](https://api.playcanvas.com/engine/classes/ResourceHandler.md) · category: Asset

Source: https://github.com/playcanvas/engine/blob/f059dc005842f76e052cdf44d8370c8c7ec475ac/src/framework/handlers/texture.js#L172

Resource handler for the `texture` asset type. Loads 2D and 3D [Texture](https://api.playcanvas.com/engine/classes/Texture.md) resources from
any image format the browser decodes, such as PNG, JPEG, WebP and AVIF, and from DDS, KTX,
KTX2, Basis and HDR files.

## Methods

### open

```ts
open(url: any, data: any, asset: any): any
```

The open function is passed the raw resource data. The handler can then process the data
into a format that can be used at runtime. When parsers are registered, the matching parser's
`open` is used (if it implements one); otherwise the base implementation simply returns the data.

**Parameters**

- `url` (`any`): The URL of the resource to open.
- `data` (`any`): The raw resource data passed by callback from [load](https://api.playcanvas.com/engine/classes/ResourceHandler.md#load).
- `asset` (`any`): Optional asset that is passed by ResourceLoader.

**Returns** `any`: The parsed resource data.

### patch

```ts
patch(asset: any, assets: any): void
```

The patch function performs any operations on a resource that requires a dependency on its
asset data or any other asset data. The base implementation does nothing.

**Parameters**

- `asset` (`any`): The asset to patch.
- `assets` (`any`): The asset registry.

## Inherited from [ResourceHandler](https://api.playcanvas.com/engine/classes/ResourceHandler.md)

- `protected _app: AppBase`
- `handlerType: string = ''`
- `get app(): AppBase`
- `get maxRetries(): number` · `set maxRetries(value: number)`
- `get parsers(): ResourceParser[]`
- `addParser(parser: ResourceParser, decider?: any): void`
- `fetch(url: string | { load: string; original: string }, responseType: string, callback: ResourceHandlerCallback, asset?: Asset<string>): void`
- `load(url: string | { load: string; original: string }, callback: ResourceHandlerCallback, asset?: Asset<string>): void`
- `removeParser(parser: ResourceParser): void`
