@magiclane/maps-sdk
    Preparing search index...

    Class Img

    Class used for basic images

    Represents the image in an abstract way, providing metadata and access to the RenderableImg.

    Hierarchy (View Summary)

    Index

    Properties

    _pointerId: number

    Accessors

    • get aspectRatio(): number

      Get the aspect ratio (width / height)

      Returns number

      The aspect ratio

    • get imageType(): ImageFileFormat

      Get the image type

      Returns ImageFileFormat

      The image type

    • get isValid(): boolean

      Check if the image is valid

      Returns boolean

      True if the image is valid, false otherwise

    • get pointerId(): number

      Returns number

    • get size(): { height: number; width: number }

      Get the recommended image size

      Returns { height: number; width: number }

      The size as { width, height }

    • get uid(): number

      Get the image unique ID

      Returns number

      The image ID

    Methods

    • Dispose the image resources

      Returns void

    • Get the renderable image

      Parameters

      • Optionalsize: { height: number; width: number }

        The optional size as { width, height }

      • format: ImageFileFormat = ImageFileFormat.png

        The image format (default: png)

      Returns RenderableImg | undefined

      The renderable image or undefined if not valid

    • Get the image data as a Uint8Array

      Parameters

      • Optionalsize: { height: number; width: number }

        The optional size as { width, height }

      • format: ImageFileFormat = ImageFileFormat.png

        The image format (default: png)

      Returns Uint8Array<ArrayBufferLike> | undefined

      The image data or undefined if not valid

    • Registers an object for auto release. When the object is not used anymore, it will be released automatically from C++.

      Parameters

      • pointerId: any

        The pointer ID to register

      Returns void

    • Creates a new image from binary data

      Parameters

      • data: Uint8Array

        The image binary data

      • format: ImageFileFormat = ImageFileFormat.autoDetect

        The image format (default: auto-detect)

      Returns Img

      A new Img instance

    • Creates an image from an asset

      Parameters

      • url: string

        The URL of the asset

      Returns Promise<Img>

      A promise that resolves to an Img instance

    • Internal

      Creates an Img instance from a pointer ID

      Parameters

      • pointerId: number

        The pointer ID

      Returns Img

      A new Img instance