opensheetmusicdisplay
Version:
An open source JavaScript engine for displaying MusicXML based on VexFlow.
36 lines (35 loc) • 1.76 kB
TypeScript
import Vex from "vexflow";
import VF = Vex.Flow;
import { VexFlowBackend } from "./VexFlowBackend";
import { FontStyles } from "../../../Common/Enums/FontStyles";
import { Fonts } from "../../../Common/Enums/Fonts";
import { RectangleF2D } from "../../../Common/DataObjects/RectangleF2D";
import { PointF2D } from "../../../Common/DataObjects/PointF2D";
import { BackendType } from "../../../OpenSheetMusicDisplay/OSMDOptions";
import { EngravingRules } from "../EngravingRules";
export declare class CanvasVexFlowBackend extends VexFlowBackend {
private zoom;
constructor(rules: EngravingRules);
getVexflowBackendType(): VF.Renderer.Backends;
getOSMDBackendType(): BackendType;
getCanvasSize(): number;
initialize(container: HTMLElement, zoom: number): void;
/**
* Initialize a canvas without attaching it to a DOM node. Can be used to draw in background
* @param width Width of the canvas
* @param height Height of the canvas
*/
initializeHeadless(width?: number, height?: number): void;
getContext(): VF.CanvasContext;
free(): void;
clear(): void;
scale(k: number): void;
translate(x: number, y: number): void;
renderText(fontHeight: number, fontStyle: FontStyles, font: Fonts, text: string, heightInPixel: number, screenPosition: PointF2D, color?: string, fontFamily?: string): Node;
renderRectangle(rectangle: RectangleF2D, styleId: number, colorHex: string, alpha?: number): Node;
renderLine(start: PointF2D, stop: PointF2D, color?: string, lineWidth?: number, id?: string): Node;
renderCurve(points: PointF2D[]): Node;
renderPath(points: PointF2D[], fill?: boolean, id?: string): Node;
private ctx;
get CanvasRenderingCtx(): CanvasRenderingContext2D;
}