#FEATURE by cg draft
authorClaus Gittinger <cg@exept.de>
Tue, 11 Apr 2017 01:46:29 +0200
changeset 3436 c37d341dc7f7
parent 3435 e3e1eea25472
child 3437 116007599b02
#FEATURE by cg class: ImageEditor changed: #colorMapMode:
ImageEditor.st
--- a/ImageEditor.st	Mon Apr 10 08:46:45 2017 +0200
+++ b/ImageEditor.st	Tue Apr 11 01:46:29 2017 +0200
@@ -6612,14 +6612,18 @@
 
         (aMode asString startsWith:'mask') ifTrue:[
             image mask isNil ifTrue:[
-                false "(Dialog confirm:'Generate mask from black ?' default:false)" ifTrue:[
-                    maskThreshold := 0.1.
-                    maskImage := Depth1Image fromImage:(image asThresholdMonochromeImage:maskThreshold). 
-                ] ifFalse:[
-                    maskImage := ImageMask extent:image extent.
-                    maskImage bits:(ByteArray 
-                                        new:(maskImage bytesPerRow * maskImage height)
-                                        withAll:16rFF).
+                (oldImage depth == 32 and:[ oldImage photometric == #rgba ]) ifTrue:[
+                    maskImage := ImageMask fromAlphaInImage:oldImage
+                ] ifFalse:[    
+                    false "(Dialog confirm:'Generate mask from black ?' default:false)" ifTrue:[
+                        maskThreshold := 0.1.
+                        maskImage := Depth1Image fromImage:(image asThresholdMonochromeImage:maskThreshold). 
+                    ] ifFalse:[
+                        maskImage := ImageMask extent:image extent.
+                        maskImage bits:(ByteArray 
+                                            new:(maskImage bytesPerRow * maskImage height)
+                                            withAll:16rFF).
+                    ].
                 ].
                 image mask:maskImage.
             ].
@@ -6653,7 +6657,7 @@
         ]
     ]
 
-    "Modified: / 06-04-2017 / 13:23:26 / cg"
+    "Modified: / 11-04-2017 / 01:45:55 / cg"
 !
 
 colorize