Cairo__GraphicsContext.st
changeset 10 dd5fece7c8d2
parent 8 ccb6c1e6201e
child 11 fdc697f4f190
--- a/Cairo__GraphicsContext.st	Thu Apr 16 12:48:27 2009 +0000
+++ b/Cairo__GraphicsContext.st	Thu Apr 23 15:35:17 2009 +0000
@@ -48,6 +48,29 @@
     "Modified: / 10-09-2008 / 18:19:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
+!GraphicsContext class methodsFor:'examples'!
+
+rectangleOnTranscript
+
+    "
+        Cairo::GraphicsContext rectangleOnTranscript
+    "
+
+
+    | gc |
+    gc := Transcript cairo.
+    gc paint: Color black.
+    gc moveToX: 30 y: 50.
+    gc paint: (Color red alpha: 0.5).
+    gc rectangleX: 10 y: 15 width: 150 height: 60.
+    gc fill.
+    gc paint: (Color red alpha: 0.75).
+    gc rectangleX: 10 y: 15 width: 150 height: 60.
+    gc stroke.
+
+    "Created: / 23-04-2009 / 17:33:57 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
 !GraphicsContext class methodsFor:'primitives'!
 
 primAppendPath: cr path: path 
@@ -898,9 +921,10 @@
         paintRed:   (aColor red / 100) asDouble
         green:      (aColor green / 100) asDouble
         blue:       (aColor blue / 100) asDouble
-        alpha:      aColor alpha
+        alpha:      aColor alpha asDouble
 
     "Created: / 10-07-2008 / 11:18:13 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 23-04-2009 / 17:31:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
 surface
@@ -912,6 +936,25 @@
     "Modified: / 10-09-2008 / 20:53:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
+!GraphicsContext methodsFor:'cairo - font'!
+
+fontFaceFamily: family slant: slant weight: weight
+
+    ^self class primSelectFontFace: self
+        family: family asString
+        slant: slant asInteger
+        weight: weight asInteger
+
+    "Created: / 23-04-2009 / 17:23:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+fontSize: sz
+
+    ^self class primSetFontSize: self size: sz
+
+    "Created: / 23-04-2009 / 17:24:33 / Jan Vrany <vranyj1@fel.cvut.cz>"
+! !
+
 !GraphicsContext methodsFor:'cairo - paints'!
 
 paintRed: red green: green blue: blue alpha: alpha
@@ -924,6 +967,13 @@
 
 !GraphicsContext methodsFor:'cairo - paths'!
 
+moveToX: x y: y
+
+    ^self class primMoveTo: self x: x asFloat y: y asFloat
+
+    "Created: / 23-04-2009 / 17:21:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
 rectangleX: x y: y width: width height: height 
 
     ^self class 
@@ -934,6 +984,13 @@
         height: height asDouble
 
     "Created: / 10-07-2008 / 09:41:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+showText: aString
+
+    ^self class primShowText: self utf8: aString utf8Encoded
+
+    "Created: / 23-04-2009 / 17:25:20 / Jan Vrany <vranyj1@fel.cvut.cz>"
 ! !
 
 !GraphicsContext methodsFor:'cairo - stroke & fill'!