#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Mon, 08 Aug 2016 14:06:59 +0200
changeset 3317 88b892a4012d
parent 3316 db4749aa5c60
child 3318 0b25d802e1b9
#FEATURE by cg class: ImageEditor changed: #colorMapMode: #findColorMapMode converting masked image to an alpha image
ImageEditor.st
--- a/ImageEditor.st	Wed Aug 03 14:32:31 2016 +0200
+++ b/ImageEditor.st	Mon Aug 08 14:06:59 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997-1998 by eXept Software AG
               All Rights Reserved
@@ -4014,7 +4016,10 @@
                 someOrAllUsedColors sort:self sortBlockForColors.
                 newListOfColors addAll:someOrAllUsedColors.
                 "/ listOfColors add:Color black; add:Color white.
-            ]
+            ].
+            image mask notNil ifTrue:[
+                newListOfColors := (Array with:(Color noColor)),newListOfColors.
+            ].
         ] ifFalse:[
             newListOfColors addAll:(image colorMap).
         ].
@@ -4024,6 +4029,9 @@
             self colorMapMode: colorMapMode value.
             image := self image.
         ].                               
+        "/ image mask notNil ifTrue:[
+        "/     newListOfColors := (Array with:(Color noColor)),newListOfColors.
+        "/ ].
     ].  
     newListOfColors notEmptyOrNil ifTrue:[
         drawColor1 := newListOfColors at:1.
@@ -5470,6 +5478,11 @@
             ].
         ] ifFalse:[ 
             image mask: nil.
+            oldImage mask notNil ifTrue:[
+                newImage depth == 32 ifTrue:[
+                    newImage computeAlphaValuesFromMask:oldImage mask
+                ].
+            ].
         ]. 
 
         (newColorMap isOrderedCollection or:[newColorMap isFixedPalette not]) ifTrue:[