LogoPixi’VN
pixi-jsClasses

Class: BufferImageSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.d.ts:20

A texture source that uses a TypedArray or ArrayBuffer as its resource. It automatically determines the format based on the type of TypedArray provided.

Advanced

Extends

Constructors

Constructor

> new BufferImageSource(options): BufferImageSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.d.ts:23

Parameters

options

BufferSourceOptions

Returns

BufferImageSource

Overrides

TextureSource.constructor

Properties

_batchTick

> protected _batchTick: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:203

Used by the batcher to build texture batches. faster to have the variable here!

Inherited from

TextureSource._batchTick


_gcData?

> optional _gcData?: GCData

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:105

GC tracking data, undefined if not being tracked

Inherited from

TextureSource._gcData


_gcLastUsed

> _gcLastUsed: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:107

Internal

Inherited from

TextureSource._gcLastUsed


_gpuData

> _gpuData: Record<number, GlTexture | GPUTextureGpuData>

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:103

Internal

Inherited from

TextureSource._gpuData


_resolution

> _resolution: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:132

Internal

Inherited from

TextureSource._resolution


_resourceId

> _resourceId: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:123

Internal

i unique resource id, used by the bind group systems. This can change if the texture is resized or its resource changes

Inherited from

TextureSource._resourceId


_resourceType

> readonly _resourceType: "textureSource" = "textureSource"

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:117

Internal

The resource type used by this TextureSource. This is used by the bind groups to determine how to handle this resource.

Inherited from

TextureSource._resourceType


_textureBindLocation

> protected _textureBindLocation: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:208

A temporary batch location for the texture batching. Here for performance reasons only!

Inherited from

TextureSource._textureBindLocation


_touched

> protected _touched: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:198

Used by automatic texture Garbage Collection, stores last GC tick when it was bound

Inherited from

TextureSource._touched


alphaMode

> alphaMode: ALPHA_MODES

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:181

the alpha mode of the texture

Inherited from

TextureSource.alphaMode


antialias

> antialias: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:188

Only really affects RenderTextures. Should we use antialiasing for this texture. It will look better, but may impact performance as a Blit operation will be required to resolve the texture.

Inherited from

TextureSource.antialias


arrayLayerCount

> arrayLayerCount: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:179

how many array layers this texture has (WebGPU depthOrArrayLayers)

Inherited from

TextureSource.arrayLayerCount


autoGarbageCollect

> autoGarbageCollect: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:211

If true, the Garbage Collector will unload this texture if it is not used after a period of time

Inherited from

TextureSource.autoGarbageCollect


autoGenerateMipmaps

> autoGenerateMipmaps: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:171

Should we auto generate mipmaps for this texture? This will automatically generate mipmaps for this texture when uploading to the GPU. Mipmapped textures take up more memory, but can look better when scaled down.

For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame. If you do, make sure to call updateMipmaps after you update the texture.

Inherited from

TextureSource.autoGenerateMipmaps


destroyed

> readonly destroyed: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:193

Has the source been destroyed?

Inherited from

TextureSource.destroyed


dimension

> dimension: TEXTURE_DIMENSIONS

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:175

how many dimensions does this texture have? currently v8 only supports 2d

Inherited from

TextureSource.dimension


format

> format: TEXTURE_FORMATS

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:173

the format that the texture data has

Inherited from

TextureSource.format


height

> height: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:146

the height of this texture source, accounting for resolution eg pixelHeight 200, resolution 2, then height will be 100

Inherited from

TextureSource.height


isPowerOfTwo

> isPowerOfTwo: boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:209

Inherited from

TextureSource.isPowerOfTwo


label

> label: string

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:111

optional label, can be used for debugging

Inherited from

TextureSource.label


mipLevelCount

> mipLevelCount: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:162

The number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true. it is read only!

Inherited from

TextureSource.mipLevelCount


options

> protected readonly options: TextureSourceOptions<ArrayBuffer | TypedArray>

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:99

Inherited from

TextureSource.options


pixelHeight

> pixelHeight: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:136

the pixel height of this texture source. This is the REAL pure number, not accounting resolution

Inherited from

TextureSource.pixelHeight


pixelWidth

> pixelWidth: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:134

the pixel width of this texture source. This is the REAL pure number, not accounting resolution

Inherited from

TextureSource.pixelWidth


resource

> resource: ArrayBuffer | TypedArray

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:151

the resource that will be uploaded to the GPU. This is where we get our pixels from eg an ImageBimt / Canvas / Video etc

Inherited from

TextureSource.resource


sampleCount

> sampleCount: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:157

Internal

The number of samples of a multisample texture. This is always 1 for non-multisample textures. To enable multisample for a texture, set antialias to true

Inherited from

TextureSource.sampleCount


uid

> readonly uid: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:109

unique id for this Texture source

Inherited from

TextureSource.uid


uploadMethodId

> uploadMethodId: string

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.d.ts:22

Internal

this is how the backends know how to upload this texture to the GPU It changes depending on the resource type. Classes that extend TextureSource should override this property.

Overrides

TextureSource.uploadMethodId


viewDimension

> viewDimension: TEXTURE_VIEW_DIMENSIONS

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:177

how this texture is viewed/sampled by shaders (WebGPU view dimension)

Inherited from

TextureSource.viewDimension


width

> width: number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:141

the width of this texture source, accounting for resolution eg pixelWidth 200, resolution 2, then width will be 100

Inherited from

TextureSource.width


defaultOptions

> static defaultOptions: TextureSourceOptions

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:101

The default options used when creating a new TextureSource. override these to add your own defaults

Inherited from

TextureSource.defaultOptions


extension

> static extension: ExtensionMetadata

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.d.ts:21


from

> static from: (resource) => TextureSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:307

A helper function that creates a new TextureSource based on the resource you provide.

Parameters

resource

TextureResourceOrOptions

The resource to create the texture source from.

Returns

TextureSource

Inherited from

TextureSource.from


prefixed

> static prefixed: string | boolean

Defined in: node_modules/eventemitter3/index.d.ts:9

Inherited from

TextureSource.prefixed

Accessors

addressMode

Get Signature

> get addressMode(): WRAP_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:230

setting this will set wrapModeU, wrapModeV and wrapModeW all at once!

Returns

WRAP_MODE

Set Signature

> set addressMode(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:231

Parameters
value

WRAP_MODE

Returns

void

Inherited from

TextureSource.addressMode


lodMaxClamp

Get Signature

> get lodMaxClamp(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:248

Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.

Returns

number

Set Signature

> set lodMaxClamp(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:249

Parameters
value

number

Returns

void

Inherited from

TextureSource.lodMaxClamp


lodMinClamp

Get Signature

> get lodMinClamp(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:245

Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.

Returns

number

Set Signature

> set lodMinClamp(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:246

Parameters
value

number

Returns

void

Inherited from

TextureSource.lodMinClamp


magFilter

Get Signature

> get magFilter(): SCALE_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:236

Specifies the sampling behavior when the sample footprint is smaller than or equal to one texel.

Returns

SCALE_MODE

Set Signature

> set magFilter(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:237

Parameters
value

SCALE_MODE

Returns

void

Inherited from

TextureSource.magFilter


maxAnisotropy

Get Signature

> get maxAnisotropy(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:228

Returns

number

Set Signature

> set maxAnisotropy(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:227

Specifies the maximum anisotropy value clamp used by the sampler.

Parameters
value

number

Returns

void

Inherited from

TextureSource.maxAnisotropy


minFilter

Get Signature

> get minFilter(): SCALE_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:239

Specifies the sampling behavior when the sample footprint is larger than one texel.

Returns

SCALE_MODE

Set Signature

> set minFilter(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:240

Parameters
value

SCALE_MODE

Returns

void

Inherited from

TextureSource.minFilter


mipmapFilter

Get Signature

> get mipmapFilter(): SCALE_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:242

Specifies behavior for sampling between mipmap levels.

Returns

SCALE_MODE

Set Signature

> set mipmapFilter(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:243

Parameters
value

SCALE_MODE

Returns

void

Inherited from

TextureSource.mipmapFilter


repeatMode

Get Signature

> get repeatMode(): WRAP_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:233

setting this will set wrapModeU, wrapModeV and wrapModeW all at once!

Returns

WRAP_MODE

Set Signature

> set repeatMode(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:234

Parameters
value

WRAP_MODE

Returns

void

Inherited from

TextureSource.repeatMode


resolution

Get Signature

> get resolution(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:271

the resolution of the texture. Changing this number, will not change the number of pixels in the actual texture but will the size of the texture when rendered.

changing the resolution of this texture to 2 for example will make it appear twice as small when rendered (as pixel density will have increased)

Returns

number

Set Signature

> set resolution(resolution): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:272

Parameters
resolution

number

Returns

void

Inherited from

TextureSource.resolution


resourceHeight

Get Signature

> get resourceHeight(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:263

the height of the resource. This is the REAL pure number, not accounting resolution

Returns

number

Inherited from

TextureSource.resourceHeight


resourceWidth

Get Signature

> get resourceWidth(): number

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:261

the width of the resource. This is the REAL pure number, not accounting resolution

Returns

number

Inherited from

TextureSource.resourceWidth


scaleMode

Get Signature

> get scaleMode(): SCALE_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:296

setting this will set magFilter,minFilter and mipmapFilter all at once!

Returns

SCALE_MODE

Set Signature

> set scaleMode(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:294

Parameters
value

SCALE_MODE

Returns

void

Inherited from

TextureSource.scaleMode


source

Get Signature

> get source(): TextureSource

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:222

returns itself

Returns

TextureSource

Inherited from

TextureSource.source


style

Get Signature

> get style(): TextureStyle

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:224

the style of the texture

Returns

TextureStyle

Set Signature

> set style(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:225

Parameters
value

TextureStyle

Returns

void

Inherited from

TextureSource.style


wrapMode

Get Signature

> get wrapMode(): WRAP_MODE

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:293

Returns

WRAP_MODE

Set Signature

> set wrapMode(value): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:292

Parameters
value

WRAP_MODE

Returns

void

Inherited from

TextureSource.wrapMode

Methods

addListener()

> addListener<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:45

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

TextureSource.addListener


destroy()

> destroy(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:254

Destroys this texture source

Returns

void

Inherited from

TextureSource.destroy


emit()

> emit<T>(event, ...args): boolean

Defined in: node_modules/eventemitter3/index.d.ts:32

Calls each of the listeners registered for a given event.

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

args

...ArgumentMap<{ change: BindResource; destroy: TextureSource; error: Error; resize: TextureSource; styleChange: TextureSource; unload: TextureSource; update: TextureSource; updateMipmaps: TextureSource; }>[Extract<T, "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps">]

Returns

boolean

Inherited from

TextureSource.emit


eventNames()

> eventNames(): ("error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps")[]

Defined in: node_modules/eventemitter3/index.d.ts:15

Return an array listing the events for which the emitter has registered listeners.

Returns

("error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps")[]

Inherited from

TextureSource.eventNames


listenerCount()

> listenerCount(event): number

Defined in: node_modules/eventemitter3/index.d.ts:27

Return the number of listeners listening to a given event.

Parameters

event

"error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Returns

number

Inherited from

TextureSource.listenerCount


listeners()

> listeners<T>(event): (...args) => void[]

Defined in: node_modules/eventemitter3/index.d.ts:20

Return the listeners registered for a given event.

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

Returns

(...args) => void[]

Inherited from

TextureSource.listeners


off()

> off<T>(event, fn?, context?, once?): this

Defined in: node_modules/eventemitter3/index.d.ts:69

todo

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

fn?

(...args) => void

context?

any

once?

boolean

Returns

this

Inherited from

TextureSource.off


on()

> on<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:40

Add a listener for a given event.

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

TextureSource.on


once()

> once<T>(event, fn, context?): this

Defined in: node_modules/eventemitter3/index.d.ts:54

Add a one-time listener for a given event.

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

fn

(...args) => void

context?

any

Returns

this

Inherited from

TextureSource.once


removeAllListeners()

> removeAllListeners(event?): this

Defined in: node_modules/eventemitter3/index.d.ts:79

Remove all listeners, or those of the specified event.

Parameters

event?

"error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Returns

this

Inherited from

TextureSource.removeAllListeners


removeListener()

> removeListener<T>(event, fn?, context?, once?): this

Defined in: node_modules/eventemitter3/index.d.ts:63

Remove the listeners of a given event.

Type Parameters

T

T extends "error" | "update" | "change" | "resize" | "destroy" | "unload" | "styleChange" | "updateMipmaps"

Parameters

event

T

fn?

(...args) => void

context?

any

once?

boolean

Returns

this

Inherited from

TextureSource.removeListener


resize()

> resize(width?, height?, resolution?): boolean

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:280

Resize the texture, this is handy if you want to use the texture as a render texture

Parameters

width?

number

the new width of the texture

height?

number

the new height of the texture

resolution?

number

the new resolution of the texture

Returns

boolean

  • if the texture was resized

Inherited from

TextureSource.resize


unload()

> unload(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:259

This will unload the Texture source from the GPU. This will free up the GPU memory As soon as it is required fore rendering, it will be re-uploaded.

Returns

void

Inherited from

TextureSource.unload


update()

> update(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:252

call this if you have modified the texture outside of the constructor

Returns

void

Inherited from

TextureSource.update


updateMipmaps()

> updateMipmaps(): void

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/TextureSource.d.ts:291

Lets the renderer know that this texture has been updated and its mipmaps should be re-generated. This is only important for RenderTexture instances, as standard Texture instances will have their mipmaps generated on upload. You should call this method after you make any change to the texture

The reason for this is is can be quite expensive to update mipmaps for a texture. So by default, We want you, the developer to specify when this action should happen.

Generally you don't want to have mipmaps generated on Render targets that are changed every frame,

Returns

void

Inherited from

TextureSource.updateMipmaps


test()

> static test(resource): resource is ArrayBuffer | TypedArray

Defined in: node_modules/pixi.js/lib/rendering/renderers/shared/texture/sources/BufferImageSource.d.ts:24

Parameters

resource

any

Returns

resource is ArrayBuffer | TypedArray

Overrides

TextureSource.test