Re: How to draw to a pixbuf?



On Tue, 2 Sep 2008 16:55:08 +0200
Carlo Wood <carlo alinoe com> wrote:
[snip]
> I also tried to create a cairo contex with alpha from the start, but
> that has problems: M_drawable->get_window()  (my main window) simply
> has no transparancy, it's my screen - and if I explicitely set the
> depth to 32 with:
> 
>   Glib::RefPtr<Gdk::Pixmap> icon_pixmap =
> Gdk::Pixmap::create(Glib::RefPtr<Gdk::Drawable>(0), 16, 16, 32);
> 
> then it complains about not having a colormap. If then I add the
> colormap from M_drawable I get a runtime error that the depth's
> aren't matching.

The call to Gdk::Pixmap::create() should not complain about a colormap.
The only purpose of passing the drawable is to determine default values
for the pixmap (including a colormap). The Gdk::Pixmap::create()
functions are not documented but the equivalent documentation for the C
functions indicates that that should work.  See:

http://library.gnome.org/devel/gdk/stable/gdk-Bitmaps-and-Pixmaps.html#gdk-pixmap-new

Are you sure it is not the call to Gdk::Pixbuf::create() which is not
doing the complaining?  You need to pass a colormap object for that to
work, using Gdk::Pixbuf::create(const Glib::RefPtr<Drawable>&,
const Glib::RefPtr<Colormap>&, int, int, int, int, int, int), since
your drawable created as mentioned above will not have a colormap.

Chris



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