--- a/Colormap.st Tue Jun 06 06:11:58 1995 +0200
+++ b/Colormap.st Tue Jun 27 04:21:46 1995 +0200
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/Colormap.st,v 1.2 1995-03-18 05:10:02 claus Exp $
+$Header: /cvs/stx/stx/libview/Colormap.st,v 1.3 1995-06-27 02:18:24 claus Exp $
'!
!Colormap class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libview/Colormap.st,v 1.2 1995-03-18 05:10:02 claus Exp $
+$Header: /cvs/stx/stx/libview/Colormap.st,v 1.3 1995-06-27 02:18:24 claus Exp $
"
!
@@ -170,6 +170,31 @@
blueVector at:index put:b.
!
+redAt:index
+ "return the red component at some index.
+ The returned value is scaled from the internal 0.. 255 to
+ a percentage value 0..100"
+
+ ^ (redVector at:index) * 100 / 255
+!
+
+greenAt:index
+ "return the green component at some index.
+ The returned value is scaled from the internal 0.. 255 to
+ a percentage value 0..100"
+
+ ^ (greenVector at:index) * 100 / 255
+!
+
+blueAt:index
+ "return the blue component at some index.
+ The returned value is scaled from the internal 0.. 255 to
+ a percentage value 0..100"
+
+ ^ (blueVector at:index) * 100 / 255
+!
+
+
colors
"ST-80 compatibility: return a collection containing the colors I hold"
@@ -179,11 +204,12 @@
!Colormap methodsFor:'misc'!
scaleValuesBy:scaleFactor
- "multiply all values by scaleFactor; finally round to integer."
+ "multiply all values by scaleFactor; finally round to integer.
+ This can be used to brighten/darken an images colormap"
1 to:redVector size do:[:index |
redVector at:index put:((redVector at:index) * scaleFactor) rounded.
- greenVector at:index put:((redVector at:index) * scaleFactor) rounded.
- blueVector at:index put:((redVector at:index) * scaleFactor) rounded.
+ greenVector at:index put:((greenVector at:index) * scaleFactor) rounded.
+ blueVector at:index put:((blueVector at:index) * scaleFactor) rounded.
]
! !