UNPKG

image-in-browser

Version:

Package for encoding / decoding images, transforming images, applying filters, drawing primitives on images on the client side (no need for server Node.js)

31 lines (30 loc) 1.41 kB
/** @format */ import { Line } from '../common/line.js'; import { Point } from '../common/point.js'; import { Rectangle } from '../common/rectangle.js'; import { Pixel } from './pixel.js'; /** * Abstract class containing utility methods for image processing. */ export declare abstract class ImageUtils { /** * Test if the pixel **p** is within the circle centered at **center** with a * squared radius of **rad2**. This will test the corners, edges, and center * of the pixel and return the ratio of samples within the circle. * * @param {Pixel} p - The pixel to test. * @param {Point} center - The center point of the circle. * @param {number} rad2 - The squared radius of the circle. * @param {boolean} [antialias=true] - Whether to apply antialiasing. Defaults to true. * @returns {number} The ratio of samples within the circle. */ static circleTest(p: Pixel, center: Point, rad2: number, antialias?: boolean): number; /** * Clip a line to a rectangle using the Cohen–Sutherland clipping algorithm. * * @param {Rectangle} rect - The rectangle to clip against. * @param {Line} line - The line to be clipped. Results are stored in this object. * @returns {boolean} True if the line is partially or completely within the rectangle, false otherwise. */ static clipLine(rect: Rectangle, line: Line): boolean; }