【发布时间】:2012-02-08 05:42:27
【问题描述】:
我不知道如何使 drawImage 工作......它什么也不做(除了它抛出一个带有未定义描述的异常):
layerCtx.globalAlpha = 0,2; // same thing with this line commented
layerCtx.drawImage(cvs, 0 , 0);
我有 2 个画布,一个是图层,另一个是用于使用鼠标绘制的。我想将用户在第一个画布上绘制的内容保存到图层并应用不透明度... 我不会给你所有的代码,但你必须知道下面的代码是有效的:
layerCtx.putImageData(ctx.getImageData(0, 0, 800, 500), 0, 0);
但我不能将不透明度与以前一起使用,因此正如在其他 stackoverflow.com 相关问题中所建议的那样,我想将 drawImage 与画布元素一起使用。
ctx 是我的画布 cvs 的上下文,
layerCtx 是我的画布 layer 的上下文>
【问题讨论】: