import { SHAPES } from '../const'; import type { Matrix } from '../Matrix'; export interface Rectangle extends GlobalMixins.Rectangle { } /** * Size object, contains width and height * @memberof PIXI * @typedef {object} ISize * @property {number} width - Width component * @property {number} height - Height component */ /** * Rectangle object is an area defined by its position, as indicated by its top-left corner * point (x, y) and by its width and its height. * @memberof PIXI */ export declare class Rectangle { /** @default 0 */ x: number; /** @default 0 */ y: number; /** @default 0 */ width: number; /** @default 0 */ height: number; /** * The type of the object, mainly used to avoid `instanceof` checks * @default PIXI.SHAPES.RECT * @see PIXI.SHAPES */ readonly type: SHAPES.RECT; /** * @param x - The X coordinate of the upper-left corner of the rectangle * @param y - The Y coordinate of the upper-left corner of the rectangle * @param width - The overall width of the rectangle * @param height - The overall height of the rectangle */ constructor(x?: string | number, y?: string | number, width?: string | number, height?: string | number); /** Returns the left edge of the rectangle. */ get left(): number; /** Returns the right edge of the rectangle. */ get right(): number; /** Returns the top edge of the rectangle. */ get top(): number; /** Returns the bottom edge of the rectangle. */ get bottom(): number; /** A constant empty rectangle. */ static get EMPTY(): Rectangle; /** * Creates a clone of this Rectangle * @returns a copy of the rectangle */ clone(): Rectangle; /** * Copies another rectangle to this one. * @param rectangle - The rectangle to copy from. * @returns Returns itself. */ copyFrom(rectangle: Rectangle): Rectangle; /** * Copies this rectangle to another one. * @param rectangle - The rectangle to copy to. * @returns Returns given parameter. */ copyTo(rectangle: Rectangle): Rectangle; /** * Checks whether the x and y coordinates given are contained within this Rectangle * @param x - The X coordinate of the point to test * @param y - The Y coordinate of the point to test * @returns Whether the x/y coordinates are within this Rectangle */ contains(x: number, y: number): boolean; /** * Determines whether the `other` Rectangle transformed by `transform` intersects with `this` Rectangle object. * Returns true only if the area of the intersection is >0, this means that Rectangles * sharing a side are not overlapping. Another side effect is that an arealess rectangle * (width or height equal to zero) can't intersect any other rectangle. * @param {Rectangle} other - The Rectangle to intersect with `this`. * @param {Matrix} transform - The transformation matrix of `other`. * @returns {boolean} A value of `true` if the transformed `other` Rectangle intersects with `this`; otherwise `false`. */ intersects(other: Rectangle, transform?: Matrix): boolean; /** * Pads the rectangle making it grow in all directions. * If paddingY is omitted, both paddingX and paddingY will be set to paddingX. * @param paddingX - The horizontal padding amount. * @param paddingY - The vertical padding amount. * @returns Returns itself. */ pad(paddingX?: number, paddingY?: number): this; /** * Fits this rectangle around the passed one. * @param rectangle - The rectangle to fit. * @returns Returns itself. */ fit(rectangle: Rectangle): this; /** * Enlarges rectangle that way its corners lie on grid * @param resolution - resolution * @param eps - precision * @returns Returns itself. */ ceil(resolution?: number, eps?: number): this; /** * Enlarges this rectangle to include the passed rectangle. * @param rectangle - The rectangle to include. * @returns Returns itself. */ enlarge(rectangle: Rectangle): this; toString(): string; }