Cairo__Examples1.st
changeset 67 b8bfa65ab23b
parent 63 054f0513ea65
child 88 9d51db2ba641
--- a/Cairo__Examples1.st	Mon Mar 21 22:36:57 2016 +0000
+++ b/Cairo__Examples1.st	Tue Mar 22 20:11:12 2016 +0000
@@ -153,7 +153,7 @@
 "
 Color stops in gradient patterns may have alpha as well!!
 This shows a linear gradient with first stop being %80 
-teansparent.
+opaque.
 "
 | black white gradient |
 
@@ -185,6 +185,33 @@
 cr fill.
 
     "Created: / 21-03-2016 / 22:25:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 22-03-2016 / 16:13:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example27: cr <example: '27 - Text as path'>
+"
+Shows text rendered with black outline and filled
+with 80% opaque gradient.
+"
+| text extents gradient |
+text := 'cairo graphics'.
+cr font: 'Helvetica' slant: Cairo::FontSlant CAIRO_FONT_SLANT_NORMAL weight: Cairo::FontWeight CAIRO_FONT_WEIGHT_NORMAL.
+cr fontSize: 100.
+extents := cr textExtents: text.
+cr moveToX: 10 y: extents height + 10.
+cr rotate: 0.3.
+cr textToPath: text.
+cr source: Color black.
+cr strokeAndPreserve.
+gradient := Cairo::Pattern linearFromX: 10 y: 0 toX: extents width + 10 y: 0.
+gradient addColor: ((Color red:95.294117647058826 green:60.0 blue:7.8431372549019605) alpha: 0.8)
+           stopAt: 0.
+gradient addColor: ((Color red:95.294117647058826 green:60.0 blue:7.8431372549019605) darker alpha: 0.6)
+           stopAt: 1.
+cr source: gradient.
+cr fill.
+
+    "Created: / 22-03-2016 / 16:16:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Examples1 methodsFor:'private'!