gdk pixbufs, rgbbufs, efficiency, painting onto them
- From: "cali" <calculus softhome net>
- To: <gtk-app-devel-list gnome org>
- Subject: gdk pixbufs, rgbbufs, efficiency, painting onto them
- Date: Mon, 29 Nov 2004 20:40:23 -0000
I found that using a pixbuf was annoying because I was setting individual
pixel values using drawpoint, and I wasnt' allowed to access the data
directly... so I resorted to using an rgbbuf. I can see that this is the
fastest way to draw to screen since the entire buffer can be copied in one
go. Slightly less faster in the short term but faster in the long term would
be to use something like:
gchar **pixels = (gchar**)(g_malloc(HEIGHT*sizeof(gchar*));
for(i=0; i<height; i++)
pixels[i] = (gchar*)(g_malloc(WIDTH*sizeof(gchar));
(note that HEIGHT and WIDTH are not constants, they are just in capitals
here so that the sentence below is clearer).
then I could copy HEIGHT gchar buffers sequentially to the graphics memory,
then when my CA scrolled down (as a consequence of filling the screen) all I
would need to do is swap the start and end rows and fill in the end row,
instead of moving everything up.
I did think of another way, which would be to allocate a massive rgb_buf and
then move the start of rgb_buf along and keep adding the extra row on the
end until the buffer is full, then move back to the start of the buffer, so
the window slides along the large buffer.
So what am I talking about? A few things really. Can I copy directly to the
x-servers memory from within GTK, or would that mess things up?
Another problem I face is that I can't find any plotting routines for a
gchar buffer, does anybody know any decent ones?
I find it really strange that GTK doesn't provide a drawable surface that
also allows direct access to pixel values, i.e for maximum client side
efficiency, I mean, I don't need any of this server side stuff.
Maybe I'm being stupid because I don't know better. If you wanted fast
client side access to individual pixels but also the ability to draw
primatives, and you wanted to use GTK, what would you do?
cali
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]