Options
All
  • Public
  • Public/Protected
  • All
Menu

Resource type for SVG elements and graphics.

memberof

PIXI

Hierarchy

Index

Constructors

constructor

Properties

Private Optional _crossorigin

_crossorigin: any

Protected _height

_height: number

Private _load

_load: any

Private _loadSvg

_loadSvg: any

Loads an SVG image from imageUrl or data URL.

Readonly _overrideHeight

_overrideHeight: number

Readonly _overrideWidth

_overrideWidth: number

Private _resolve

_resolve: any

Protected _width

_width: number

destroyed

destroyed: boolean

internal

internal: boolean

noSubImage

noSubImage: boolean

Protected onError

onError: Runner

Protected onResize

onResize: Runner

Protected onUpdate

onUpdate: Runner

Readonly scale

scale: number

source

source: ImageSource

Readonly svg

svg: string

Static SVG_SIZE

SVG_SIZE: RegExp

RegExp for SVG size.

static
constant

{RegExp|string} SVG_SIZE

memberof

PIXI.SVGResource

example

<svg width="100" height="100"></svg>

Accessors

height

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

    member

    {number}

    readonly

    Returns number

valid

  • get valid(): boolean
  • Has been validated

    readonly
    member

    {boolean}

    Returns boolean

width

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

    member

    {number}

    readonly

    Returns number

Methods

bind

destroy

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

    Returns void

dispose

  • dispose(): void
  • Destroys this texture

    override

    Returns void

load

  • This can be overridden to start preloading a resource or do any other prepare step.

    Returns Promise<SVGResource>

    Handle the validate event

resize

  • resize(width: number, height: number): void
  • Trigger a resize event

    Parameters

    • width: number

      X dimension

    • height: number

      Y dimension

    Returns void

style

unbind

update

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

    Returns void

upload

Static Protected crossOrigin

  • crossOrigin(element: HTMLImageElement | HTMLVideoElement, url: string, crossorigin?: string | boolean): void
  • Set cross origin based detecting the url and the crossorigin

    Parameters

    • element: HTMLImageElement | HTMLVideoElement

      Element to apply crossOrigin

    • url: string

      URL to check

    • Optional crossorigin: string | boolean

    Returns void

Static getSize

  • getSize(svgString?: string): ISize
  • Get size from an svg string using regexp.

    method

    Parameters

    • Optional svgString: string

      a serialized svg element

    Returns ISize

    image extension

Static test

  • test(source: unknown, extension?: string): boolean
  • Used to auto-detect the type of resource.

    static

    Parameters

    • source: unknown

      The source object

    • Optional extension: string

      The extension of source, if set

    Returns boolean

Generated using TypeDoc