Hello, colleagues !
I have to draw something in circle, I draw black circle on my event box
by cairo as a presented on screen shot, try to make
Glib::RefPtr<Gdk::Pixmap> pgPixmap such this
Glib::RefPtr<Gdk::Drawable> pDr = eBox->get_window ();
int w = eBox->get_allocation().get_width();
int h = eBox->get_allocation().get_height();
if (pDr)
pgPixmap = Gdk::Pixmap::create (pDr, w, h);
//
// set colors
//
Gdk::Color bgCol;
bgCol.set_rgb_p (0.0, 0.0, 0.0);
Gdk::Color fgCol;
fgCol.set_rgb_p (1.0, 1.0, 1.0);
Glib::RefPtr<Gdk::GC> pGC = Gdk::GC::create (pDr);
pGC->set_background (bgCol);
pGC->set_foreground (fgCol);
int radius = w < h ? w-40 : h-40;
radius /= 2.0;
pgPixmap->draw_arc (pGC, true, w/2, h/2, radius, radius, 0.0, 64*360);
get image from pgPixmap such this
Glib::RefPtr<Gdk::Image> pIm = pgPixmap->get_image (0, 0, w, h);
const void* data = pIm->get_mem ();
make Bitmap
Glib::RefPtr<Gdk::Bitmap> pgBitmap = Gdk::Bitmap::create (pDr, (const
char*)data, w, h);
put it onto my event box
eBox->add_pixmap (pgPixmap, pgBitmap);
but nothing changes, where is my error and which way I have to do it ?
Thanks a lot,
Yuriy Rusinov.
Attachment:
signature.asc
Description: OpenPGP digital signature