[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GdkImage from GdkPixbuf
- From: Tristan Van Berkom <tvb gnome org>
- To: gtk-app-devel-list gnome org
- Subject: Re: GdkImage from GdkPixbuf
- Date: Tue, 29 May 2007 12:34:36 -0400
On Tue, 2007-05-29 at 18:02 +0200, David Nečas (Yeti) wrote:
> On Tue, May 29, 2007 at 11:04:53AM -0400, Tristan Van Berkom wrote:
> > I've been beating my head against the tree for this one
> > for the last 2 days... so, is there some code out there
> > that will gdk_pixbuf_render_image() ?
> >
> > I actually dont even want compositing, something like:
> > memcpy (image->mem, pixbuf->pixels, image->bpl * image->height)
> >
> > would do fine (minus the alpha channel)... but I can see its going
> > to be a little more complex (taking byte order into account, image
> > depths etc).
> >
> > If I have to end up writing this myself, are there any interesting
> > bits of lowlevel gdk that will help me ?
>
> You can draw GdkPxibuf on a GdkDrawable (i.e. GdkPixmap)
> with gdk_draw_pixbuf() and get the contents of the
> GdkDrawable to a GdkImage with gdk_drawable_get_image() or
> gdk_drawable_copy_to_image(). On full Moon if it's even
> Tuesday. And it goes through the X server. Actually
> I think if you use GdkImage you deserve it...
In fact, using GdkImage is the only way you can get MIT-SHM
pixmaps, the whole point is to keep the pixmap store in a
shared memory segment so that when freeing ~20MB of pixmaps
there's no huge portions of fragmented free memory locked
down by the X server process.
The pitfall is that I /should/ be loading my pixbuf directly
into the shared memory segment owned by the GdkImage but
instead I'm stuck with GdkDrawable routines (which result
in XCopyArea which does do a local copy but involves some
synchronization with the server, which I believe slows things
down considerably).
So thankyou very much for deciding what I deserve for me.
> There are some useful bits in GdkRGB, but more in its source
> code than its API. And by bits I mean almost complete
> gdkrgb.c including the dithering matrices.
I've found gdkpixbuf-drawable.c to be the pain that I'm looking
for, the rgbconvert() function should probably not take a GdkImage
parameter and thus allow for two-way conversions, allowing the
addition of a gdk_pixbuf_render_image() api.
Cheers,
-Tristan
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]