WinPrinterContext.st
changeset 2399 1de98d034f71
parent 2384 1c53fc6edb39
child 2446 c04a44b89cf2
--- a/WinPrinterContext.st	Tue Feb 26 22:47:57 2008 +0100
+++ b/WinPrinterContext.st	Wed Feb 27 15:55:22 2008 +0100
@@ -1453,6 +1453,11 @@
 %}
 !
 
+platformName
+    "used by #fillRoundRectangleX ...."
+    ^ Smalltalk platformName asUppercase      
+!
+
 setBitmapMask:aBitmapId in:aDC
     "set or clear the drawing mask - a bitmap mask using current fg/bg"
 
@@ -2082,6 +2087,57 @@
     "Created: / 28-07-2006 / 20:18:25 / fm"
 !
 
+displayRoundRectangleX:left y:top width:width height:height wCorner:wCorn hCorner:hCorn
+    |right bottom wC hC wHalf hHalf|
+
+    right := left + width-1.
+    bottom := top + height-1.
+
+    wC := wCorn.
+    hC := hCorn.
+
+    self scale = 1 ifTrue:[
+        wHalf := wC // 2.
+        hHalf := hC // 2.
+    ] ifFalse:[
+        wHalf := wC / 2.
+        hHalf := hC / 2.
+    ].
+
+    "top left arc"
+    self displayArcX:left y:top width:wC height:hC from:90 angle:90.
+
+    "top right arc"
+    self displayArcX:(right - wC) y:top width:wC height:hC from:0 angle:90.
+
+    "bottom right arc"
+    self displayArcX:(right - wC) y:(bottom - hC) width:wC height:hC from:270 angle:90.
+
+    "bottom left arc"
+    self displayArcX:left y:(bottom - hC) width:wC height:hC from:180 angle:90.
+
+    "top line"
+    self displayLineFromX:(left + wHalf) y:top toX:(right - wHalf+1) y:top.
+
+    "left line"
+    self displayLineFromX:left y:(top + hHalf - 1) toX:left y:(bottom - hHalf).
+
+    "bottom line"
+    self displayLineFromX:(left + wHalf-1) y:bottom
+                      toX:(right - wHalf ) y:bottom.
+
+    "right line"
+    self displayLineFromX:right y:(top + hHalf) toX:right y:(bottom - hHalf).
+
+
+    "
+     |v|
+
+     (v := View new) extent:200@200; openAndWait.
+     v displayRoundRectangleX:10 y:10 width:100 height:100 wCorner:20 hCorner:20
+    "
+!
+
 displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId
     "draw a sub-string - draw foreground only.
      If the coordinates are not integers, retry with rounded."
@@ -5954,5 +6010,5 @@
 !WinPrinterContext class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/WinPrinterContext.st,v 1.31 2008-02-06 11:46:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/WinPrinterContext.st,v 1.32 2008-02-27 14:55:22 mb Exp $'
 ! !