开发者

Html Canvas Intelligent Drawing

I'm currently implementing a HTML canvas based webapp that features panning. Is there a way to use a开发者_如何学Cn auxiliary buffer to hold the presently visible area so when I pan I don't have to redraw the whole canvas and only have to draw the newly visible areas?


See my previous response to a related question: What is the fastest way to move a rectangular (pixel) region inside a HTML5 canvas element

Just draw the entire canvas in a div that has overflow:hidden and implement panning as re-positioning the top and left of the canvas within that div. It is much faster. And don't worry about drawing canvases tens of thousands of pixels wide/tall, I've successfully used this on very-very large and complex HTML and SVG elements.


Take a look at the pixel manipulation API. http://dev.w3.org/html5/2dcontext/#pixel-manipulation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜