| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Termtab.Graphics.Notation
Description
Rasterized standard-notation renderer.
Composes the visible measures of a track into a single RGBA image: a five-line staff, a treble clef, bar lines, and Bravura noteheads/rests placed at their staff positions. This is the image that the Kitty/Sixel backends blit above the tab grid.
Beat x-positions are derived from the same beatColumnWidth column math the tab
uses, so notation and tab stay column-aligned. The mapping from columns to
pixels (nlColWidthPx) is a layout parameter tuned against the terminal's real
cell size when the renderer is wired into the UI (Phase 0).
Note: this imports beatColumnWidth from the tab widget for now; that column
helper is a candidate for extraction into a shared layout module later.
Synopsis
- data NotationLayout = NotationLayout {
- nlStepPx :: Int
- nlColWidthPx :: Int
- nlLabelCols :: Int
- nlLedgerAbove :: Int
- nlLedgerBelow :: Int
- nlMarginPx :: Int
- defaultLayout :: NotationLayout
- renderNotationImage :: GlyphFont -> NotationLayout -> PixelRGBA8 -> Int -> Instrument -> [(MeasureIndex, [Beat], Measure)] -> IO (Image PixelRGBA8)
- totalColumns :: NotationLayout -> Int -> [(MeasureIndex, [Beat], Measure)] -> Int
Documentation
data NotationLayout Source #
Pixel geometry for the notation image.
Constructors
| NotationLayout | |
Fields
| |
Instances
| Show NotationLayout Source # | |
Defined in Termtab.Graphics.Notation Methods showsPrec :: Int -> NotationLayout -> ShowS # show :: NotationLayout -> String # showList :: [NotationLayout] -> ShowS # | |
| Eq NotationLayout Source # | |
Defined in Termtab.Graphics.Notation Methods (==) :: NotationLayout -> NotationLayout -> Bool # (/=) :: NotationLayout -> NotationLayout -> Bool # | |
defaultLayout :: NotationLayout Source #
The layout used everywhere the UI renders notation images (see
Termtab.UI.NotationGraphics). A distinct NotationLayout could be
built for a different pixel density, but nothing in the codebase
currently does so.
renderNotationImage :: GlyphFont -> NotationLayout -> PixelRGBA8 -> Int -> Instrument -> [(MeasureIndex, [Beat], Measure)] -> IO (Image PixelRGBA8) Source #
Render the visible measures of a track to an RGBA notation image.
The background is fully transparent and all ink (staff, clef, bar lines,
noteheads) is drawn in ink — pass the terminal's foreground color so the
notation adopts the user's theme (see Termtab.Graphics.TermColor). Glyph
anti-aliasing is preserved via the alpha channel.
totalColumns :: NotationLayout -> Int -> [(MeasureIndex, [Beat], Measure)] -> Int Source #
Total tab columns across all visible measures (label + measures + bar lines).