@kayahr/wastelib
    Preparing search index...

    Class Cursor

    Container for a single mouse cursor image.

    Hierarchy (View Summary)

    Index

    Properties

    height: number

    The image height in pixels.

    width: number

    The image width in pixels.

    Methods

    • Draws the image onto the given rendering context.

      Parameters

      • ctx: CanvasRenderingContext2D

        The rendering context to draw the image to.

      • x: number = 0

        Optional horizontal target position. Defaults to 0.

      • y: number = 0

        Optional vertical target position. Defaults to 0.

      Returns void

    • Returns the RGBA color at the specified position.

      Parameters

      • x: number

        The horizontal pixel position.

      • y: number

        The vertical pixel position.

      Returns number

      The RGBA color at the specified position.

    • Creates and returns a new canvas containing the image.

      Returns HTMLCanvasElement

      The created canvas.

    • Creates and returns an image data URL.

      Parameters

      • Optionaltype: string

        Optional image mime type. Defaults to image/png.

      • Optionalquality: number

        Optional quality parameter for encoder. 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.

    • Creates and returns a HTML image.

      Parameters

      • Optionaltype: string

        Optional image mime type. Defaults to image/png.

      • Optionalquality: number

        Optional quality parameter for encoder. 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.

    • Parses a mouse cursor image from the given array.

      Parameters

      • array: Uint8Array

        The array containing the image data.

      • offset: number = 0

        Optional start offset within the array. Defaults to 0.

      Returns Cursor

      The parsed mouse cursor image.