[LayaAirIDE3]drawImage没有显示
是我操作的不对,还是有bug?这样运行,不显示drawImage
onMouseClick(evt: Laya.Event): void {
let s1 = this.owner.getChildAt(0) as Laya.Sprite;
let s2 = this.owner.getChildAt(1) as Laya.Sprite;
// console.log(s1,s2)
let canvas = s1.drawToCanvas(
s1.width ,
s1.height ,
s1.x,
s1.y
);
let img = new Laya.Image();
img.x=0;
img.y=0;
img.width = s1.width;
img.height = s1.height;
img.skin = canvas.toBase64("image/png", 1);
// // console.log(img.skin)
// this.owner.addChild(img);
// let tex=new Laya.Texture();
let tex = img.drawToTexture(s2.width, s2.height, 0, 0) as Laya.Texture;
// let tet=canvas.getTexture() as Laya.Texture;
// s2.graphics.fillTexture(tet,0,0,tet.width,tet.height);
// s2.graphics.drawTexture(tex,0,0,img.width,img.height,undefined,1)
s2.graphics.drawImage(tex, 0, 0, img.width, img.height);
// s2.graphics.drawTexture(tex)
}
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复