--- a/ImageEditView.st Fri May 25 13:12:56 2018 +0200
+++ b/ImageEditView.st Sun May 27 11:38:53 2018 +0200
@@ -32,7 +32,7 @@
EditModeSpecialOperation EditModeSpray EditModeCircle
EditModeSmooth EditModeFilledCircle
EditModeSpecialOperationCropSubImage EditModeMaskOutsideRect
- EditModeMaskOutsideCircle'
+ EditModeMaskOutsideCircle EditModePasteMasked'
poolDictionaries:''
category:'Views-Misc'
!
@@ -78,6 +78,7 @@
EditModePaste := #paste.
EditModePasteUnder := #pasteUnder.
EditModePasteWithMask := #pasteWithMask.
+ EditModePasteMasked := #pasteMasked.
EditModeFilledBox := #filledBox.
EditModeFilledCircle := #filledCircle.
EditModeFill := #fill.
@@ -94,6 +95,7 @@
"
"Modified: / 20-02-2017 / 16:54:11 / cg"
+ "Modified: / 27-05-2018 / 10:42:00 / Claus Gittinger"
! !
!ImageEditView class methodsFor:'accessing'!
@@ -118,6 +120,12 @@
^ EditModePaste
!
+editModePasteMasked
+ ^ EditModePasteMasked
+
+ "Created: / 27-05-2018 / 10:43:22 / Claus Gittinger"
+!
+
editModePasteUnder
^ EditModePasteUnder
!
@@ -214,8 +222,8 @@
!
clipBoardImage
- "if there is one in the clobal clipboard,
- return that (an thus support copy-paste from another smalltalk application).
+ "if there is an image in the clobal clipboard,
+ return that (and thus support copy-paste from another smalltalk application).
Otherwise return the local clipboardImage from a classVar to support copy-paste
within this smalltalk session."
@@ -228,6 +236,7 @@
^ ClipboardImage.
"Created: / 08-10-2017 / 08:55:59 / cg"
+ "Modified (comment): / 27-05-2018 / 11:12:58 / Claus Gittinger"
!
drawingAlpha
@@ -284,6 +293,7 @@
EditModeBox
EditModePaste
EditModePasteUnder
+ EditModePasteMasked
EditModePasteWithMask
EditModeFilledBox
EditModeFill
@@ -295,6 +305,8 @@
"
^editMode
+
+ "Modified (comment): / 27-05-2018 / 10:41:44 / Claus Gittinger"
!
editMode: anEditModeSymbol
@@ -305,6 +317,7 @@
EditModePaste
EditModePasteUnder
EditModePasteWithMask
+ EditModePasteMasked
EditModeFilledBox
EditModeFill
EditModeCopy
@@ -315,6 +328,8 @@
"
editMode := anEditModeSymbol
+
+ "Modified (comment): / 27-05-2018 / 10:42:21 / Claus Gittinger"
!
floodFillMaxHueError:aFraction
@@ -1988,7 +2003,7 @@
and:[copiedImage mask isNil] ]) ifTrue:[
"/ use image's copy functionality
"/ however, this copies the mask as well,
- "/ which is not useful here
+ "/ which is only useful for paste-mode nil (paste pixel+mask)
image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
] ifFalse:[
imgX := imagePoint x.
@@ -2005,14 +2020,18 @@
"/ with modeUnder,
"/ only replace, if its masked,
- ((modeSymbol isNil or:[modeSymbol == #withMask])
- or:[wasMasked]
+ (modeSymbol isNil
+ or:[modeSymbol == #withMask
+ or:[modeSymbol == #masked
+ or:[wasMasked]]]
) ifTrue:[
newMasked ifFalse:[
image colorAtX:dstX y:dstY put:(copiedImage colorAtX:x y:y).
wasMasked ifTrue:[
"/ wasMasked before; no longer masked now
- (modeSymbol == #withMask or:[modeSymbol == #under]) ifTrue:[
+ (modeSymbol == #withMask
+ or:[modeSymbol == #under
+ or:[modeSymbol == #masked]]) ifTrue:[
image maskAtX:dstX y:dstY put:1
].
].
@@ -2037,6 +2056,7 @@
]
"Modified: / 07-12-2017 / 15:56:42 / cg"
+ "Modified: / 27-05-2018 / 11:17:45 / Claus Gittinger"
!
shiftImageHorizontal:shiftH vertical:shiftV
@@ -2461,6 +2481,17 @@
"Modified (comment): / 16-02-2017 / 11:13:54 / cg"
!
+pasteMaskedAt: aPoint
+ "called from button-press/button motion while in paste mode:
+ paste the image in the clipboard at aPoint.
+ In this mode, only pixels which are not masked in the source image
+ are pasted."
+
+ self pasteAt:aPoint mode:#masked.
+
+ "Created: / 27-05-2018 / 10:43:11 / Claus Gittinger"
+!
+
pasteUnderAt: aPoint
"called from button-press/button motion while in paste mode:
pasteUnder the image in the clipboard at aPoint.