Optionalcaches: GeometricSkyBottomLineCachesMimics CanvasRenderingContext2D.canvas (width/height only). Some code checks for its existence.
Set by VexFlow's Renderer.bolsterCanvasContext() pattern, some code accesses ctx.vexFlowCanvasContext.
Only used by VexFlow's TabNote to erase the stave lines behind fret numbers, which never affects the extents (skyline/bottom-line). Erasing is not supported by this context.
Writes the computed extents into the given skyline/bottomline arrays (in device pixels, indexed by pixel column), in the same format the raster method produced them: columns where nothing was drawn are left undefined.
Fast path for glyphs, called by VexFlow's (patched) Glyph.renderOutline() instead of issuing the outline's dozens of path commands: merges the glyph outline's flattened line segments, cached once per outline + scale (the curve flattening and command parsing are the expensive part of glyph drawing, and the same glyphs repeat constantly: noteheads, accidentals, ...). The merged segments are identical to the ones the normal path commands would produce, so the result is exactly the same. Returns true if handled (VexFlow then skips the normal path commands).
For min/max per column, the fill of a closed path has the same extents as its outline: the topmost/bottommost filled point of a column always lies on the path boundary (holes like in half note noteheads never contain a column's extremes).
Merges the ink extents of the text, character by character (a single box for the whole string would e.g. claim ascender height above lowercase letters, unlike the rasterized text the raster method saw, which has per-character contours).
Resets the context for a new measure of the given pixel width.
Optionalcls: stringOptionalid: stringOptionalattrs: object
A virtual VexFlow rendering context that computes the vertical extents (min and max y) of everything drawn into it, per (pixel) column, instead of rasterizing to a canvas.
This is used by SkyBottomLineCalculator to calculate the skyline and bottom-line of a measure geometrically from the same VexFlowMeasure.draw() call that was previously made on a hidden canvas, without the very expensive CanvasRenderingContext2D.getImageData() call (GPU->CPU transfer) and without rasterizing/allocating a canvas at all. (see #937)
It implements the subset of the CanvasRenderingContext2D interface that VexFlow 1.2.93 uses, plus the extra methods VexFlow adds in Renderer.bolsterCanvasContext() (setFont, setFillStyle, openGroup, etc., see VexFlow's canvascontext.js).
Accuracy notes compared to the pixel-based (raster) method: