> Try using a Cairo surface (or cairo_surface_t) with the appropriate
> scaling factor (see cairo_surface_set_device_scale).
>
> A GdkPixbuf doesn't have a scaling factor attached to it, but a Cairo
> surface does. Generally speaking, these days there's a trend to move
> towards the latter wherever possible and makes sense.
I tried using a Gtk::DrawingArea instead of my Gtk::Image, and then used
the following override of 'DrawingArea::on_draw' to draw my pixbuf onto
the Cairo surface provided by the DrawingArea:
-----
bool MyArea::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
if(!pixbuf) return false;
auto surface = cr->get_target();
auto csurface = surface->cobj();
cairo_surface_set_device_scale(csurface, 1.0, 1.0);
Gdk::Cairo::set_source_pixbuf(cr, pixbuf, 0, 0);
cr->paint();
}
-----
Unfortunately, the inclusion of that 'cairo_surface_set_device_scale'
makes the widget go black completely, unless the scale factor already
was 1.0.
So this is probably not what you meant... Can you give me a pointer?
Thanks,
Kasper
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list