UNPKG

laya-coreui-es

Version:

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

45 lines (44 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DrawTextureCmd = void 0; const ColorFilter_1 = require("../../filters/ColorFilter"); const Pool_1 = require("../../utils/Pool"); class DrawTextureCmd { constructor() { this.colorFlt = null; this.uv = null; } static create(texture, x, y, width, height, matrix, alpha, color, blendMode, uv) { var cmd = Pool_1.Pool.getItemByClass("DrawTextureCmd", DrawTextureCmd); cmd.texture = texture; texture._addReference(); cmd.x = x; cmd.y = y; cmd.width = width; cmd.height = height; cmd.matrix = matrix; cmd.alpha = alpha; cmd.color = color; cmd.blendMode = blendMode; cmd.uv = uv == undefined ? null : uv; if (color) { cmd.colorFlt = new ColorFilter_1.ColorFilter(); cmd.colorFlt.setColor(color); } return cmd; } recover() { this.texture && this.texture._removeReference(); this.texture = null; this.matrix = null; Pool_1.Pool.recover("DrawTextureCmd", this); } run(context, gx, gy) { this.texture && context.drawTextureWithTransform(this.texture, this.x, this.y, this.width, this.height, this.matrix, gx, gy, this.alpha, this.blendMode, this.colorFlt, this.uv); } get cmdID() { return DrawTextureCmd.ID; } } exports.DrawTextureCmd = DrawTextureCmd; DrawTextureCmd.ID = "DrawTexture";