[LayaAir 2.0]裁切图片后,该用什么方式去重绘出裁切后的图片
图片中,白色部分是我重绘的切下来的部分,但黄色的原图一直还在,即便调用了graphics.clear()方法
这是我重绘部分的代码,我是应该用sprite.graphics去重绘,还是该调用Laya.Render.context中的方法去重绘,绘制部分代码如下(points,是我裁切后的多边形位置点数据):
draw() {
const pp = this.owner.getComponent(Laya.PolygonCollider).points;
let points = this.pointS_to_pointA(pp)
let owner: Laya.Sprite = this.owner as Laya.Sprite
const ctx = owner.graphics;
ctx.clear()
const len = points.length;
console.log("ppppppppppppppp ", points)
ctx.drawPoly(0, 0, points, "#FFFFFF", "#FF00FF", 1)
}
这是我重绘部分的代码,我是应该用sprite.graphics去重绘,还是该调用Laya.Render.context中的方法去重绘,绘制部分代码如下(points,是我裁切后的多边形位置点数据):
draw() {
const pp = this.owner.getComponent(Laya.PolygonCollider).points;
let points = this.pointS_to_pointA(pp)
let owner: Laya.Sprite = this.owner as Laya.Sprite
const ctx = owner.graphics;
ctx.clear()
const len = points.length;
console.log("ppppppppppppppp ", points)
ctx.drawPoly(0, 0, points, "#FFFFFF", "#FF00FF", 1)
}
没有找到相关结果
已邀请:
要回复问题请先登录
0 个回复