Re: [gtkmm] Gdk::Colormap and Gdk::Color



> > {
> > Glib::RefPtr<Gdk::Pixmap> pm = Gdk::Pixmap::create(x,y,d);
> > Glib::RefPrt<Gdk::GC> gc = Gdk::GC::create(gc);
> > Glib::RefPtr<Gdk::Colormap> cm = gc->get_colorap()
> > Gdk::Color red("red");
> > 
> > cm->alloc_color(red);
> > pm->draw_line(gc, 0, 0, 100, 100);
> > }
> 
> I've never used colormaps but from what I see I think that the following
> solution should do the same:

Thanks for the reply,  It seems we were both halfway there.  you set
the foreground, but in order for it to actually be used (i.e. line be
red rather than black), it's gotta be alloc'd too.

So my question about Color's being Copy friendly still stands,  as
does my question about 'automagic-color' widgets.

Basically what I'm thinking is pretty much this (allowing for typos &
missing #includes)

http://www.koziarski.org/GColorManager.C
http://www.koziarski.org/GColorManager.h

Any problems with that code?  or am I needlessly duplicating work
available elsewhere?



-- 
========================================================================
| Michael Koziarski                   |"Conventional wisdom is often   |
| Data Engineer, Linux user           | long on convention and short   |
| & Objectivist.                      | on wisdom" --                  |
| http://www.koziarski.com            | Warren E. Buffett, BRK.A       |
========================================================================



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