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 (view full)

Constructors

Properties

_batchEnabled: number

Number of the texture batch, used by multi-texture renderers

Member

_batchLocation: number

Location inside texture batch, used by multi-texture renderers

Member

alphaMode: ALPHA_MODES

How to treat premultiplied alpha, see PIXI.ALPHA_MODES.

Member

Default

PIXI.ALPHA_MODES.UNPACK
anisotropicLevel: number

Anisotropic filtering level of texture

Member

Default

0
cacheId: string

Currently default cache ID.

Member

destroyed: boolean

Flag if BaseTexture has been destroyed.

Member

dirtyId: number

Used by TextureSystem to only update texture to the GPU when needed. Please call update() to increment it.

format: FORMATS

The pixel format of the texture

Default

PIXI.FORMATS.RGBA
height: number

The height of the base texture set when the image has loaded

isPowerOfTwo: boolean

Whether or not the texture is a power of two, try to use power of two textures as much as you can

Default

false
ktxKeyValueData: Map<string, DataView>

Whether its a part of another texture, handled by ArrayResource or CubeResource

Member

resolution: number

The resolution / device pixel ratio of the texture

Default

PIXI.settings.RESOLUTION
resource: R

The resource used by this BaseTexture, there can only be one resource per BaseTexture, but textures can share resources.

Member

target: TARGETS

The target type

Default

PIXI.TARGETS.TEXTURE_2D
textureCacheIds: string[]

The collection of alternative cache ids, since some BaseTextures can have more than one ID, short name and longer full URL

Member

type: TYPES

The type of resource data

Default

PIXI.TYPES.UNSIGNED_BYTE
valid: boolean

Generally speaking means when resource is loaded.

Member

width: number

The width of the base texture set when the image has loaded

_globalBatch: number

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

defaultOptions: IBaseTextureOptions<any>

Default options used when creating BaseTexture objects.

Static

Memberof

PIXI.BaseTexture

prefixed: string | boolean

Accessors

  • get mipmap(): MIPMAP_MODES
  • Mipmap mode of the texture, affects downscaled images

    Returns MIPMAP_MODES

    Default

    PIXI.MIPMAP_MODES.POW2
    
  • set mipmap(value): void
  • Parameters

    Returns void

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

    Returns number

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

    Returns number

  • get scaleMode(): SCALE_MODES
  • The scale mode to apply when scaling this texture

    Returns SCALE_MODES

    Default

    PIXI.SCALE_MODES.LINEAR
    
  • set scaleMode(value): void
  • Parameters

    Returns void

  • get wrapMode(): WRAP_MODES
  • How the texture wraps

    Returns WRAP_MODES

    Default

    PIXI.WRAP_MODES.CLAMP
    
  • set wrapMode(value): void
  • Parameters

    Returns void

Methods

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

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

    Returns void

    Fires

    PIXI.BaseTexture#destroyed

  • 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.

    Returns void

    Fires

    PIXI.BaseTexture#dispose

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Rest ...args: any[]

    Returns boolean

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

    Returns (string | symbol)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: string | symbol

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

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

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: string | symbol

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends string | symbol

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Sets real size of baseTexture, preserves current resolution.

    Parameters

    • realWidth: number

      Full rendered width

    • realHeight: number

      Full rendered height

    • Optional resolution: number

      Optionally set resolution

    Returns this

    • this
  • Changes resolution

    Parameters

    • resolution: number

      res

    Returns this

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

    Parameters

    • resource: R

      that is managing this BaseTexture

    Returns this

    • this
  • Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.

    Parameters

    • desiredWidth: number

      Desired visual width

    • desiredHeight: number

      Desired visual height

    • Optional resolution: number

      Optionally set resolution

    Returns this

    • this
  • Changes style options of BaseTexture

    Parameters

    Returns this

    • this
  • Invalidates the object. Texture becomes valid if width and height are greater than zero.

    Returns void

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

    Parameters

    Returns void

  • 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.

    Type Parameters

    Parameters

    • source: string | string[] | ImageSource

      The source to create base texture from.

    • Optional options: IBaseTextureOptions<RO>

      See PIXI.BaseTexture's constructor for options.

    • Optional strict: boolean

      Enforce strict-mode, see PIXI.settings.STRICT_TEXTURE_CACHE.

    Returns BaseTexture<R, IAutoDetectOptions>

    The new base texture.

    Static

Generated using TypeDoc