Cairo__Examples2.st
changeset 53 57718b3ac316
parent 51 5293f2b851ab
child 57 2c9a342e1f2a
--- a/Cairo__Examples2.st	Sun Feb 28 16:31:07 2016 +0000
+++ b/Cairo__Examples2.st	Sun Feb 28 16:36:53 2016 +0000
@@ -9,6 +9,7 @@
 	category:'Cairo-Examples'
 !
 
+
 !Examples2 class methodsFor:'accessing'!
 
 isTestSelector:aSelector
@@ -38,18 +39,44 @@
 
 !Examples2 methodsFor:'examples'!
 
-example01: gc <example: '01 - Rectangles'>
+example01a: gc <example: '01a - Rectangles'>
+"/ Draw reference lines...
 gc lineWidth: 1.
-gc paint: Color blue.
-gc fillRectangleX: 10 y: 10 width: gc width - 20 height: gc height - 20.
+gc paint: Color black.
+gc displayLineFromX: 1   y: 15  toX: 130 y: 15.
+gc displayLineFromX: 15  y: 1   toX: 15  y: 130.
+gc displayLineFromX: 1   y: 115 toX: 130 y: 115.
+gc displayLineFromX: 115 y: 1   toX: 115 y: 130.
+
+
+gc lineWidth: 10.
 gc paint: Color red.
-gc displayRectangleX: 10 y: 10 width: gc width - 20 height: gc height - 20.
+gc displayRectangleX: 15 y: 15 width: 100 height: 100.
+
 gc paint: Color blue.
-gc fillRectangleX: 10 y: 10 + ((gc height - 20) / 2) rounded width: gc width - 20 height: ((gc height - 20) / 2) rounded.
+gc fillRectangleX: 15 y: 65 width: 50 height: 50.
+
+    "Created: / 28-02-2016 / 15:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example01b: gc <example: '01b - Rectangles'>
+"/ Draw reference lines...
+gc lineWidth: 1.
 gc paint: Color black.
-gc displayLineFromX: 1 y: (gc height / 2) rounded toX: gc width y: (gc height / 2) rounded.
+gc displayLineFromX: 1   y: 15  toX: 130 y: 15.
+gc displayLineFromX: 15  y: 1   toX: 15  y: 130.
+gc displayLineFromX: 1   y: 115 toX: 130 y: 115.
+gc displayLineFromX: 115 y: 1   toX: 115 y: 130.
+
 
-    "Created: / 26-02-2016 / 22:57:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+gc lineWidth: 1.
+gc paint: Color red.
+gc displayRectangleX: 15 y: 15 width: 100 height: 100.
+
+gc paint: Color blue.
+gc fillRectangleX: 15 y: 65 width: 50 height: 50.
+
+    "Created: / 28-02-2016 / 15:44:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 example02: gc <example: '02 - Rectangles (rounded)'>
@@ -84,7 +111,7 @@
     "Modified: / 28-02-2016 / 14:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-example04: gc <example: '03 - PNG with alpha II'>
+example04: gc <example: '04 - PNG with alpha II'>
 | image |
 
 gc paint: Color white.
@@ -97,6 +124,27 @@
 image displayOn: gc x: 1 y: 1.
 
     "Created: / 28-02-2016 / 14:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+example05: gc <example: '05 - Checkerboard'>
+"
+Display a 8x8 checker board
+"
+| black white |
+
+black := Color black.
+white := Color white.
+
+1 to: 8 do:[:x |
+    1 to: 8 do:[:y |  
+        gc paint: ((x + y) even ifTrue:[ black ] ifFalse:[ white ]).
+        gc fillRectangleX: ((x - 1) * 32) + 1
+                        y: ((y - 1) * 32) + 1
+                    width: 32 height: 32.        
+    ]
+].
+
+    "Created: / 28-02-2016 / 15:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Examples2 methodsFor:'private'!
@@ -141,3 +189,10 @@
     "Created: / 26-02-2016 / 22:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Examples2 class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+