简体   繁体   English

Canvas中的clearRect问题

[英]clearRect question in Canvas

I am looking to create an Eraser for a drawing app in Canvas, and I have this code 我正在寻找在Canvas中为绘图应用程序创建橡皮擦,并且我有这段代码

canvas.clearRect(x, y, width, height); canvas.clearRect(x,y,width,height);

How would i implement it? 我将如何实施?

How do you really want the eraser? 您真的想要橡皮擦吗? You could just paint with the background color instead of the foreground color. 您可以只使用背景颜色而不是前景色进行绘制。

You should probably let the user chose the foreground and background colors. 您可能应该让用户选择前景色和背景色。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM