Re: [gtkmm] gtkmm graphics questions

Am 06.08.2002 10:54 schrieb(en) Jussi Pakkanen:
Hi all

I have been coding a Doom level editor for id
Software's Doom game with gtkmm 1.2. Currently the
editor runs on Linux and Windows and has all kinds of
stuff, such as Python scripting. You can check it out

(Beware, some of the menus are ghastly. This is my
first GUI project. ;) )

Anyhow, I have run into some problems when coding
graphics, colormaps and related things. Specifically:

gtkmm's (as well as gtk's) documentation on colormaps
 is somewhat confusing. If you open a new window, must
you reallocate colors in it or can you use the same
colormap as some other window? Once you have allocated
the colors you want, can you deallocate the Colormap
object or must you store it for the lifetime of the

I know I have allocated black color to my colormap.
When I create Gdk::Pixmaps I set their background to
black with gc.set_foreground(Gdk_Color("black")) and
draw_rectagle. Then I compose the actual graphics on
another pixmap with draw_pixmap. I then blit this to
the screen when I get an expose event. However the
color that should be black can be anything on screen:
yellow, green, gray, etc (on Windows it is black). I
also get lots of failed assertions on GdkPixmaps, but
the program still works. If I blit the original
pixmaps to a drawing area, the black color shows as

How can I make the graphics work better? GdkRGB seems
like a good idea, it's not wrapped according to
gtkmm's docs. Will it get wrapped soon? I wouldn't
want to code it now with GTK and later recode it using

Unless you provide a patch for gtkmm 1.2 it won't be wrapped.
All coding effort goes into gtkmm (pre) 2.0!
Also if you don't want to recode later the only way to go is gtkmm2!

If some of these things can be easily fixed by porting
to version 2 just tell me how it works in gtkmm2. I'll
port the program to gtkmm2 once both Linux and Windows
versions are stable.

The API is fairly stable - it will be frozen as soon as the few
outstanding issues have been solved. Expect no big changes.
You can go ahead using it at once!

Your first problem (lifetime cycle of a Colormap) will not arise at
all with gtkmm2 because it's the responsibility of gtkmm2 now to
deallocate Gdk::XYZ objects when they are not used any more. You
will never see Gdk::Colormap* in your code but only

Also have a look at the online docs of Gdk::Pixbuf, which is new in
gtkmm2. You may find it a lot easier to do off-screen drawing using
this neat class!



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]