ImageEditView.st
changeset 5582 d88b01c6608b
parent 5581 63e21f277747
child 5583 8bc04664882c
--- a/ImageEditView.st	Sat Aug 26 13:46:14 2017 +0200
+++ b/ImageEditView.st	Sun Aug 27 19:13:12 2017 +0200
@@ -3099,12 +3099,26 @@
     
     self updateImageInfo:
         (String streamContents:[:s |
-            |redString greenString blueString|
+            |redString greenString blueString greyString
+             photometric bitsPerSample|
             
+            photometric := image photometric.
+            bitsPerSample := image bitsPerSample.
+
             s print:aPoint.
-            s print:' (r:'; print:r.
-            s print:' g:'; print:g.
-            s print:' b:'; print:b.
+
+            ((photometric == #blackIs0) or:[(photometric == #whiteIs0)]) ifTrue:[
+                s print:' (g:'; print:pixel.
+                greyString := (pixel hexPrintString:2).
+            ] ifFalse:[
+                s print:' (r:'; print:r.
+                s print:' g:'; print:g.
+                s print:' b:'; print:b.
+
+                redString := (r hexPrintString:2).
+                greenString := (g hexPrintString:2).
+                blueString := (b hexPrintString:2).
+           ].
             a notNil ifTrue:[
                 s print:' a:'; print:a.
             ] ifFalse:[
@@ -3113,31 +3127,36 @@
                 ].    
             ].
             
-            redString := (r hexPrintString:2).
-            greenString := (g hexPrintString:2).
-            blueString := (b hexPrintString:2).
-            ((image photometric == #rgb) or:[(image photometric == #rgba)]) ifTrue:[
-                (image bitsPerSample at:1) == 16 ifTrue:[
-                    redString := (r hexPrintString:4)
+            ((photometric == #blackIs0) or:[(photometric == #whiteIs0)]) ifTrue:[
+                (bitsPerSample at:1) == 16 ifTrue:[
+                    greyString := (pixel hexPrintString:4)
                 ].
-                (image bitsPerSample at:2) == 16 ifTrue:[
-                    greenString := (g hexPrintString:4)
-                ].
-                (image bitsPerSample at:2) == 16 ifTrue:[
-                    blueString := (b hexPrintString:4)
-                ].
-            ].    
-            s print:(' #%1.%2.%3' bindWith:redString with:greenString with:blueString).
+                s print:(' #%1' bindWith:greyString).
+            ] ifFalse:[
+                ((photometric == #rgb) or:[(photometric == #rgba)]) ifTrue:[
+                    (bitsPerSample at:1) == 16 ifTrue:[
+                        redString := (r hexPrintString:4)
+                    ].
+                    (bitsPerSample at:2) == 16 ifTrue:[
+                        greenString := (g hexPrintString:4)
+                    ].
+                    (bitsPerSample at:2) == 16 ifTrue:[
+                        blueString := (b hexPrintString:4)
+                    ].
+                ]. 
+                s print:(' #%1.%2.%3' bindWith:redString with:greenString with:blueString).
+            ].            
             a notNil ifTrue:[
                 s print:'.'; print:(a hexPrintString:2)
             ].    
-            image photometric == #palette ifTrue:[
+
+            photometric == #palette ifTrue:[
                 s print:' pixel index:'; print:pixel.
             ].
             s print:')'.
         ])
 
-    "Modified: / 26-08-2017 / 13:20:51 / cg"
+    "Modified: / 27-08-2017 / 19:11:48 / cg"
 ! !
 
 !ImageEditView methodsFor:'initialization & release'!