Draw a texture with nine-grid information

绘制带九宫格信息的图片

实现

构造函数

属性

color: number = 0xffffffff

Color tint for the texture (default: 0xffffffff)

纹理的颜色色调(默认值:0xffffffff)

height: number = 1

(Optional) Height of the drawn texture

(可选)绘制纹理的高度

percent: boolean = true

Whether the position and size are percentages

位置和大小是否是百分比

sizeGrid: number[]

The size grid of the texture. The size grid is a 3x3 division of the texture, allowing it to be scaled without distorting the corners and edges. The array contains five values representing the top, right, bottom, and left margins, and whether to repeat the fill (0: no repeat, 1: repeat). The values are separated by commas. For example: "6,6,6,6,1".

纹理的九宫格数据。 九宫格是一种将纹理分成3x3格的方式,使得纹理缩放时保持角和边缘不失真。 数组包含五个值,分别代表上边距、右边距、下边距、左边距以及是否重复填充(0:不重复填充,1:重复填充)。 值以逗号分隔。例如:"6,6,6,6,1"。

texture: Texture

The texture to be drawn

要绘制的纹理

width: number = 1

(Optional) Width of the drawn texture

(可选)绘制纹理的宽度

x: number = 0

(Optional) X-axis offset

(可选)X轴偏移量

y: number = 0

(Optional) Y-axis offset

(可选)Y轴偏移量

ID: string = className

Identifier for the Draw9GridTextureCmd

绘制带九宫格信息的图片命令的标识符

访问器

方法

  • 参数

    • runner: GraphicsRunner

      The rendering context

    • gx: number

      The global x coordinate

    • gy: number

      The global y coordinate

    返回 void

    Execute the draw nine-grid texture command in the given context

    在给定的上下文中执行绘制九宫格纹理命令

  • 参数

    • texture: Texture

      The texture to be drawn

    • x: number

      X-axis offset

    • y: number

      Y-axis offset

    • width: number

      Width of the drawn texture

    • height: number

      Height of the drawn texture

    • sizeGrid: number[]

      Nine-grid information

    • 可选percent: boolean

      Whether the position and size are percentages (default: false)

    • 可选color: string

      Color tint for the texture (default: null)

    返回 Draw9GridTextureCmd

    A Draw9GridTextureCmd instance initialized with the given parameters

    Creates or retrieves a Draw9GridTextureCmd instance from the object pool and initializes it with the specified parameters.

    从对象池创建或获取一个 Draw9GridTextureCmd 实例,并使用指定的参数进行初始化。