]> git.cworth.org Git - wordgame/commitdiff
Add a 3D "etched" effect to the lettering.
authorCarl Worth <cworth@cworth.org>
Tue, 5 Dec 2006 06:47:55 +0000 (22:47 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 5 Dec 2006 06:47:55 +0000 (22:47 -0800)
demo-item.c

index 99aaf4afa856a24213c2ea26841e323fe625d6e8..e34eb4c53d53df39f3982d8554959c2d7db72fe3 100644 (file)
@@ -104,6 +104,7 @@ goo_demo_item_paint (GooCanvasItemSimple *simple,
     int rad = (int) (item->size / 2);
     int cx = item->size / 2;
     int cy = cx;
+    int tx, ty;
     double spot_angle = M_PI / 4.0;
     double spot_rad = rad / 2.0;
     char string[2];
@@ -135,11 +136,19 @@ goo_demo_item_paint (GooCanvasItemSimple *simple,
     string[0] = item->letter;
     string[1] = '\0';
     cairo_text_extents (cr, string, &extents);
-    cairo_move_to (cr,
-                  cx - extents.width / 2 - extents.x_bearing,
-                  cy - extents.height / 2 - extents.y_bearing);
+    tx = cx - extents.width / 2 - extents.x_bearing;
+    ty = cy - extents.height / 2 - extents.y_bearing;
+
+    cairo_set_source_rgb (cr, 0.7, 0.7, 0.7);
+    cairo_move_to (cr, tx + 1, ty + 1);
+    cairo_show_text (cr, string);
+               
+    cairo_set_source_rgb (cr, 0.33, 0.33, 0.33);
+    cairo_move_to (cr, tx - 1, ty - 1);
+    cairo_show_text (cr, string);
 
     cairo_set_source_rgb (cr, 0.2, 0.3, 0.8);
+    cairo_move_to (cr, tx, ty);
     cairo_show_text (cr, string);
 
     cairo_restore (cr);