[Gtk-sharp-list] Drawing pixbufs to screen FAST..
Federico Mena Quintero
Tue, 18 Jan 2005 08:50:54 -0600
On Thu, 2004-12-30 at 16:40 +0000, Eto wrote:
> I am creating a console-like application that updates small parts of the
> display on the fly. I generate the character in a pixbuf, then draw that to
> the screen. (I need to do this because the character definitions are
> completely customizable). This is done in a background thread.
> The slow part is not generating the pixbuf, but rather, drawing it to screen.
> In windows, this is extreemly fast and works like a charm.
> I am not scaling the image or anything, just using the Drawable.DrawPixbuf
> method to output to screen (though, I would still like to be able to scale
> the output).
Some things to keep in mind:
- Do your pixbufs have an alpha channel? Due to the current
implementation in the X server of the RENDER extension, they may not go
through accelerated paths.
- If you'll be drawings many little pixbufs, it may be faster to
composite them onto a larger pixbuf without an alpha channel, and send
that to your window with DrawPixbuf(). Download the gtk-sharp sources
and see gtk-sharp/sample/GtkDemo/DemoPixbuf.cs, which makes a nice
- You may want to turn off double-buffering for your widget and handle
exposures yourself. EOG has a good example of a non-double-buffered
image widget that is quite fast.
- Can you pre-generate server-side pixmaps out of your pixbufs and keep
them around? That way they are likely to live in video memory, and
blitting will be very fast.
If you have a web page or something that shows what you are trying to do
in your program, we may be able to come up with more concrete