如何解决将图像拉伸到画布中的四边形?
是否可以在 canvas 2d API 中将图像绘制到任意四边形?
我看到 drawImage 可以让我绘制一个矩形。
ctx.drawImage(someImage,x,y,width,height);
旋转让我旋转它。
ctx.rotate(angle);
ctx.drawImage(someImage,...);
但是是否可以选择任意 4 个点来映射图像矩形的原始 4 个点?
drawImageto4Points(
image,topLeftX,topLeftY,// location to place the topLeft of the image
topRightX,topRightY,// location to place the topRight of the image
bottomLeftX,bottomLeftY,// location to place the bottomLeft of the image
bottomrightX,bottomrightY); // location to place the bottomright of the image
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。