dileep-draw
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@daeinc/draw

drawing utilities for HTML5 Canvas.

Install

npm i dileep-draw

then,

import { ... } from "dileep-draw"

Functions

It uses two custom types, Pt and Pts, each representing number[] and Pt[].

import type { Pt, Pts } from "dileep-draw";

drawCircle

const drawCircle: (ctx: CanvasRenderingContext2D, pt: Pt, diam: number) => void;

drawFillText

const drawFillText: (
  ctx: CanvasRenderingContext2D,
  msg: string,
  pt: Pt
) => void;

drawLine

const drawLine: (ctx: CanvasRenderingContext2D, pt1: Pt, pt2: Pt) => void;

drawPath

const drawPath: (
  ctx: CanvasRenderingContext2D,
  path: Pts,
  close?: boolean
) => void;

drawSmoothPath

const drawSmoothPath: (ctx: CanvasRenderingContext2D, path: Pts) => void;

Uses quadratic curves to smoothen hard edges of path. The input path is expected to be generated with generateSmoothPath() from another package dileep-geom.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i dileep-draw

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

10.3 kB

Total Files

7

Last publish

Collaborators

  • dilipgona.dev