开发者

Html Canvas Intelligent Drawing

开发者 https://www.devze.com 2022-12-22 06:01 出处:网络
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

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

精彩评论

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

关注公众号