UNPKG

@core-graphics/rect

Version:
25 lines (24 loc) 1.01 kB
import type { PointValue } from "@core-graphics/point"; import type { Rect, RectEdge } from "./lite"; export declare type RectInset = Partial<Record<RectEdge, number>>; export declare type SymmetricRectInset = { dx?: number; dy?: number; }; /** * Returns the shrinked or expanded version of the rectangle * based on the inset values specified. */ export declare function egdeInset(r: Rect, inset: RectInset): Rect; export declare function expand(r: Rect, v: number | SymmetricRectInset): Rect; export declare function shrink(r: Rect, v: number | SymmetricRectInset): Rect; /** * Returns a symmetrically contracted/expanded Rect based on * the specified amount. */ export declare function inset(r: Rect, value: SymmetricRectInset): Rect; /** * Returns a new Rect with its origin shifted by the specified offset */ export declare function shift(r: Rect, offset: Partial<PointValue>): Rect; export declare function rotate(r: Rect, deg: number, origin: PointValue): Rect;