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 FillKindwhat a FillPattern number drawsNoneSolidHatch(&'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 backgroundLegacy(Legacy)-- the old gradients from the foreground to the background colour
enum Legacythe 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 endsRadial(f64, f64)-- from a point of the box (fractions, 0..1) outwards
fn fill_pattern(p: u32) -> FillKindFillPattern 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 Arrowa line end in its own space: the tip at the origin, the line coming in from -xfill: Path-- filled in the line's colourstroke: Path-- stroked with the line's stylesetback: f64-- how far the line stops short of the tip
fn arrow_unit(size: u32, weight: f64) -> f64the unit of a line end ofsize(0 .. 6) on a line ofweightinches, 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) -> f64how long a line end ofsize(0 .. 6) is on a line ofweightinches: Visio's standard filled triangle (4), two unitsfn arrow(kind: u32, size: u32, weight: f64) -> Option<Arrow>the line endkind(1 .. 45, Visio's numbers) ofsizeon a line ofweightinches; an unknown number draws Visio's standard filled triangle