*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Mon, 25 Oct 2004 11:42:45 +0200
changeset 2765 5bc0bfbeac33
parent 2764 3302aab746d2
child 2766 04990ee7e604
*** empty log message ***
ImageEditView.st
--- a/ImageEditView.st	Tue Oct 19 19:09:17 2004 +0200
+++ b/ImageEditView.st	Mon Oct 25 11:42:45 2004 +0200
@@ -1246,7 +1246,7 @@
 !
 
 performSpecialOperationOn:imageBox withColor:clr
-    |operation x0 y0 x1 y1 pixelAction requiredColors missingColors answer|
+    |operation x0 y0 x1 y1 pixelAction requiredColors missingColors answer hue|
 
     operation := Dialog 
            choose:(resources string:'Which Operation:')
@@ -1256,12 +1256,19 @@
                        'brightened'
                        'darkened'
                        '-'
+                       'make grey'
                        'greyed'
                        'grey pattern'
+                       'grey pattern (unmasked)'
                        '-'
                        'reversed'
+                       '-'
+                       'change hue'
+                       'colorize'
                      )) 
-           values:#(slightlyBrightened slightlyDarkened brightened darkened nil greyed greyPattern nil reversed) 
+           values:#(slightlyBrightened slightlyDarkened brightened darkened 
+                    nil makeGrey greyed greyPattern unmaskedGreyPattern
+                    nil reversed nil changeHue colorize) 
            lines:6
            cancel:nil.
 
@@ -1290,12 +1297,36 @@
     operation == #reversed ifTrue:[
         pixelAction := [:x :y :clr | Color red:(100-clr red) green:(100-clr green) blue:(100-clr blue) ].
     ].
+    operation == #makeGrey ifTrue:[
+        pixelAction := [:x :y :clr | Color grey:(clr greyIntensity)].
+    ].
     operation == #greyed ifTrue:[
         pixelAction := [:x :y :clr | clr blendWith:Color grey].
     ].
     operation == #greyPattern ifTrue:[
-        pixelAction := [:x :y :clr | Color grey].
+        pixelAction := [:x :y :clr | x odd == y even 
+                                        ifTrue:[Color grey] 
+                                        ifFalse:[clr]].
+    ].
+    operation == #unmaskedGreyPattern ifTrue:[
+        pixelAction := [:x :y :clr | x odd == y even 
+                                        ifTrue:[self image maskAtX:x y:y put:1. Color grey] 
+                                        ifFalse:[clr]].
     ].
+
+    operation == #changeHue ifTrue:[
+        hue := Dialog request:'Hue (0..360)'.
+        hue := Number readFrom:hue onError:nil.
+        hue isNil ifTrue:[^ false].
+        pixelAction := [:x :y :clr | Color hue:(hue+(clr hue?0)) light:clr light saturation:clr saturation].
+    ].
+    operation == #colorize ifTrue:[
+        hue := Dialog request:'Hue (0..360)'.
+        hue := Number readFrom:hue onError:nil.
+        hue isNil ifTrue:[^ false].
+        pixelAction := [:x :y :clr | Color hue:hue light:clr light saturation:100]
+    ].
+
     pixelAction isNil ifTrue:[self halt. ^ false].
 
     "/ compute required colors ...
@@ -2261,7 +2292,7 @@
 !ImageEditView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.198 2004-10-19 17:09:17 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.199 2004-10-25 09:42:45 cg Exp $'
 ! !
 
 ImageEditView initialize!