@kayahr/wastelib
    Preparing search index...

    Class FontChar

    Container for a single font character 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 single font character from the given array and returns it.

      Parameters

      • array: Uint8Array

        The array with the content of the colorf.fnt file.

      • offset: number = 0

        The offset in the array pointing to the font character.

      Returns FontChar

      The parsed font character.