Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BaseTexture<R, RO>

A Texture stores the information that represents an image. All textures have a base texture, which contains information about the source. Therefore you can have many textures all using a single BaseTexture

memberof

PIXI

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

_batchEnabled

_batchEnabled: number

_batchLocation

_batchLocation: number

_glTextures

_glTextures: {}

Type declaration

Optional alphaMode

alphaMode: ALPHA_MODES

Optional anisotropicLevel

anisotropicLevel: number

cacheId

cacheId: string

destroyed

destroyed: boolean

dirtyId

dirtyId: number

dirtyStyleId

dirtyStyleId: number

Optional format

format: FORMATS

height

height: number

isPowerOfTwo

isPowerOfTwo: boolean

Optional mipmap

mipmap: MIPMAP_MODES

parentTextureArray

resolution

resolution: number

resource

resource: R

Optional scaleMode

scaleMode: SCALE_MODES

Optional target

target: TARGETS

textureCacheIds

textureCacheIds: string[]

touched

touched: number

Optional type

type: TYPES

Readonly uid

uid: number

valid

valid: boolean

width

width: number

Optional wrapMode

wrapMode: WRAP_MODES

Static _globalBatch

_globalBatch: number

Global number of the texture batch, used by multi-texture renderers

static
member

{number}

Static prefixed

prefixed: string | boolean

Accessors

realHeight

  • get realHeight(): number
  • Pixel height of the source of this texture

    readonly
    member

    {number}

    Returns number

realWidth

  • get realWidth(): number
  • Pixel width of the source of this texture

    readonly
    member

    {number}

    Returns number

Methods

Private _refreshPOT

  • _refreshPOT(): void
  • Refresh check for isPowerOfTwo texture based on size

    Returns void

addListener

castToBaseTexture

destroy

  • destroy(): void
  • Destroys this base texture. The method stops if resource doesn't want this texture to be destroyed. Removes texture from all caches.

    Returns void

dispose

  • dispose(): void
  • Frees the texture from WebGL memory without destroying this texture object. This means you can still use the texture later which will upload it to GPU memory again.

    fires

    PIXI.BaseTexture#dispose

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Calls each of the listeners registered for a given event.

    Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Return an array listing the events for which the emitter has registered listeners.

    Returns (string | symbol)[]

Optional getDrawableSource

  • getDrawableSource(): CanvasImageSource
  • Returns CanvasImageSource

listenerCount

  • listenerCount(event: string | symbol): number
  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

listeners

  • Return the listeners registered for a given event.

    Parameters

    • event: string | symbol

    Returns ListenerFn[]

off

  • Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns BaseTexture<R, RO>

on

  • Add a listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns BaseTexture<R, RO>

Private onError

  • onError(event: ErrorEvent): void
  • Handle errors with resources.

    Parameters

    • event: ErrorEvent

      Error event emitted.

    Returns void

once

  • Add a one-time listener for a given event.

    Parameters

    • event: string | symbol
    • fn: ListenerFn
    • Optional context: any

    Returns BaseTexture<R, RO>

removeAllListeners

  • removeAllListeners(event?: string | symbol): BaseTexture<R, RO>
  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns BaseTexture<R, RO>

removeListener

  • removeListener(event: string | symbol, fn?: ListenerFn, context?: any, once?: boolean): BaseTexture<R, RO>
  • Remove the listeners of a given event.

    Parameters

    • event: string | symbol
    • Optional fn: ListenerFn
    • Optional context: any
    • Optional once: boolean

    Returns BaseTexture<R, RO>

setRealSize

  • setRealSize(realWidth: number, realHeight: number, resolution?: number): BaseTexture<R, RO>
  • Sets real size of baseTexture, preserves current resolution.

    Parameters

    • realWidth: number

      Full rendered width

    • realHeight: number

      Full rendered height

    • Optional resolution: number

    Returns BaseTexture<R, RO>

    this

setResolution

  • setResolution(resolution: number): BaseTexture<R, RO>
  • Changes resolution

    Parameters

    • resolution: number

      res

    Returns BaseTexture<R, RO>

    this

setResource

  • Sets the resource if it wasn't set. Throws error if resource already present

    Parameters

    • resource: R

      that is managing this BaseTexture

    Returns BaseTexture<R, RO>

    this

setSize

  • setSize(width: number, height: number, resolution?: number): BaseTexture<R, RO>
  • Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.

    Parameters

    • width: number

      Visual width

    • height: number

      Visual height

    • Optional resolution: number

    Returns BaseTexture<R, RO>

    this

setStyle

  • Changes style options of BaseTexture

    Parameters

    Returns BaseTexture<R, RO>

    this

update

  • update(): void
  • Invalidates the object. Texture becomes valid if width and height are greater than zero.

    Returns void

Static addToCache

  • Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.

    static

    Parameters

    Returns void

Static from

  • Helper function that creates a base texture based on the source you provide. The source can be - image url, image element, canvas element. If the source is an image url or an image element and not in the base texture cache, it will be created and loaded.

    static

    Type parameters

    Parameters

    Returns BaseTexture<R, IAutoDetectOptions>

    The new base texture.

Static fromBuffer

  • Create a new BaseTexture with a BufferResource from a Float32Array. RGBA values are floats from 0 to 1.

    static

    Parameters

    • buffer: Float32Array | Uint8Array

      The optional array to use, if no data is provided, a new Float32Array is created.

    • width: number

      Width of the resource

    • height: number

      Height of the resource

    • Optional options: IBaseTextureOptions<any>

    Returns BaseTexture<BufferResource, IAutoDetectOptions>

    The resulting new BaseTexture

Static removeFromCache

Generated using TypeDoc