Author: Nikita Kitaev <[email protected]>
Date: Mon Mar 21 16:47:55 2011 -0700
Render navigator using cairo
---
synfig-studio/src/gui/docks/dock_navigator.cpp | 33 ++++++++++++++---------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/synfig-studio/src/gui/docks/dock_navigator.cpp
b/synfig-studio/src/gui/docks/dock_navigator.cpp
index 51d86e6..ecc476b 100644
--- a/synfig-studio/src/gui/docks/dock_navigator.cpp
+++ b/synfig-studio/src/gui/docks/dock_navigator.cpp
@@ -39,6 +39,7 @@
#include <synfig/context.h>
#include <synfig/target_scanline.h>
#include <synfig/surface.h>
+#include <gdkmm/general.h>
#include <gtkmm/separator.h>
@@ -324,28 +325,25 @@ bool
studio::Widget_NavView::on_expose_draw(GdkEventExpose */*exp*/)
//draw to drawing area
Glib::RefPtr<Gdk::GC> gc =
Gdk::GC::create(drawto.get_window());
+ Cairo::RefPtr<Cairo::Context> cr =
drawto.get_window()->create_cairo_context();
//synfig::warning("Nav: Scaling pixmap to off (%d,%d) with size
(%d,%d)", offx,offy,nw, nh);
Glib::RefPtr<Gdk::Pixbuf> scalepx =
prev->scale_simple(nw,nh,Gdk::INTERP_NEAREST);
+ cr->save();
+
//synfig::warning("Nav: Drawing scaled bitmap");
- drawto.get_window()->draw_pixbuf(
- gc, //GC
- scalepx, //pixbuf
- 0, 0, // Source X and Y
- offx, offy, // Dest X and Y
- -1,-1, // Width and Height
- Gdk::RGB_DITHER_MAX, // RgbDither
- 2, 2 // Dither offset X and Y
- );
+ Gdk::Cairo::set_source_pixbuf(
+ cr, //cairo context
+ scalepx, //pixbuf
+ offx, offy //coordinates to place upper left corner of pixbuf
+ );
+ cr->paint();
//draw fancy red rectangle around focus point
const Point &wtl =
get_canvas_view()->work_area->get_window_tl(),
&wbr =
get_canvas_view()->work_area->get_window_br();
- gc->set_rgb_fg_color(Gdk::Color("#ff0000"));
-
gc->set_line_attributes(2,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER);
-
//it must be clamped to the drawing area though
int l=0,rw=0,t=0,rh=0;
const Point fp =
-get_canvas_view()->work_area->get_focus_point();
@@ -364,7 +362,16 @@ bool studio::Widget_NavView::on_expose_draw(GdkEventExpose
*/*exp*/)
//synfig::warning("Nav: tl (%f,%f), br (%f,%f)",
wtl[0],wtl[1],wbr[0],wbr[1]);
//synfig::warning("Nav: tl (%f,%f), br (%f,%f)",
wtl[0],wtl[1],wbr[0],wbr[1]);
//synfig::warning("Nav: Drawing Rectangle (%d,%d) with dim
(%d,%d)", l,t,rw,rh);
- drawto.get_window()->draw_rectangle(gc,false,l,t,rw,rh);
+
+ cr->set_line_width(2.0);
+ cr->set_line_cap(Cairo::LINE_CAP_BUTT);
+ cr->set_line_join(Cairo::LINE_JOIN_MITER);
+ cr->set_antialias(Cairo::ANTIALIAS_NONE);
+ cr->set_source_rgb(1,0,0);
+ cr->rectangle(l,t,rw,rh);
+ cr->stroke();
+
+ cr->restore();
}
return false; //draw everything else too
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl