gameforge - v0.1.12
    Preparing search index...

    Class SVGResource

    Resource type for SVG elements and graphics.

    PIXI

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • sourceBase64: string

        Base64 encoded SVG element or URL for SVG file.

      • Optionaloptions: ISVGResourceOptions

        Options to use

        • OptionalautoLoad?: boolean
        • Optionalcrossorigin?: string | boolean
        • Optionalheight?: number
        • Optionalscale?: number
        • Optionalsource?: string
        • Optionalwidth?: number

      Returns SVGResource

    Properties

    _height: number

    Internal height of the resource.

    _overrideHeight: number

    A height override for rasterization on load.

    _overrideWidth: number

    A width override for rasterization on load.

    _width: number

    Internal width of the resource.

    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.

    scale: number

    The source scale to apply when rasterizing on load.

    source: ImageSource

    The source element.

    src: string

    The url of the resource

    svg: string

    Base64 encoded SVG element or URL for SVG file.

    SVG_SIZE: RegExp

    Regular expression for SVG size.

    <svg width="100" height="100"></svg>
    @readonly
    SVG_XML: RegExp

    Regular expression for SVG XML document.

    <?xml version="1.0" encoding="utf-8" ?><!-- image/svg --><svg
    @readonly

    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

    • Bind to a parent BaseTexture

      Parameters

      Returns void

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

      Returns void

    • Destroys this texture.

      Returns void

    • Protected

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

      Returns Promise<SVGResource>

      Handle the validate event

    • Trigger a resize event

      Parameters

      • width: number

        X dimension

      • height: number

        Y dimension

      Returns void

    • Set the style, optional to override

      Parameters

      Returns boolean

      • true is success
    • Unbind to a parent BaseTexture

      Parameters

      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: HTMLImageElement | HTMLVideoElement

        Element to apply crossOrigin

      • url: string

        URL to check

      • Optionalcrossorigin: string | boolean

        Cross origin value to use

      Returns void

    • Get size from an svg string using a regular expression.

      Parameters

      • OptionalsvgString: string

        a serialized svg element

      Returns ISize

      • image extension
    • Used to auto-detect the type of resource.

      Parameters

      • source: unknown

        The source object

      • Optionalextension: string

        The extension of source, if set

      Returns boolean

      • If the source is a SVG source or data file