OpenSheetMusicDisplay
    Preparing search index...

    Class CanvasVexFlowBackend

    Hierarchy (View Summary)

    Index
    canvas: HTMLElement
    graphicalMusicPage: GraphicalMusicPage

    The GraphicalMusicPage the backend is drawing from. Each backend only renders one GraphicalMusicPage, to which the coordinates are relative.

    height: number
    inner: HTMLElement
    renderer: Renderer
    width: number
    • Initialize a canvas without attaching it to a DOM node. Can be used to draw in background

      Parameters

      • width: number = 300

        Width of the canvas

      • height: number = 300

        Height of the canvas

      Returns void

    • Renders a text to the screen.

      Parameters

      • fontHeight: number
      • fontStyle: FontStyles
      • font: Fonts
      • text: string
      • heightInPixel: number
      • screenPosition: PointF2D
      • color: string = undefined
      • fontFamily: string = undefined
      • language: string = undefined

        the language of the text as a BCP 47 tag (e.g. "ja"), for the browser's choice of fonts (see Label.language)

      Returns Node

    • Resizes the canvas, keeping what is drawn on it. Resizing a canvas clears its bitmap, and incremental rendering (renderNext) grows the canvas as it appends batches: downwards on the endless page, to the right with RenderSingleHorizontalStaffline. So snapshot the current pixels, redraw them after resizing, and fill the rest of the canvas with the page background (if set). For a normal render the canvas is still empty here, and clear() fills it afterwards, so this is effectively a no-op.

      Parameters

      • width: number

        the new width in pixels

      • height: number

        the new height in pixels

      Returns void