UNPKG

laya-coreui-es

Version:

laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改

31 lines (30 loc) 955 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DrawImageCmd = void 0; const Pool_1 = require("../../utils/Pool"); class DrawImageCmd { static create(texture, x, y, width, height) { var cmd = Pool_1.Pool.getItemByClass("DrawImageCmd", DrawImageCmd); cmd.texture = texture; texture._addReference(); cmd.x = x; cmd.y = y; cmd.width = width; cmd.height = height; return cmd; } recover() { this.texture && this.texture._removeReference(); this.texture = null; Pool_1.Pool.recover("DrawImageCmd", this); } run(context, gx, gy) { if (this.texture) context.drawTexture(this.texture, this.x + gx, this.y + gy, this.width, this.height); } get cmdID() { return DrawImageCmd.ID; } } exports.DrawImageCmd = DrawImageCmd; DrawImageCmd.ID = "DrawImage";