UNPKG

@turbox3d/graphic-component-pixi

Version:

Graphic component library based on pixi

27 lines (26 loc) 924 B
import * as PIXI from 'pixi.js'; import { IGraphicOption } from './option'; export type IFitStyle = 'none' | 'fill' | 'cover' | 'contain'; interface IRectParam { x: number; y: number; width: number; height: number; /** * 传入的位置坐标是否是矩形中心点 */ central?: boolean; /** 圆角 */ radius?: number; backgroundImage?: string; /** * 背景图适配方式:图片原尺寸居中;拉伸图片填充区域;图片最小化得覆盖区域;图片最大化得内含在区域 * 注意:贴图在矩形区域留白的部分会被repeat填满,且无法修改铺贴方式(Pixi实现问题,如需留白请使用Container组件,不要使用此基础绘制接口) */ fit?: IFitStyle; } /** * 绘制一个矩形 */ export declare function drawRect(graphic: PIXI.Graphics, param: IRectParam & IGraphicOption): Promise<void>; export {};