#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Wed, 13 Sep 2017 18:13:12 +0200
changeset 5604 0cfb9a0ea4eb
parent 5603 974a4c6a7656
child 5605 8718eba88418
#REFACTORING by cg class: ImageEditView changed: #pointAt:width: category of: #pointAt:width:
ImageEditView.st
--- a/ImageEditView.st	Wed Sep 13 16:17:37 2017 +0200
+++ b/ImageEditView.st	Wed Sep 13 18:13:12 2017 +0200
@@ -2013,60 +2013,6 @@
     "Modified (comment): / 16-02-2017 / 11:13:59 / cg"
 !
 
-pointAt:aPoint width:pw
-    "called from button-press/button motion while in point-drawing mode:
-     draw a single pixel (or dot of width pw) with the currently selected color"
-
-    |draw imagePoint clr pix oldColor newColor|
-
-    imagePoint := aPoint // magnification.
-    (imagePoint x between:0 and:image width-1) ifFalse:[^ self].
-    (imagePoint y between:0 and:image height-1) ifFalse:[^ self].
-
-    draw := 
-        [:point |
-            (clr := self drawingColorOrNil) notNil ifTrue:[
-                clr isPseudoColor ifTrue:[
-                    "/ only set the alpha value
-                    newColor := (image colorAt:point) alpha:clr alpha.
-                    image atImageAndMask:point put:newColor
-                ] ifFalse:[    
-                    clr alpha == 1 ifTrue:[
-                        image atImageAndMask:point put:clr.
-                    ] ifFalse:[
-                        oldColor := image colorAt:point.
-                        newColor := clr alphaMixed:clr alpha with:oldColor.
-                        image atImageAndMask:point put:newColor
-                    ].
-                ].
-            ] ifFalse:[
-                (pix := self drawingPixelOrNil) notNil ifTrue:[
-                    image atImageAndMask:point putValue:pix.
-                ].             
-            ].             
-            self invalidate:((point * magnification extent: magnification) expandedBy:1).
-        ].
-
-    draw value:imagePoint.
-
-    pw > 1 ifTrue:[
-        "/ draw with a wide pen
-        (pw//2) negated to:(pw-(pw//2)-1) do:[:xOffs |
-            (pw//2) negated to:(pw-(pw//2)-1) do:[:yOffs |
-                imagePoint x + xOffs >= 0 ifTrue:[
-                    imagePoint y + yOffs >= 0 ifTrue:[
-                        draw value:(imagePoint + (xOffs@yOffs)).
-                    ].
-                ].
-            ].
-        ].
-    ].
-    self setModified.
-
-    "Created: / 15-02-2012 / 22:47:08 / cg"
-    "Modified: / 05-09-2017 / 14:43:04 / cg"
-!
-
 shiftImageHorizontal:shiftH vertical:shiftV
     self shiftImageHorizontal:shiftH vertical:shiftV wrap:false
 !
@@ -2518,6 +2464,64 @@
     "Modified (comment): / 16-02-2017 / 11:13:06 / cg"
 !
 
+pointAt:aPoint width:pw
+    "called from button-press/button motion while in point-drawing mode:
+     draw a single pixel (or dot of width pw) with the currently selected color"
+
+    |draw imagePoint clr pix oldColor newColor|
+
+    imagePoint := aPoint // magnification.
+    (imagePoint x between:0 and:image width-1) ifFalse:[^ self].
+    (imagePoint y between:0 and:image height-1) ifFalse:[^ self].
+
+    draw := 
+        [:point |
+            (clr := self drawingColorOrNil) notNil ifTrue:[
+                clr isPseudoColor ifTrue:[
+                    "/ only set the alpha value
+                    newColor := (image colorAt:point) alpha:clr alpha.
+                ] ifFalse:[    
+                    newColor := clr.
+"/                    clr alpha = 1 ifTrue:[
+"/                        newColor := clr.
+"/                    ] ifFalse:[
+"/                        clr alpha = 0 ifTrue:[
+"/                            newColor := clr.
+"/                        ] ifFalse:[    
+"/                            oldColor := image colorAt:point.
+"/                            newColor := clr alphaMixed:clr alpha with:oldColor.
+"/                        ].
+"/                    ].
+                ].
+                image atImageAndMask:point put:newColor
+            ] ifFalse:[
+                (pix := self drawingPixelOrNil) notNil ifTrue:[
+                    image atImageAndMask:point putValue:pix.
+                ].             
+            ].             
+            self invalidate:((point * magnification extent: magnification) expandedBy:1).
+        ].
+
+    draw value:imagePoint.
+
+    pw > 1 ifTrue:[
+        "/ draw with a wide pen
+        (pw//2) negated to:(pw-(pw//2)-1) do:[:xOffs |
+            (pw//2) negated to:(pw-(pw//2)-1) do:[:yOffs |
+                imagePoint x + xOffs >= 0 ifTrue:[
+                    imagePoint y + yOffs >= 0 ifTrue:[
+                        draw value:(imagePoint + (xOffs@yOffs)).
+                    ].
+                ].
+            ].
+        ].
+    ].
+    self setModified.
+
+    "Created: / 15-02-2012 / 22:47:08 / cg"
+    "Modified: / 13-09-2017 / 17:55:02 / cg"
+!
+
 smoothAt:aPoint
     "called from button-press/button motion while in smoothing mode:
      smoth (average) a single pixel with pixels around"