1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| int size = 100;
int height = 13;
int width = 200;
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, size, size);
Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(pixbuf->get_pixels(), Cairo::FORMAT_ARGB32, size, size, pixbuf->get_rowstride() );
Cairo::RefPtr<Cairo::Context> context = Cairo::Context::create(surface);
context->save();
context->set_operator(Cairo::OPERATOR_CLEAR);
context->paint();
context->restore();
context->save();
context->set_source_rgba(1.0, 1.0, .0, 1.0);
context->select_font_face("Monaco", Cairo::FONT_SLANT_NORMAL, Cairo::FONT_WEIGHT_BOLD);
context->set_font_size(8);
context->move_to(9, height - 4);
context->show_text ("categorie");
context->paint_with_alpha(0.6);
context->restore();
Gdk::Cairo::set_source_pixbuf(context, pixbuf, size, size);
(dynamic_cast<Gtk::CellRendererPixbuf *> (renderer))->property_pixbuf() = pixbuf; |