开发者

What is the most performant way to implement zoom to a cairo-drawn canvas?

开发者 https://www.devze.com 2023-03-07 00:58 出处:网络
I have a wx.ScrolledWindow where is drawn on using cairo. I have implemented a zoom-functionality which right now redraws the whole content.

I have a wx.ScrolledWindow where is drawn on using cairo. I have implemented a zoom-functionality which right now redraws the whole content. But as there will be up to 200 curves to draw I should consider a more performant solution.

I have thought of these:

  • Buffering images for the zoom factors -1/+1 (Memory consuming)
  • Using librsvg and buffer an SVG image (I have read something about this. Does librsvg work under Windows too开发者_Python百科?)
  • Storing the cairo.Context after drawing groups of curves, and on zoom restoring it (just an idea.. is that possible?)

Are there other possibilities, and: what is the best solution?

Thanks a lot


Not really a concrete answer to your question, but I was faced with the same problem and just switched to matplotlib where a zoom and pan function is already implemented. I am not sure though if it is super performant. I have the feeling my program was running more smoothly before. I also tried out floatcanvas and floatcanvas2 but was not really happy with both of them.


If you're double-buffering anyway, why not do a quick bitmap scale as a "preview" while waiting for the newly redrawn vector image? I confess I don't know how to do this. But if you can make it work, it should work! :)

0

精彩评论

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

关注公众号