Drawing an image on a Bitmap mask
- From: Martin Bailey <martin pcalpha com>
- To: gtkmm-list gnome org
- Subject: Drawing an image on a Bitmap mask
- Date: Wed, 30 Nov 2005 12:53:28 -0500
Hi,
I'm trying to learn how to draw an image over a Bitmap mask.
The part I'm having difficulties with is the colormap (I get an error in
the console saying I need to set a colormap to my Drawable (Bitmap))
The code is commented below and I've put the rest to give you an idea of
my function. Should draw the babytux.png image starting at (10,10) on
the sceen
----------
std::vector<char> buffer(Gdk::screen_width() * Gdk::screen_height(), 0x00);
Glib::RefPtr<Gdk::Bitmap> m_mask = Gdk::Bitmap::create(&buffer[0],
Gdk::screen_width(),Gdk::screen_height());
Glib::RefPtr<Gdk::GC> m_mask_gc = Gdk::GC::create(m_mask);
Glib::RefPtr<Gdk::Pixbuf> image =
Gdk::Pixbuf::create_from_file("babytux.png");
/* hmmm?
Glib::RefPtr<Gdk::Colormap> colormap =
Gdk::Colormap::create(Gdk::Visual::get_system(),true);
colormap->alloc_color(black);
m_mask->set_colormap(colormap);
*/// hmm?
image->render_to_drawable(m_mask,m_mask_gc,0,0,10,10,image->get_width(),image->get_height(),Gdk::RGB_DITHER_NONE,0,0);
get_window()->shape_combine_mask(m_mask, 0, 0);
queue_draw();
----------
Any ideas?
Thanks a lot in advance!
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]