javascript - 我可以增加 HTML5 画布分辨率吗?
问题描述
Html 画布会降低图像和形状的分辨率。有什么方法可以提高质量吗?
解决方案
当然:
const width = ..., height = ..., scale = 2;
const canvas = document.querySelector('...')
canvas.style.width = width;
canvas.style.height = height;
canvas.width = width * scale;
canvas.height = height * scale;
推荐阅读
- php - Docker 容器 Apache+MapServer 和 Apache+PHP+Mapscript
- sql - 将值合并到按项目 ID 分组的单行中
- java - 如何在 Java 中获取 Windows 的桌面位置
- vue.js - 修改代码后 Gridsome 丢失 $page
- android - 将收据发送到电子邮件 android stripe
- discord.js - message.author.hasPermission 不是 Discord.js 中的函数
- angular - 模拟开火功能配置 - 不拿起条纹键
- android - 反应本机应用程序上显示的谷歌工作图标
- javascript - 与 JS websocket 斗争
- javascript - 在 React 中刷新动画组件