A module for quickly drawing lines to a canvas element using bresenham's algorithm, for pixel-precision crispness.
var crisp = require("crisp-canvas");
var canvas = getElementById("canvas-id");
var context = canvas.getContext("2d");
crisp.drawLines(context, [
{
start: { x: 5, y: 5 },
end: { x: 25, y: 25 },
color: [ 200, 200, 200, 200 ] // rgba
}
]);
Html canvas doesn't provide an api for aliasing. All lines and polygons are anti-aliased by default.
Canvas does provide an api for manipulating the image buffer through the
ImageData
class.
This library defines a line drawing command that draws pixels directly to this
image buffer.