import Point from './Point'; export type JsonSize = { width: number; height: number; }; export type ArraySize = [number, number]; /** * A {@link Size} object * * @category basic types * * @example * ```ts * let size1 = new Size(100, 100); * let size2 = [100,100]; * let size3 = { width: 100, height: 100 }; * ``` */ export type SizeLike = Size | JsonSize; /** * 表示一个大小的实现类 * * @english * Represents a size. * @category basic types * * @example * * ```ts * const a1 = new Size(1, 2); * const a2 = new Size([1, 2]); * const a3 = new Size({ width: 1, height: 2 }); * const a4 = new Size(a3); * ``` */ declare class Size { width: number; height: number; /** * @param width - width value */ constructor(width: SizeLike); /** * @param width - width value */ constructor(width: ArraySize); /** * @param width - width value * @param height - height value */ constructor(width: number, height: number); /** * 返回 `Size` 的拷贝 * @english * Returns a copy of the size */ copy(): Size; /** * @overload * * 返回当前`Size` 与另一个 `Size` 相加的结果 * * @english * Returns the result of addition of another size. * @param x - Size * @returns result */ add(x: Size): Size; /** * @overload * * 返回当前`Size` 的 xy 与传入的 xy 相加的结果 * * @english * Returns the result of addition of another size. * @param x - x * @param y - y * @returns result */ add(x: number, y: number): Size; /** * 与另一个 `Size` 进行比较,以判断它们是否相等。 * * @english * Compare with another size to see whether they are equal. * @param size - size to compare */ equals(size: Size): boolean; /** * 返回当前大小与给定数字相乘的结果,返回一个新的 Size 对象 * @english * Returns the result of multiplication of the current size by the given number. * @param ratio - ratio to multi * @returns result */ multi(ratio: number): Size; /** * 返回当前大小与给定数字相乘的结果 * @english * Returns the result of multiplication of the current size by the given number. * @param ratio - ratio to multi * @returns result */ _multi(ratio: number): this; _round(): this; /** * 将当前 `Size` 对象转为一个点对象 {@link Point} * @english * Converts the size object to a {@link Point} * @returns point */ toPoint(): Point; /** * 将 `Size` 对象转换为数组 * @english * Converts the size object to an array [width, height] */ toArray(): ArraySize; /** * 将 `Size` 实例对象转换为 包含 `width` 和 `height` 的 json 对象 * @english * Convert the size object to a json object {width : ., height : .} * @returns json */ toJSON(): JsonSize; } export default Size; //# sourceMappingURL=Size.d.ts.map