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)

102 lines (101 loc) 3.13 kB
/** @format */ import { Point } from './point.js'; /** * Represents a rectangle defined by its left, top, right, and bottom edges. */ export declare class Rectangle { /** * The left edge of the rectangle. */ private readonly _left; /** * The top edge of the rectangle. */ private readonly _top; /** * The right edge of the rectangle. */ private readonly _right; /** * The bottom edge of the rectangle. */ private readonly _bottom; /** * Gets the left edge of the rectangle. * @returns {number} The left edge. */ get left(): number; /** * Gets the top edge of the rectangle. * @returns {number} The top edge. */ get top(): number; /** * Gets the right edge of the rectangle. * @returns {number} The right edge. */ get right(): number; /** * Gets the bottom edge of the rectangle. * @returns {number} The bottom edge. */ get bottom(): number; /** * Gets the width of the rectangle. * @returns {number} The width. */ get width(): number; /** * Gets the height of the rectangle. * @returns {number} The height. */ get height(): number; /** * Gets the top-left corner of the rectangle as a Point. * @returns {Point} The top-left corner. */ get topLeft(): Point; /** * Gets the top-right corner of the rectangle as a Point. * @returns {Point} The top-right corner. */ get topRight(): Point; /** * Gets the bottom-left corner of the rectangle as a Point. * @returns {Point} The bottom-left corner. */ get bottomLeft(): Point; /** * Gets the bottom-right corner of the rectangle as a Point. * @returns {Point} The bottom-right corner. */ get bottomRight(): Point; /** * Initializes a new instance of the Rectangle class. * @param {number} x1 - The x-coordinate of the first point. * @param {number} y1 - The y-coordinate of the first point. * @param {number} x2 - The x-coordinate of the second point. * @param {number} y2 - The y-coordinate of the second point. */ constructor(x1: number, y1: number, x2: number, y2: number); /** * Creates a new Rectangle from the specified coordinates and dimensions. * @param {number} x - The x-coordinate of the top-left corner. * @param {number} y - The y-coordinate of the top-left corner. * @param {number} width - The width of the rectangle. * @param {number} height - The height of the rectangle. * @returns {Rectangle} A new Rectangle instance. */ static fromXYWH(x: number, y: number, width: number, height: number): Rectangle; /** * Creates a new Rectangle from an existing Rectangle. * @param {Rectangle} other - The existing Rectangle. * @returns {Rectangle} A new Rectangle instance. */ static from(other: Rectangle): Rectangle; /** * Returns a string representation of the rectangle. * @returns {string} A string representation. */ toString(): string; }