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.
我正在使用画布开发绘画应用程序,我想让用户选择仅在选定区域进行绘制。为此,我可以使用 clip() 方法。但是如果我希望用户也能够在字母内部绘制 - 有什么方法可以使用 clip() 文本?我还有其他方法可以做到吗?
谢谢
您可以这样做,但不能使用剪辑。Clip 仅适用于路径,文本不是路径。
您将需要使用第二个内存(不在页面上)画布以实现效果。方法如下:
drawImage(in-memory-canvas, x, y)