setForegroundColor/setBackgroundColor in gc added
authorjames
Thu, 18 Oct 2001 16:56:17 +0200
changeset 3528 0685e8772b51
parent 3527 cac44b80270e
child 3529 9993ee58e885
setForegroundColor/setBackgroundColor in gc added
DeviceWorkstation.st
--- a/DeviceWorkstation.st	Thu Oct 18 11:57:34 2001 +0200
+++ b/DeviceWorkstation.st	Thu Oct 18 16:56:17 2001 +0200
@@ -5045,11 +5045,30 @@
 !
 
 setBackground:bgColorIndex in:aGCId
-    "set background color to be drawn with"
+    "set background color-index to be drawn with"
 
     ^ self subclassResponsibility
 !
 
+setBackgroundColor:bgColor in:aGCId
+    "set background color to be drawn with"
+
+    |colorId deviceColor|
+
+    colorId := bgColor colorId.
+    colorId isNil ifTrue:[
+        deviceColor := bgColor onDevice:self.
+        deviceColor notNil ifTrue:[
+            colorId := bgColor colorId.
+        ]
+    ].
+    colorId isNil ifTrue:[
+        'DeviceWorkstation [warning]: could not set bg color' infoPrintCR.
+    ] ifFalse:[
+        self setBackground:colorId in:aGCId.
+    ]
+!
+
 setBitmapMask:aBitmapId in:aGCId
     "set or clear the drawing mask - a bitmap mask using current fg/bg"
 
@@ -5085,17 +5104,44 @@
 !
 
 setForeground:fgColorIndex background:bgColorIndex in:aGCId
-    "set foreground and background colors to be drawn with"
-
-    ^ self subclassResponsibility
+    "set foreground and background color-indices to be drawn with"
+
+    self setForeground:fgColorIndex in:aGCId.
+    self setBackground:bgColorIndex in:aGCId.
 !
 
 setForeground:fgColorIndex in:aGCId
-    "set foreground color to be drawn with"
+    "set the foreground color-index to be drawn with"
 
     ^ self subclassResponsibility
 !
 
+setForegroundColor:fgColor backgroundColor:bgColor in:aGCId
+    "set foreground and background colors to be drawn with"
+
+    self setForegroundColor:fgColor in:aGCId.
+    self setBackgroundColor:bgColor in:aGCId.
+!
+
+setForegroundColor:fgColor in:aGCId
+    "set the foreground color to be drawn with"
+
+    |colorId deviceColor|
+
+    colorId := fgColor colorId.
+    colorId isNil ifTrue:[
+        deviceColor := fgColor onDevice:self.
+        deviceColor notNil ifTrue:[
+            colorId := fgColor colorId.
+        ]
+    ].
+    colorId isNil ifTrue:[
+        'DeviceWorkstation [warning]: could not set fg color' infoPrintCR.
+    ] ifFalse:[
+        self setForeground:colorId in:aGCId.
+    ]
+!
+
 setFunction:aFunctionSymbol in:aGCId
     "set alu function to be drawn with"
 
@@ -7384,6 +7430,6 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.403 2001-10-10 13:06:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.404 2001-10-18 14:56:17 james Exp $'
 ! !
 DeviceWorkstation initialize!