JFLib

diagram_core/src/render/style.rs#

Source: lib/diagram_core/src/render/style.rs

style -- the tables behind lines and fills (JD4): Visio's 24 colours, line patterns, fill
patterns, and line ends drawn by JFDiagrammer itself

  PALETTE[i]                      the colours of index 0 .. 23 (the document's Colors table
                                  comes first)
  dash(pattern) -> &[f64]         LinePattern 2 .. 23 in multiples of the line's weight
  fill_pattern(p) -> FillKind     FillPattern 2 .. 24 as Visio draws them (hatches, dot
                                  patterns as a tint), 25 .. 40 as the old two-colour gradients
  arrow(kind, size, weight)       BeginArrow / EndArrow 1 .. 45 with the size 0 (very small)
                                  .. 6 (colossal), pointing to +x with the tip at the origin,
                                  and how far the line stops short of the tip
  arrow_unit / arrow_length       (JD29) the size of a line end

Line patterns are JFDiagrammer's own approximations of what the numbers mean (FEATURES.md
FM-01 .. FM-03).  Fill patterns (JD26) and line ends (JD29) follow what Visio's SVG export
showed of each number (the geometry of a number is its meaning: bars and crow's feet of the
database notations, UML's hollow triangle and diamond); no artwork is taken from Visio.
/// Visio's default colours 0 .. 23
PALETTE: [u32; 24] = [ 0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFF ...
  • fn dash(pattern: u32) -> Option<&'static [f64]> a line pattern as lengths on and off in multiples of the line's weight (at least 1 pt); None: solid (1, unknown numbers, the patterns of masters above 23)

  • enum FillKind what a FillPattern number draws

    • None
    • Solid
    • Hatch(&'static [(f64, f64)]) -- lines in the foreground colour over the background colour: up to two families (angle in degrees, spacing in inches)
    • Tint(f64) -- a dot pattern too fine to draw: the foreground's share (0 .. 1) mixed over the background
    • Legacy(Legacy) -- the old gradients from the foreground to the background colour
  • enum Legacy the old two-colour gradients (FillPattern 25 .. 40)

    • Linear(f64, bool) -- along an angle (degrees, 0: left to right, 90: bottom to top), mirrored: background at both ends
    • Radial(f64, f64) -- from a point of the box (fractions, 0..1) outwards
  • fn fill_pattern(p: u32) -> FillKind FillPattern 2 .. 24 as Visio draws them (JD26 Visio check: its SVG export holds each as an 8 x 8 bitmap tiled every 6 pt, a pixel 1/96 inch): the line patterns as hatches with Visio's directions and spacings (hatch lines are a pixel wide), the dot patterns as their share of the foreground over the background; 25 .. 40 the old gradients (36 .. 39 from the corners)

  • struct Arrow a line end in its own space: the tip at the origin, the line coming in from -x

    • fill: Path -- filled in the line's colour
    • stroke: Path -- stroked with the line's style
    • setback: f64 -- how far the line stops short of the tip
  • fn arrow_unit(size: u32, weight: f64) -> f64 the unit of a line end of size (0 .. 6) on a line of weight inches, in inches: Visio's marker scale (its standard filled triangle, 4, is two units long and two wide)

  • fn arrow_length(size: u32, weight: f64) -> f64 how long a line end of size (0 .. 6) is on a line of weight inches: Visio's standard filled triangle (4), two units

  • fn arrow(kind: u32, size: u32, weight: f64) -> Option<Arrow> the line end kind (1 .. 45, Visio's numbers) of size on a line of weight inches; an unknown number draws Visio's standard filled triangle

Source: docs/API.md in the JFLib repository.