如何在 HTML5 画布 drawImage() 中应用抗锯齿?
htmljavascriptprogramming scripts更新于 2024/8/18 11:24:17
要使用抗锯齿,您需要设置重采样质量。
ctx.imageSmoothingQuality = "low|medium|high"
使用屏幕外画布将图像缩小一半 −
var c = document.createElement('canvas'),
ocx = c.getContext('2d');
c.width = img.width * 0.5;
c.height = img.height * 0.5;
ocxx.drawImage(img, 0, 0, c.width, c.height);
// 再次绘制缩小一半的图像并重复此操作
ocx.drawImage(c, 0, 0, c.width * 0.5, cc.height * 0.5);
相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

