new(
width,height) ->band
Make a band of pixels
A band is width by height pixels and starts clear. An ink is
{ r, g, b, a }, each from 0 to 1, with straight alpha. A box is
x0, y0, x1, y1 in whole pixels of the diagram, the last column and row
left out.
| Method | Does |
|---|---|
clear(top) | clears the band and moves it to start at the diagram's row top |
rect(x0, y0, x1, y1, ink, dash) | lays ink over a box |
shade(x0, y0, x1, y1, coverage, ink) | lays ink over the box's pixels by coverage(x, y), called at each pixel's centre and answering 0 to 1 |
erase(x0, y0, x1, y1) | clears a box |
serialise() | returns the band as RGBA bytes, width * height * 4 of them, or nil when it holds no ink |
dash is { axis, on, period }: along axis, "x" or "y", the ink
is laid where the diagram's pixel coordinate modulo period is under
on.