From: Axel S. <Axe...@en...> - 2009-01-30 15:21:17
|
On Fri, 2009-01-30 at 16:03 +0100, Peter Verswyvelen wrote: > Yes I am using Cairo. Does an alternative exists for doing vector > graphics and bitmap painting? Well, for vector graphics there's probably only Cairo. If you're always taking a bitmap and draw something on it with vector graphics afterwards (rather than alternating one after the other) then there are some magic functions in Graphics.UI.Gtk.Cairo that allow you to take a Pixbuf and turn it into a cairo surface. Thus, each time your image is changing you could - draw the bitmap parts into a new Pixbuf pb using one of the following: - manipulate the pixels using pixbufGetPixels - load a pixbuf from file - draw into a Pixmap using the old-style drawing functions in Graphics.UI.Gtk.Gdk.Drawable - draw the Cairo parts onto a surface you get from cairoImageSurfaceFromPixbuf pb Then, each time the expose handler is run, you need to - draw the exposed region/rectangle using drawPixbuf in Graphics.UI.Gtk.Gdk.Drawable > What has become of Glitz, the OpenGL backend? Is this dead? I don't think anybody has started on that... Cheers, Axel. > On Fri, Jan 30, 2009 at 2:33 PM, Axel Simon <Axe...@en...> wrote: > > On Fri, 2009-01-30 at 14:26 +0100, Peter Verswyvelen wrote: > >> When double buffering is turned on, repainting even a single rectangle > >> becomes rather slow when the windows gets large. > >> > >> The overhead does not seem the number of shapes being painted, but the > >> pixel area they cover. > >> > >> Is this a known issue? > >> > >> Maybe this is just a GTK issue and I should ask in the GTK list? > > > > Are you using Cairo? It seems that Cairo is rather slow, especially > > earlier versions. We had questions from other people who said redrawing > > was very slow. It's probably not the Haskell side but more of a way the > > API is used. For instance, our example SVG viewer in /demos/svg/ takes > > minutes with older Cairo versions to draw more complex images whereas it > > takes two seconds on with Cairo 1.4.1. > > > > Axel. > > > > |