oops - had to undo 0-based indexing (some images use arrays as colormap)
authorClaus Gittinger <cg@exept.de>
Thu, 02 May 1996 17:31:02 +0200
changeset 637 08e099c202db
parent 636 cb58286c27ad
child 638 bec5f2d28039
oops - had to undo 0-based indexing (some images use arrays as colormap)
Colormap.st
--- a/Colormap.st	Thu May 02 12:58:42 1996 +0200
+++ b/Colormap.st	Thu May 02 17:31:02 1996 +0200
@@ -10,7 +10,7 @@
  hereby transferred.
 "
 
-Collection subclass:#Colormap
+SequenceableCollection subclass:#Colormap
 	instanceVariableNames:'redVector greenVector blueVector'
 	classVariableNames:''
 	poolDictionaries:''
@@ -103,13 +103,13 @@
 
 !Colormap methodsFor:'accessing'!
 
-at:pixelValue 
-    "return the color for a pixelValue. 
-     Notice that pixelValues range is 0..."
+at:index 
+    "return the color for a index. 
+     Notice that index range is 1..."
 
     |r g b idx "{ Class: SmallInteger }" |
 
-    idx := pixelValue+1.
+    idx := index.
     r := redVector at:idx.
     g := greenVector at:idx.
     b := blueVector at:idx.
@@ -120,12 +120,12 @@
         blue:(b * 100 / 255)
 
     "Created: 2.5.1996 / 12:21:40 / cg"
-    "Modified: 2.5.1996 / 12:38:34 / cg"
+    "Modified: 2.5.1996 / 17:29:24 / cg"
 !
 
-at:pixelValue put:aColor
-    "set the color for a pixelValue. Return aColor (sigh).
-     Notice that pixelValues range is 0..."
+at:index put:aColor
+    "set the color for a index. Return aColor (sigh).
+     Notice that index range is 1..."
 
     |r g b idx "{ Class: SmallInteger }" |
 
@@ -133,23 +133,23 @@
     g := (aColor green * 255 / 100) rounded.
     b := (aColor blue * 255 / 100) rounded.
 
-    idx := pixelValue+1.
+    idx := index.
     redVector at:idx put:r.
     greenVector at:idx put:g.
     blueVector at:idx put:b.
     ^ aColor
 
-    "Modified: 2.5.1996 / 12:38:45 / cg"
+    "Modified: 2.5.1996 / 17:29:29 / cg"
 !
 
-blueAt:pixelValue
-    "return the blue component for some pixelValue.
+blueAt:index
+    "return the blue component for some index.
      The returned value is scaled from the internal 0.. 255 to
      a percentage value 0..100"
 
-    ^ (blueVector at:pixelValue+1) * 100 / 255
+    ^ (blueVector at:index) * 100 / 255
 
-    "Modified: 2.5.1996 / 12:38:55 / cg"
+    "Modified: 2.5.1996 / 17:29:17 / cg"
 !
 
 colors
@@ -158,24 +158,24 @@
     ^ self asArray
 !
 
-greenAt:pixelValue
-    "return the green component for some pixelValue.
+greenAt:index
+    "return the green component for some index.
      The returned value is scaled from the internal 0.. 255 to
      a percentage value 0..100"
 
-    ^ (greenVector at:pixelValue+1) * 100 / 255
+    ^ (greenVector at:index) * 100 / 255
 
-    "Modified: 2.5.1996 / 12:38:15 / cg"
+    "Modified: 2.5.1996 / 17:29:36 / cg"
 !
 
-redAt:pixelValue
-    "return the red component for some pixelValue.
+redAt:index
+    "return the red component for some index.
      The returned value is scaled from the internal 0.. 255 to
      a percentage value 0..100"
 
-    ^ (redVector at:pixelValue+1) * 100 / 255
+    ^ (redVector at:index) * 100 / 255
 
-    "Modified: 2.5.1996 / 12:39:17 / cg"
+    "Modified: 2.5.1996 / 17:29:44 / cg"
 !
 
 size
@@ -236,21 +236,6 @@
     "Modified: 23.4.1996 / 22:13:31 / cg"
 ! !
 
-!Colormap methodsFor:'enumerating'!
-
-do:aBlock
-    "evaluate aBlock for each color in the receiver"
-
-    |n "{ Class: SmallInteger }"|
-
-    n := redVector size - 1.
-    0 to:n do:[:idx |
-        aBlock value:(self at:idx)
-    ]
-
-    "Created: 2.5.1996 / 12:53:36 / cg"
-! !
-
 !Colormap methodsFor:'misc'!
 
 scaleValuesBy:scaleFactor
@@ -272,5 +257,5 @@
 !Colormap class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.11 1996-05-02 10:58:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Colormap.st,v 1.12 1996-05-02 15:31:02 cg Exp $'
 ! !