Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道 ctx.globalcompositeoperation=source-over 在使用 drawimage 时有效,但它可以与 putimagedata 一起使用吗?
简短的回答是否定的,复合模式不会影响putImageData.
putImageData
使用putImageData通常比组合模式和上下文更低级别的工作。
较低级别的意思是它绕过上下文和它用来改变用其他方法(翻译、样式等)绘制的东西的参数。
putImageData 只是直接替换生成的位图上的像素。
您将需要drawImage使用复合模式,这会更快,并且drawImage可以直接与位图内存阵列一起使用。
drawImage