Re: Allocating a lot of colors
- From: John Cupitt <john cupitt ng-london org uk>
- To: Lokesh Setia <lsetia78 yahoo com>
- Cc: gtk-list gnome org
- Subject: Re: Allocating a lot of colors
- Date: Thu, 21 Jun 2001 12:34:21 +0100
Lokesh Setia wrote:
> First of all, I will like to ask whether drawing_area widget with a
> backing pixmap is the best choice for this?
Hi Lokesh, the way to do this by hand is to use gdk_rgb_*(). Take a look
at testrgb.c in the gtk source area.
gdk_rgb_*() does all the horrible X stuff for you: it finds an
appropriate visual, opens a shared memory area (if possible), and takes
care of all the dithering that might be necessary to get nice looking
colour. You just make a big RGB array, and call gdk_draw_rgb_image().
It's pretty quick too: I get 10 Mpixels/sec on my (modest) system, so
you should be OK for your 50ms timeslot.
If you want something higher level, then gdk-pixbuf is your baby. It
adds things like rescale and image load and save.
> I will have to call
> gdk_draw_point{s}( ) in this case I guess.
> Second, when the image changes (it does after every 50 msec), colors may
> need to be allocated/deallocated. Doing gdk_colormap_alloc_color() in a
> loop seems to be a grossly inefficient way of doing this. Is there any
> other option?
/me falls over
This will be rather slow :-)
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]