UNPKG

dotting

Version:

Dotting is a pixel art editor component library for react

27 lines (26 loc) 1.48 kB
import { Coord, Index, PanZoom } from "./types"; export declare const convertCartesianToScreen: (canvas: HTMLCanvasElement, cartesianCoord: Coord, dpr: number) => Coord; export declare function diffPoints(p1: Coord, p2: Coord): Coord; export declare function addPoints(p1: Coord, p2: Coord): Coord; export declare function distPoints(p1: Coord, p2: Coord): number; export declare function gradientPoints(p1: Coord, p2: Coord): number; export declare function directionPoints(p1: Coord, p2: Coord): number; /** * Actual world point is converted to screen(=viewing) point * @param point * @param panZoom * @returns */ export declare function getScreenPoint(point: Coord, panZoom: PanZoom): Coord; /** * This is the real point in the actual world * @param point * @param panZoom * @returns */ export declare function getWorldPoint(point: Coord, panZoom: PanZoom): Coord; export declare function convertScreenPointToCartesian(canvas: HTMLCanvasElement, screenPoint: Coord, dpr: number): Coord; export declare function worldPointToCartesian(point: Coord, panZoom: PanZoom): Coord; export declare function lerpRanges(value: number, range1Start: number, range1End: number, range2Start: number, range2End: number): number; export declare function getBresenhamLineIndices(x1: number, y1: number, x2: number, y2: number): Index[]; export declare function getBresenhamEllipseIndices(x1: number, y1: number, x2: number, y2: number, filled: boolean): Index[];