dia r3905 - in trunk: . plug-ins/cairo



Author: hans
Date: Sun Mar  9 12:04:07 2008
New Revision: 3905
URL: http://svn.gnome.org/viewvc/dia?rev=3905&view=rev

Log:
2008-03-09  Hans Breuer  <hans breuer org>

	* plug-ins/cairo/diacairo-renderer.c : hairline support



Modified:
   trunk/ChangeLog
   trunk/plug-ins/cairo/diacairo-renderer.c

Modified: trunk/plug-ins/cairo/diacairo-renderer.c
==============================================================================
--- trunk/plug-ins/cairo/diacairo-renderer.c	(original)
+++ trunk/plug-ins/cairo/diacairo-renderer.c	Sun Mar  9 12:04:07 2008
@@ -151,6 +151,17 @@
 
   DIAG_NOTE(g_message("set_linewidth %f", linewidth));
 
+  /* make hairline? */
+  if (linewidth == 0.0) {
+    double ax = 0.0, ay = 0.0;
+    double bx = 1.0, by = 0.0;    
+    
+    cairo_device_to_user_distance (renderer->cr, &ax, &ay);
+    cairo_device_to_user_distance (renderer->cr, &bx, &by);
+    
+    linewidth = sqrt ((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
+  }
+
   cairo_set_line_width (renderer->cr, linewidth);
   DIAG_STATE(renderer->cr)
 }
@@ -637,6 +648,7 @@
 
   cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);
 #ifdef HAVE_PANGOCAIRO_H
+  cairo_save (renderer->cr);
   /* alignment calculation done by pangocairo? */
   pango_layout_set_alignment (renderer->layout, alignment == ALIGN_CENTER ? PANGO_ALIGN_CENTER :
                                                 alignment == ALIGN_RIGHT ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT);
@@ -654,6 +666,7 @@
     pango_layout_iter_free (iter);
   }
   pango_cairo_show_layout (renderer->cr, renderer->layout);
+  cairo_restore (renderer->cr);
 #else
   /* using the 'toy API' */
   cairo_set_source_rgba (renderer->cr, color->red, color->green, color->blue, 1.0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]