--- a/ImageEditor.st Tue Aug 29 11:39:24 2000 +0200
+++ b/ImageEditor.st Wed Aug 30 21:50:24 2000 +0200
@@ -1215,6 +1215,11 @@
#enabled: #hasColormap
)
#(#MenuItem
+ #label: 'Clear masked pixels'
+ #translateLabel: true
+ #value: #clearMaskedPixels
+ )
+ #(#MenuItem
#label: '-'
)
#(#MenuItem
@@ -2123,6 +2128,26 @@
"Modified: / 16.3.1999 / 21:57:26 / cg"
!
+clearMaskedPixels
+ "clear all masked pixels (to pixelValue 0)"
+
+ |depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits|
+
+ oldImage := self image.
+
+ imageEditView makeUndo.
+
+ self withExecuteCursorDo:[
+ newImage := oldImage clearMaskedPixels.
+ (imageEditView image:newImage) notNil ifTrue:[
+ self listOfColors contents: newImage colorMap.
+ self findColorMapMode.
+ self updateLabelsAndHistory.
+self halt.
+ ]
+ ]
+!
+
colorMapChanged
|img|
@@ -2185,6 +2210,9 @@
] ifFalse:[
"/ see if all used color fit the new colormap
usedColors := oldImage usedColorsMax:(1 bitShift:depth).
+ (usedColors notNil and:[usedColors size > (1 bitShift:depth)]) ifTrue:[
+ usedColors := oldImage realUsedColors
+ ].
(usedColors notNil and:[usedColors size <= (1 bitShift:depth)]) ifTrue:[
"/ yea - just install them
usedColors asArray keysAndValuesDo:[:idx :clr |
@@ -2339,7 +2367,7 @@
^ self
].
- usedColors := oldImage usedColors.
+ usedColors := oldImage realUsedColors.
usedColors size == (1 bitShift:depth) ifTrue:[
self information:'Compress colorMap: All colors are used - no compression.'.
^ self