Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?)
  • 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

like image 614
any1 Avatar asked May 18 '11 18:05

any1


1 Answers

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.

like image 143
Christoph Avatar answered Nov 15 '22 11:11

Christoph