Color.st
changeset 8163 55b4897a908f
parent 8137 4d18d8b42894
child 8165 dec0d9176839
--- a/Color.st	Mon Sep 04 12:39:17 2017 +0200
+++ b/Color.st	Tue Sep 05 12:17:19 2017 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
@@ -4563,11 +4561,18 @@
 blue
     "return the blue component in percent [0..100]"
 
-    (blue isNil and:[colorId notNil]) ifTrue:[
-	device isNil ifTrue:[^ 0].
-	device getRGBFrom:colorId into:[:r :g :b | ^ b].
+    blue notNil ifTrue:[
+        ^ blue * 100.0 / MaxValue
     ].
-    ^ blue * 100.0 / MaxValue
+
+    (colorId notNil) ifTrue:[
+        device notNil ifTrue:[
+            device getRGBFrom:colorId into:[:r :g :b | ^ b].
+        ].
+    ].
+    ^ 0
+
+    "Modified: / 05-09-2017 / 12:15:57 / cg"
 !
 
 blueByte
@@ -4667,11 +4672,18 @@
 green
     "return the green component in percent [0..100]"
 
-    (green isNil and:[colorId notNil]) ifTrue:[
-	device isNil ifTrue:[^ 0].
-	device getRGBFrom:colorId into:[:r :g :b | ^ g].
+    green notNil ifTrue:[
+        ^ green * 100.0 / MaxValue
     ].
-    ^ green * 100.0 / MaxValue
+    
+    colorId notNil ifTrue:[
+        device notNil ifTrue:[
+            device getRGBFrom:colorId into:[:r :g :b | ^ g].
+        ].
+    ].
+    ^ 0
+
+    "Modified: / 05-09-2017 / 12:15:10 / cg"
 !
 
 greenByte
@@ -4794,14 +4806,18 @@
 red
     "return the red component in percent [0..100]"
 
-    (red isNil and:[colorId notNil]) ifTrue:[
-	device isNil ifTrue:[^ 0].
-	device getRGBFrom:colorId into:[:r :g :b | ^ r].
+    red notNil ifTrue:[
+        ^ red * 100.0 / MaxValue
     ].
-    red isNil ifTrue:[^ 0].
-    ^ red * 100.0 / MaxValue
-
-    "Modified: 11.6.1996 / 17:20:07 / cg"
+    
+    (colorId notNil) ifTrue:[
+        device notNil ifTrue:[
+            device getRGBFrom:colorId into:[:r :g :b | ^ r].
+        ].
+    ].
+    ^ 0
+
+    "Modified (format): / 05-09-2017 / 12:15:34 / cg"
 !
 
 red:r green:g blue:b
@@ -6209,6 +6225,17 @@
 
 !
 
+isPseudoColor
+    "for special uses only: 
+        colors which ONLY hold alpha values or
+        colorIDs (for example, for bit-blt operaions) 
+        are called 'pseudo colors'"
+     
+    ^ red isNil
+
+    "Created: / 05-09-2017 / 12:16:19 / cg"
+!
+
 isTranslucent
     "return true, if I represent a translucent color;
      that is: not completely opaque"