Resource type for HTMLImageElement.

PIXI

Hierarchy (View Summary)

Constructors

  • Parameters

    • source: string | HTMLImageElement

      image source or URL

    • Optionaloptions: IImageResourceOptions
      • OptionalalphaMode?: ALPHA_MODES

        Premultiply image alpha in bitmap.

      • OptionalautoLoad?: boolean

        Start loading process automatically when constructed.

      • OptionalcreateBitmap?: boolean

        Whether its required to create a bitmap before upload.

      • Optionalcrossorigin?: string | boolean

        Load image using cross origin.

    Returns ImageResource

Properties

alphaMode: ALPHA_MODES

Controls texture alphaMode field Copies from options Default is null, copies option from baseTexture

bitmap: ImageBitmap

The ImageBitmap element created for a HTMLImageElement.

null
createBitmap: boolean

If capable, convert the image using createImageBitmap API.

PIXI.settings.CREATE_IMAGE_BITMAP
destroyed: boolean

If resource has been destroyed.

false
internal: boolean

true if resource is created by BaseTexture useful for doing cleanup with BaseTexture destroy and not cleaning up resources that were created externally.

preserveBitmap: boolean

If the image should be disposed after upload

false
source: ImageSource

The source element.

src: string

The url of the resource

url: string

URL of the image source

Accessors

  • get height(): number
  • The height of the resource.

    Returns number

  • get valid(): boolean
  • Has been validated

    Returns boolean

  • get width(): number
  • The width of the resource.

    Returns number

Methods

  • Call when destroying resource, unbind any BaseTexture object before calling this method, as reference counts are maintained internally.

    Returns void

  • Destroys this resource.

    Returns void

  • Returns a promise when image will be loaded and processed.

    Parameters

    • OptionalcreateBitmap: boolean

      whether process image into bitmap

    Returns Promise<ImageResource>

  • Called when we need to convert image into BitmapImage. Can be called multiple times, real promise is cached inside.

    Returns Promise<ImageResource>

    • Cached promise to fill that bitmap
  • Trigger a resize event

    Parameters

    • width: number

      X dimension

    • height: number

      Y dimension

    Returns void

  • Checks if source width/height was changed, resize can cause extra baseTexture update. Triggers one update in any case.

    Returns void

  • Set cross origin based detecting the url and the crossorigin

    Parameters

    • element: HTMLVideoElement | HTMLImageElement

      Element to apply crossOrigin

    • url: string

      URL to check

    • Optionalcrossorigin: string | boolean

      Cross origin value to use

    Returns void

  • Used to auto-detect the type of resource.

    Parameters

    • source: unknown

      The source object

    Returns source is string | HTMLImageElement

    true if current environment support HTMLImageElement, and source is string or HTMLImageElement