--- a/ImageEditor.st Sun Nov 19 13:28:45 2000 +0100
+++ b/ImageEditor.st Sun Nov 19 13:53:09 2000 +0100
@@ -1238,6 +1238,11 @@
#translateLabel: true
#value: #reduceNumberOfColors
)
+ #(#MenuItem
+ #label: 'Make GrayScale Image'
+ #translateLabel: true
+ #value: #makeGrayScale
+ )
)
nil
nil
@@ -1642,8 +1647,9 @@
!
update:something with:aParameter from:changedObject
- |clrIndex|
-
+ |clrIndex img|
+
+ img := self image.
changedObject == self listOfColors ifTrue:[
something == #at: ifTrue:[
"/ colormap entry changed at aParameter
@@ -1653,7 +1659,7 @@
clrIndex := clrIndex - 1.
].
- self image colorMap at:clrIndex put:(changedObject at:aParameter).
+ img colorMap at:clrIndex put:(changedObject at:aParameter).
self colorMapChanged.
^ self
].
@@ -1666,16 +1672,18 @@
changedObject == imageEditView ifTrue:[
something == #imageColors ifTrue:[
- self listOfColors contents:self image colorMap.
+ self listOfColors contents:img colorMap.
self findColorMapMode.
^ self.
].
something == #image ifTrue:[
- self imagePreView image:self image.
+ self imagePreView image:img.
+ self listOfColors contents:img colorMap.
+ self findColorMapMode.
^ self.
].
something == #subImageIn ifTrue:[
- self imagePreView image ~~ self image ifTrue:[
+ self imagePreView image ~~ img ifTrue:[
self halt:'should not happen'.
].
self imagePreView redraw:aParameter.
@@ -2474,6 +2482,23 @@
"Modified: / 15.9.1998 / 17:53:32 / cg"
!
+makeGrayScale
+ |anyChange img|
+
+ self withExecuteCursorDo:[
+ anyChange := imageEditView makeGrayScale.
+ anyChange ifFalse:[
+ Dialog warn:'Image unchanged'.
+ ] ifTrue:[
+ img := imageEditView image.
+ imageEditView image:img.
+ self listOfColors contents:(img colorMap).
+ self findColorMapMode.
+ self updateLabelsAndHistory.
+ ]
+ ].
+!
+
reduceNumberOfColors
|s n anyChange img|
@@ -2485,7 +2510,6 @@
^ self
].
- imageEditView makeUndo.
self withExecuteCursorDo:[
anyChange := imageEditView reduceColorResolutionBy:n.
anyChange ifFalse:[
@@ -2803,7 +2827,7 @@
doUndo
"reverses last edit action"
- imageEditView undo
+ imageEditView undo.
! !
!ImageEditor methodsFor:'user actions - loading'!