--- a/ImageEditor.st Thu Aug 04 18:16:37 2005 +0200
+++ b/ImageEditor.st Thu Aug 04 20:35:32 2005 +0200
@@ -3136,11 +3136,12 @@
atColor:aOldColor put:newColor
"a color changed to a new color
"
- |index list oldColor image newImage|
+ |index list oldColor image newImage oldSel|
list := self listOfColors.
index := list identityIndexOf:aOldColor.
+ oldSel := self selectionOfColor value.
index ~~ 0 ifTrue:[
oldColor := list at:index.
list at:index put:newColor
@@ -3167,6 +3168,10 @@
imageEditView setModified.
self updateImage.
self updateImagePreView.
+
+ self selectionOfColor value:oldSel.
+ imageEditView selectedColorIndex:oldSel.
+ imageEditView selectedColor:(self listOfColors at:oldSel).
]
].
!
@@ -4286,6 +4291,39 @@
].
!
+reduceNumberOfColors2
+ |s n anyChange img usedColors|
+
+ s := Dialog request:'Similarity Delta (1..) ?' initialAnswer:2.
+ s size == 0 ifTrue:[
+ self reduceNumberOfColors2.
+ ^ self
+ ].
+ n := Integer readFrom:s onError:0.
+ (n >= 1) ifFalse:[
+ Dialog warn:'Image unchanged'.
+ ^ self
+ ].
+
+ self withExecuteCursorDo:[
+"/ anyChange := imageEditView reduceColorResolutionBy:n.
+"/ anyChange ifFalse:[
+"/ Dialog warn:'Image unchanged'.
+"/ ] ifTrue:[
+"/ img := imageEditView image.
+"/ imageEditView image:img.
+"/
+"/ self fetchImageData.
+"/ usedColors := img usedColorsMax:10000.
+"/ usedColors size == 10000 ifTrue:[
+"/ Dialog information:('>= ' , usedColors size printString , ' colors used.')
+"/ ] ifFalse:[
+"/ Dialog information:(usedColors size printString , ' colors used.')
+"/ ]
+"/ ]
+ ].
+!
+
selectedColorIndexOrNil
| img clrIndex|