开发者

html 5 canvas drawing is slow! [closed]

开发者 https://www.devze.com 2023-02-27 10:39 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.

Closed 9 years ago.

Improve this question

I am making a web application which is similar to开发者_如何学Python paint. The problem that I am facing right now is that my drawing algorithm is awfully slow. Basically what I am doing is drawing a straight line between successive pixels that have been recorded with the mousemove event.

Is there a smarter/(less expensive) way to draw user created lines and curves using html 5 canvas?

EDIT: It is incredibly slow only when I am redrawing the strokes that were already on the canvas.


What you want to do conceptually should be incredibly fast. Since you won't give us the code, here:

http://jsfiddle.net/mXrNk/1/

If this is faster, use it as a starting point.


The slowness (what exactly is slow? Slow to load, or slow to render?) might be caused by the hardware acceleration in your browser. What's your browser/OS? I find that Safari 5 in OS X and IE9 in Windows 7 have the fastest draw rates because of their hardware acceleration. In Chrome, you'll have to turn it on in about:flags, and it is a bit finicky.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号