# macaw_draw v0.1.0 - Table of Contents > The drawing library of the Macaw family: scales, shapes, layouts and geo, and the scene with its SVG, canvas, binary canvas and raster renderers. Pure functions, errors as values; no data layer, component or Phoenix. ## Pages - [README](readme.md) - [Changelog](changelog.md) ## Modules - [Macaw.Draw](Macaw.Draw.md): Macaw's drawing library: pure functions with no processes and no state. - [Macaw.Draw.Axis](Macaw.Draw.Axis.md): A reference axis as scene elements: its domain line, tick marks and labels (spec/06 §17), d3-axis's geometry (visualize `Visualize.Axis`, D-23, D-55, D-56). - [Macaw.Draw.Contour](Macaw.Draw.Contour.md): Iso-lines through a scalar grid by marching squares (spec/09 §11), copied from visualize's `Visualize.Contour` and the `contour` step of its `Visualize.Chart.Transform.Geo` (visualize D-72, D-112). - [Macaw.Draw.Contour.Density](Macaw.Draw.Contour.Density.md): Two-dimensional Gaussian kernel density over pixel positions, contoured (spec/09 §12), copied from visualize's `Visualize.Contour.Density` and the `density` step of its `Visualize.Chart.Transform.Geo`. - [Macaw.Draw.Ease](Macaw.Draw.Ease.md): The 25 easing curves (spec/07 §18), copied from visualize's `Visualize.Ease`: functions from `t` in `[0, 1]` to a float, nominally in `[0, 1]` (the `elastic_*` and `back_*` families overshoot). - [Macaw.Draw.Format](Macaw.Draw.Format.md): The tick format derived from a realized scale, as data (spec/06 §18). - [Macaw.Draw.Generators](Macaw.Draw.Generators.md): Styles and colors a design names and the frame computes at render (spec/07 §25; visualize spec/14 §3.13, D-177), copied from visualize's `Visualize.Generators`: the stored call, the host module's macro, and the registry. - [Macaw.Draw.Geo.Circle](Macaw.Draw.Geo.Circle.md): A circle on the sphere as a GeoJSON `Polygon`: d3-geo's `geoCircle` (spec/09 §5, visualize #525, D-131), copied from visualize's `Visualize.Geo.Circle`. - [Macaw.Draw.Geo.Delaunay](Macaw.Draw.Geo.Delaunay.md): Planar Delaunay triangulation (spec/09 §9), copied from visualize's `Visualize.Geo.Delaunay` and the `delaunay` step of its `Visualize.Chart.Transform.Geo`. - [Macaw.Draw.Geo.Graticule](Macaw.Draw.Geo.Graticule.md): The graticule, d3-geo's `geoGraticule`: meridians, parallels and their outline as GeoJSON that `Macaw.Draw.Geo.Path` clips and projects like any geometry (spec/09 §6). visualize had none; this is a port of d3-geo's `src/graticule.js`. - [Macaw.Draw.Geo.Path](Macaw.Draw.Geo.Path.md): GeoJSON drawn as `Macaw.Draw.IR.Path`s and measured in projected space (spec/09 §4), copied from visualize's `Visualize.Geo.Path` and the projection step of its `Visualize.Chart.Transform.Geo`. - [Macaw.Draw.Geo.Projection](Macaw.Draw.Geo.Projection.md): Map projections: `{longitude, latitude}` degrees to `{x, y}` pixels and back (spec/09 §2), copied from visualize's `Visualize.Geo.Projection`. - [Macaw.Draw.Geo.Tiles](Macaw.Draw.Geo.Tiles.md): The arithmetic of a slippy-map basemap (spec/09 §7, visualize #475), copied from visualize's `Visualize.Geo.Tiles`: whether a projection has tiles, the zoom level whose 256-pixel tiles match it, the tiles covering a plot, where each goes in plot pixels, and the values of its address. - [Macaw.Draw.Geo.Viewport](Macaw.Draw.Geo.Viewport.md): A geographic view, a projection and a plot size, as the `:point` box window of `macaw_data` and back, and the pan and zoom gestures that move it (spec/09 §8). - [Macaw.Draw.Geo.Voronoi](Macaw.Draw.Geo.Voronoi.md): Voronoi cells bounded to a rectangle (spec/09 §10), copied from visualize's `Visualize.Geo.Voronoi` and the `voronoi` step of its `Visualize.Chart.Transform.Geo`. - [Macaw.Draw.IR.Element](Macaw.Draw.IR.Element.md): A scene node (spec/10 §1.1), copied from visualize's `Visualize.IR.Element`. - [Macaw.Draw.IR.Motion](Macaw.Draw.IR.Motion.md): The motion values every target writes (spec/10 §1.5, §5), copied from visualize's `Visualize.IR.Motion` (visualize spec/14 §3.10–§3.12, D-176). - [Macaw.Draw.IR.Paint](Macaw.Draw.IR.Paint.md): A paint that is not one color (spec/10 §1.4), copied from visualize's `Visualize.IR.Paint`: the value of a node's `:fill` or `:stroke` when it is a gradient or a hatch (visualize spec/02 §2.1, #652, D-175). - [Macaw.Draw.IR.Path](Macaw.Draw.IR.Path.md): A path as data: drawing commands and their SVG path string (spec/10 §1.2), copied from visualize's `Visualize.IR.Path`. - [Macaw.Draw.IR.Transform](Macaw.Draw.IR.Transform.md): A node's transform (spec/10 §1.3), copied from visualize's `Visualize.IR.Transform`: `%Macaw.Draw.IR.Transform{operations}`, applied left to right as SVG composes them. - [Macaw.Draw.Interpolate](Macaw.Draw.Interpolate.md): Interpolator factories (spec/07 §17), copied from visualize's `Visualize.Interpolate`: each answers `{:ok, fun}`, `fun` a 1-arity function of `t`, or `{:error, faults}` for endpoints it cannot interpolate, and has a `!` twin answering the function itself. - [Macaw.Draw.Layout](Macaw.Draw.Layout.md): The conventions every layout shares (spec/08 §1): options checked once and every fault answered at once, vocabularies read by spelling, and output as columns. - [Macaw.Draw.Layout.Chord](Macaw.Draw.Layout.Chord.md): Chord diagrams: a square flow matrix laid out as arcs on a circle with ribbons between them (spec/08 §7). - [Macaw.Draw.Layout.Cluster](Macaw.Draw.Layout.Cluster.md): The dendrogram: a node-link diagram whose leaves all sit at one depth (spec/08 §3.3). - [Macaw.Draw.Layout.Force](Macaw.Draw.Layout.Force.md): The force simulation as one pure value, stepped by whoever holds it (spec/08 §9). - [Macaw.Draw.Layout.Force.Forces](Macaw.Draw.Layout.Force.Forces.md): The seven forces of the force simulation (spec/08 §9.2), each a function of the nodes, the links, the temperature `alpha` and the force's options. - [Macaw.Draw.Layout.Gantt](Macaw.Draw.Layout.Gantt.md): The Gantt time grid (spec/08 §14): tasks as bars against a time axis, in rows grouped by section, with dependency arrows and the grid behind them. - [Macaw.Draw.Layout.Gantt.Result](Macaw.Draw.Layout.Gantt.Result.md): A Gantt layout (spec/08 §14.3), as `Macaw.Draw.Layout.Gantt.generate/3` answers it - [Macaw.Draw.Layout.Graph](Macaw.Draw.Layout.Graph.md): A network from a `links` slot and an optional `nodes` slot (spec/08 §1.3): the one graph every network layout reads (chord, sankey and force; the layered layouts of the second cut). - [Macaw.Draw.Layout.Hexbin](Macaw.Draw.Layout.Hexbin.md): Hexagonal binning of points of the plane, d3-hexbin's lattice (spec/08 §10). - [Macaw.Draw.Layout.Hierarchy](Macaw.Draw.Layout.Hierarchy.md): The tree every hierarchical layout reads (spec/08 §2): `Tree`, `Cluster`, `Pack`, `Partition` and `Treemap`. A hierarchy is an immutable tree of `%Hierarchy{}` structs; every operation answers a new root. - [Macaw.Draw.Layout.Layered](Macaw.Draw.Layout.Layered.md): The layered DAG (spec/08 §11): a directed graph laid out in ranks with routed edges, Sugiyama-style, the layout of the second cut's flowcharts, state, class and ER diagrams. - [Macaw.Draw.Layout.Layered.Result](Macaw.Draw.Layout.Layered.Result.md): A layered drawing (spec/08 §11.8), as `Macaw.Draw.Layout.Layered.generate/4` answers it. - [Macaw.Draw.Layout.Links](Macaw.Draw.Layout.Links.md): A parent-child link's path (spec/08 §3.4): a curve, an elbow or a line from the parent's position to the child's, vertical or horizontal. - [Macaw.Draw.Layout.Pack](Macaw.Draw.Layout.Pack.md): Circle packing (spec/08 §4): every node a circle, leaves sized by value and internal nodes enclosing their children. - [Macaw.Draw.Layout.Partition](Macaw.Draw.Layout.Partition.md): Adjacency diagrams (spec/08 §5): icicles, and sunbursts when `size` is `{2π, radius}` and `x0`/`x1` are read as angles in radians. - [Macaw.Draw.Layout.Radial](Macaw.Draw.Layout.Radial.md): The radial tree and radial dendrogram (spec/08 §15): a tree drawn in polar coordinates, the root at the center, depth outward, siblings around, over `Macaw.Draw.Layout.Tree` (§3.2) and `Macaw.Draw.Layout.Cluster` (§3.3). - [Macaw.Draw.Layout.Sankey](Macaw.Draw.Layout.Sankey.md): Flow diagrams: the nodes and links of a directed weighted graph positioned so a link's width is its value (spec/08 §8), a port of d3-sankey. - [Macaw.Draw.Layout.Sequence](Macaw.Draw.Layout.Sequence.md): Sequence lanes (spec/08 §12): a sequence diagram's participants as lanes across and its events down, the second cut's sequence diagram layout. - [Macaw.Draw.Layout.Sequence.Result](Macaw.Draw.Layout.Sequence.Result.md): A sequence diagram (spec/08 §12.5), as `Macaw.Draw.Layout.Sequence.generate/3` answers it, every record's `index` (or `row`) the event it came from - [Macaw.Draw.Layout.Swimlanes](Macaw.Draw.Layout.Swimlanes.md): Swimlanes (spec/08 §13): a layered graph (`Macaw.Draw.Layout.Layered`) banded into lanes, an activity diagram or a process map whose nodes each belong to one lane. - [Macaw.Draw.Layout.Swimlanes.Result](Macaw.Draw.Layout.Swimlanes.Result.md): A swimlane drawing (spec/08 §13.3): `Macaw.Draw.Layout.Layered.Result`'s fields, `nodes`, `edges`, `width`, `height`, `crossings` and `bounded`, with `lanes`, one per lane in order, `%{id, x0, y0, x1, y1, label_x, label_y}`: the lane's band and its label's center in the header. - [Macaw.Draw.Layout.Tree](Macaw.Draw.Layout.Tree.md): The tidy tree, for node-link diagrams (spec/08 §3.2). - [Macaw.Draw.Layout.Treemap](Macaw.Draw.Layout.Treemap.md): Treemaps: nested rectangles whose areas are proportional to `value` (spec/08 §6). - [Macaw.Draw.Polygon](Macaw.Draw.Polygon.md): Polygon measures (spec/07 §21), copied from visualize's `Visualize.Polygon` over lists of `{x, y}` tuples; a polygon is implicitly closed. Geographic polygons, contours and Voronoi cells (spec/09) measure through this module. - [Macaw.Draw.Quantity](Macaw.Draw.Quantity.md): Quantity display: a domain shown in the unit that fits it, its ticks on round numbers of that unit, and the tick format that labels them (spec/06 §19, visualize D-138, D-156). - [Macaw.Draw.Random](Macaw.Draw.Random.md): Random variates over an explicit state (spec/07 §22), copied from visualize's `Visualize.Random`, which read and advanced the calling process's `:rand` state. `Macaw.Draw` holds no state, so every draw takes a state and answers the value with the next state, `{value, state}`. - [Macaw.Draw.Render](Macaw.Draw.Render.md): The dispatch over targets (spec/10 §2), copied from visualize's `Visualize.Render` and `Visualize.Backend`. - [Macaw.Draw.Render.Binary](Macaw.Draw.Render.Binary.md): The binary canvas encoder (spec/10 §4.2–§4.6), copied from visualize's `Visualize.Backend.CanvasBinary`, `.Opcodes` and `.PathEncoder`: a scene packed into a compact little-endian stream of records the `FrameBinary` hook replays (spec/10 §7.9). - [Macaw.Draw.Render.Binary.Decoder](Macaw.Draw.Render.Binary.Decoder.md): The reference decoder of the binary canvas (spec/10 §4.8), copied from visualize's `Visualize.Backend.CanvasBinary.Decoder` and **written from spec/10 §4.2–§4.3 and §4.9, not from the encoder**, so `decode(encode(x))` is a round trip that tests both (visualize D-36). Where visualize raised on a bad byte, this answers it: a test or a host reading a stream it did not write gets a value. - [Macaw.Draw.Render.Binary.SVG](Macaw.Draw.Render.Binary.SVG.md): The binary encoder of the SVG builder's elements (spec/10 §4.7), copied from visualize's `Visualize.Backend.CanvasBinary.SVG` and `.SVG.Defs`: a tree of `Macaw.Draw.SVG.Element`s written to the stream of `Macaw.Draw.Render.Binary` (spec/10 §4.2–§4.3), reading presentation attributes rather than a style map. `Macaw.Draw.Render.Binary.encode/2` dispatches a builder tree here. - [Macaw.Draw.Render.Canvas](Macaw.Draw.Render.Canvas.md): The canvas commands (spec/10 §4.1), copied from visualize's `Visualize.Backend.Canvas`, `Visualize.Backend.Canvas.Arc` and `Visualize.Backend.Canvas.Output`: a scene written as Canvas 2D commands. - [Macaw.Draw.Render.Fonts](Macaw.Draw.Render.Fonts.md): The raster target's font configuration and the bundled faces (spec/10 §9.6): **a raster never depends on the host's fonts**. New here: visualize's options of `Visualize.Render.to_png/2` (`:font_dirs`, `:system_fonts`, `:generic_families`), made one value whose default is the bundled faces with the system's fonts off. - [Macaw.Draw.Render.Incremental](Macaw.Draw.Render.Incremental.md): The incremental canvas (spec/10 §4.9), copied from visualize's `Visualize.Backend.CanvasIncremental` and the stale-column scroll of `Visualize.Incremental` (visualize spec/09 §5, §7, D-38, D-106, D-324): a scrolling plot sends what scrolled in, not the whole plot. - [Macaw.Draw.Render.Motion](Macaw.Draw.Render.Motion.md): The motion sheet of a drawing (spec/10 §5), copied from visualize's `Visualize.Chart.Frame.Motion`, taking resolved styles rather than a chart frame: SVG moves through CSS, and under the strict CSP that CSS is a **generated stylesheet**, never a `