Gdk::Bitmap 1 bit x pixel drawing
- From: angelo dureghello <angelo70 gmail com>
- To: gtkmm-list gnome org
- Subject: Gdk::Bitmap 1 bit x pixel drawing
- Date: Wed, 15 Aug 2007 17:09:43 +0200
Hello all,
i'm trying to draw a rectangle on a Gdk::Bitmap, to have the mask for a
transparent window.
In any way, i can't draw on the Bitmap. Using draw_rectangle don't
produce any change on the Bitmap data. Even if i ude set_rgb_fg_color to
white, nothing change.
If i put the pixel to 1, setting bytes to 0xff, it works.
The Pango::Layout is drawed correctly, even on the Bitmap.
This is my code:
bool WTransp::on_expose_event (GdkEventExpose* ev)
{
int w, h;
int size;
get_size(w, h);
size = (w * h) >> 3;
char * data = new char[1+size];
memset(data, 0x00, 1+size);
Glib::RefPtr<Gdk::Bitmap> mask = Gdk::Bitmap::create(data, w, h);
delete[] data;
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(mask);
gc->set_rgb_fg_color(Gdk::Color("white"));
mask->draw_layout (gc,
20,
20,
m_rploTxt);
mask->draw_rectangle (gc,
false,
0,
0,
10,
10
);
get_window()->draw_layout (get_style()->get_white_gc(),
20,
20,
m_rploTxt);
get_window()->draw_rectangle (get_style()->get_white_gc(),
false,
0,
0,
10,
10
);
// Mask out transparent parts of the pixmap.
shape_combine_mask(mask, 0, 0);
return false;
}
If any help, thanks Angelo.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]