diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 32df9f8f6..a8bee4fb3 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -149,16 +149,43 @@ void ImageArea::setInfoText (Glib::ustring text) infotext = text; Glib::RefPtr context = get_pango_context () ; - Pango::FontDescription fontd = context->get_font_description (); + Pango::FontDescription fontd(get_default_style()->get_font()); + + // update font fontd.set_weight (Pango::WEIGHT_BOLD); fontd.set_size (9 * Pango::SCALE); context->set_font_description (fontd); - ilayout = create_pango_layout(""); + + // create text layout + Glib::RefPtr ilayout = create_pango_layout(""); ilayout->set_markup(text); + + // get size of the text block int iw, ih; ilayout->get_pixel_size (iw, ih); - ipixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, true, 8, iw + 8, ih + 8); - ipixbuf->fill (128); + + // create BackBuffer + iBackBuffer.setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, iw + 16, ih + 16, true); + iBackBuffer.setDestPosition(8, 8); + + Cairo::RefPtr cr = iBackBuffer.getContext(); + + // cleaning the back buffer (make it full transparent) + cr->set_source_rgba (0., 0., 0., 0.); + cr->set_operator (Cairo::OPERATOR_CLEAR); + cr->paint (); + cr->set_operator (Cairo::OPERATOR_OVER); + + // paint transparent black background + cr->set_source_rgba (0., 0., 0., 0.5); + cr->paint (); + + // paint text + cr->set_source_rgb (1.0, 1.0, 1.0); + cr->move_to (8, 8); + ilayout->add_to_cairo_context (cr); + cr->fill (); + } void ImageArea::infoEnabled (bool e) @@ -206,7 +233,6 @@ bool ImageArea::on_expose_event(GdkEventExpose* event) return true; } - Glib::RefPtr window = get_window(); Cairo::RefPtr cr = get_window()->create_cairo_context(); if (mainCropWindow) { @@ -214,13 +240,7 @@ bool ImageArea::on_expose_event(GdkEventExpose* event) } if (options.showInfo && infotext != "") { - int fnw, fnh; - ilayout->get_pixel_size (fnw, fnh); - window->draw_pixbuf (get_style()->get_base_gc (Gtk::STATE_NORMAL), ipixbuf, 0, 0, 4, 4, fnw + 8, fnh + 8, Gdk::RGB_DITHER_NONE, 0, 0); - cr->set_source_rgb (1.0, 1.0, 1.0); - cr->move_to (8, 8); - ilayout->add_to_cairo_context (cr); - cr->fill (); + iBackBuffer.copySurface(cr); } for (std::list::reverse_iterator i = cropWins.rbegin(); i != cropWins.rend(); ++i) { diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index dcdc4f3ec..24a296913 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -41,9 +41,8 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi protected: Glib::ustring infotext; - Glib::RefPtr ilayout; Glib::RefPtr deglayout; - Glib::RefPtr ipixbuf; + BackBuffer iBackBuffer; bool showClippedH, showClippedS; ImageAreaPanel* parent;