Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sprites

Container for the 10 sprites defined in the ic0_9.wlf and masks.wlf files.

Hierarchy

  • Sprites

Index

Methods

getNumSprites

  • getNumSprites(): number
  • Returns the number of sprites.

    Returns number

    The number of sprites.

getSprite

  • getSprite(index: number): Sprite
  • Returns the sprite image with the given index.

    Parameters

    • index: number

      The index of the sprite.

    Returns Sprite

    The sprite image.

getSprites

toCanvas

  • toCanvas(): HTMLCanvasElement
  • Creates and returns a new canvas containing all the sprites.

    Returns HTMLCanvasElement

    The created canvas.

toDataUrl

  • toDataUrl(type?: undefined | string, ...args: any[]): string
  • Creates and returns an image data URL of an image with all sprites.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns string

    The created data URL.

toImage

  • toImage(type?: undefined | string, ...args: any[]): HTMLImageElement
  • Creates and returns a HTML image with all sprites.

    Parameters

    • Optional type: undefined | string

      Optional image mime type. Defaults to image/png.

    • Rest ...args: any[]

      Optional additional encoder parameters. For image/jpeg this is the image quality between 0 and 1 with a default value of 0.92.

    Returns HTMLImageElement

    The created HTML image.

Static fromArrays

  • fromArrays(imageArray: Uint8Array, maskArray: Uint8Array): Sprites
  • Parses sprites from the given arrays and returns it.

    Parameters

    • imageArray: Uint8Array

      The image data array with the ico0_9.wlf file content to parse.

    • maskArray: Uint8Array

      The transparency mask array with the masks.wlf file content to parse.

    Returns Sprites

    The parsed sprites.

Static fromBlobs

  • fromBlobs(imagesBlob: Blob, masksBlob: Blob): Promise<Sprites>
  • Reads sprites from the given blobs and returns it.

    Parameters

    • imagesBlob: Blob

      The IC0_9.WLF blob to read.

    • masksBlob: Blob

    Returns Promise<Sprites>

    The read sprites.

Generated using TypeDoc