--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Colormap.st Mon Feb 06 01:41:59 1995 +0100
@@ -0,0 +1,164 @@
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+
+Object subclass:#Colormap
+ instanceVariableNames:'redVector greenVector blueVector'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Graphics-Images support'
+!
+
+Colormap comment:'
+COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+$Header: /cvs/stx/stx/libview/Colormap.st,v 1.1 1995-02-06 00:41:56 claus Exp $
+'!
+
+!Colormap class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview/Colormap.st,v 1.1 1995-02-06 00:41:56 claus Exp $
+"
+!
+
+documentation
+"
+ Colormaps are used with images (and Forms) to keep the byte-to-color
+ mapping.
+ Internally, the values are stored as 3 separate byte-arrays
+ (i.e. individual components can be 0..255).
+"
+! !
+
+!Colormap class methodsFor:'instance creation'!
+
+redVector:r greenVector:g blueVector:b
+ ^ self new redVector:r greenVector:g blueVector:b
+! !
+
+!Colormap methodsFor:'accessing'!
+
+size
+ ^ redVector size
+!
+
+redVector:r greenVector:g blueVector:b
+ redVector := r.
+ greenVector := g.
+ blueVector := b.
+!
+
+redVector
+ "return redVector"
+
+ ^ redVector
+!
+
+redVector:something
+ "set redVector"
+
+ redVector := something.
+!
+
+greenVector
+ "return greenVector"
+
+ ^ greenVector
+!
+
+greenVector:something
+ "set greenVector"
+
+ greenVector := something.
+!
+
+blueVector
+ "return blueVector"
+
+ ^ blueVector
+!
+
+blueVector:something
+ "set blueVector"
+
+ blueVector := something.
+!
+
+at:index
+ "return the color at index - notice, that index is a typically derived
+ from an images pixel value which ranges 0..255; while the index here
+ starts at 1 (to make colormap look more like a collection)."
+
+ |r g b|
+ r := redVector at:index.
+ g := greenVector at:index.
+ b := blueVector at:index.
+ ^ Color
+ red:(r * 100 / 255)
+ green:(g * 100 / 255)
+ blue:(b * 100 / 255)
+!
+
+at:index put:aColor
+ "set the color at index - notice, that index is a typically derived
+ from an images pixel value which ranges 0..255; while the index here
+ starts at 1 (to make colormap look more like a collection)."
+
+ |r g b|
+ r := (aColor red * 255 / 100) rounded.
+ g := (aColor green * 255 / 100) rounded.
+ b := (aColor blue * 255 / 100) rounded.
+ redVector at:index put:r.
+ greenVector at:index put:g.
+ blueVector at:index put:b.
+! !
+
+!Colormap methodsFor:'converting'!
+
+asArray
+ |a|
+
+ a := Array new:(redVector size).
+ 1 to:a size do:[:i |
+ a at:i put:(self at:i)
+ ].
+ ^ a
+! !
+
+!Colormap methodsFor:'misc'!
+
+scaleValuesBy:scaleFactor
+ "multiply all values by scaleFactor; finally round to integer."
+
+ 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.
+ ]
+! !
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ContrWMenu.st Mon Feb 06 01:41:59 1995 +0100
@@ -0,0 +1,75 @@
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+
+Controller subclass:#ControllerWithMenu
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Support'
+!
+
+ControllerWithMenu comment:'
+COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+$Header: /cvs/stx/stx/libview/Attic/ContrWMenu.st,v 1.1 1995-02-06 00:41:59 claus Exp $
+'!
+
+!ControllerWithMenu class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview/Attic/ContrWMenu.st,v 1.1 1995-02-06 00:41:59 claus Exp $
+"
+!
+
+documentation
+"
+ ControllerWithMenus is a very simple controller for a view with
+ a middleButtonMenu.
+"
+! !
+
+!ControllerWithMenu methodsFor:'accessing'!
+
+menu
+ "to be redefined in subclasses"
+
+ ^ nil
+! !
+
+!ControllerWithMenu methodsFor:'events'!
+
+yellowButtonActivity
+ |m selection|
+
+ (m := self menu) notNil ifTrue:[
+ selection := self menu startUp.
+ selection ~~ 0 ifTrue:[
+ self perform:selection
+ ]
+ ]
+! !
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ControllerWithMenu.st Mon Feb 06 01:41:59 1995 +0100
@@ -0,0 +1,75 @@
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+
+Controller subclass:#ControllerWithMenu
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-Support'
+!
+
+ControllerWithMenu comment:'
+COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+$Header: /cvs/stx/stx/libview/ControllerWithMenu.st,v 1.1 1995-02-06 00:41:59 claus Exp $
+'!
+
+!ControllerWithMenu class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1994 by Claus Gittinger
+ All Rights Reserved
+
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice. This software may not
+ be provided or otherwise made available to, or used by, any
+ other person. No title to or ownership of the software is
+ hereby transferred.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libview/ControllerWithMenu.st,v 1.1 1995-02-06 00:41:59 claus Exp $
+"
+!
+
+documentation
+"
+ ControllerWithMenus is a very simple controller for a view with
+ a middleButtonMenu.
+"
+! !
+
+!ControllerWithMenu methodsFor:'accessing'!
+
+menu
+ "to be redefined in subclasses"
+
+ ^ nil
+! !
+
+!ControllerWithMenu methodsFor:'events'!
+
+yellowButtonActivity
+ |m selection|
+
+ (m := self menu) notNil ifTrue:[
+ selection := self menu startUp.
+ selection ~~ 0 ifTrue:[
+ self perform:selection
+ ]
+ ]
+! !