ImageEditView.st
changeset 5654 587fc5c36cc9
parent 5653 0cc4e96d490b
child 5655 2254c5d79e3b
equal deleted inserted replaced
5653:0cc4e96d490b 5654:587fc5c36cc9
  1981 
  1981 
  1982             copiedImage := image class fromImage: copiedImage.
  1982             copiedImage := image class fromImage: copiedImage.
  1983             (newColorMap isNil 
  1983             (newColorMap isNil 
  1984             and:[modeSymbol isNil
  1984             and:[modeSymbol isNil
  1985             and:[copiedImage mask isNil] ]) ifTrue:[
  1985             and:[copiedImage mask isNil] ]) ifTrue:[
  1986                 "/ use images copy functionality
  1986                 "/ use image's copy functionality
  1987                 "/ however, this copies the mask as well,
  1987                 "/ however, this copies the mask as well,
  1988                 "/ which is not useful here
  1988                 "/ which is not useful here
  1989                 image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
  1989                 image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height.
  1990             ] ifFalse:[
  1990             ] ifFalse:[
  1991                 imgX := imagePoint x.
  1991                 imgX := imagePoint x.
  1999                         dstY := imgY + y.
  1999                         dstY := imgY + y.
  2000                         wasMasked := (image maskAtX:dstX y:dstY) == 0.
  2000                         wasMasked := (image maskAtX:dstX y:dstY) == 0.
  2001                         newMasked := (copiedImage maskAtX:x y:y) == 0.
  2001                         newMasked := (copiedImage maskAtX:x y:y) == 0.
  2002 
  2002 
  2003                         "/ with modeUnder, 
  2003                         "/ with modeUnder, 
  2004                         "/ only replace, if its either unmasked,
  2004                         "/ only replace, if its masked,
  2005                         "/ or the current drawing color.
  2005                         ((modeSymbol isNil or:[modeSymbol == #withMask])
  2006                         (modeSymbol isNil
  2006                             or:[wasMasked]
  2007                         or:[wasMasked
  2007                         ) ifTrue:[
  2008                         or:[modeSymbol == #withMask]])
       
  2009                         ifTrue:[
       
  2010                             newMasked ifFalse:[
  2008                             newMasked ifFalse:[
  2011                                 image colorAtX:dstX y:dstY put:(copiedImage colorAtX:x y:y).
  2009                                 image colorAtX:dstX y:dstY put:(copiedImage colorAtX:x y:y).
  2012                                 wasMasked ifTrue:[
  2010                                 wasMasked ifTrue:[
  2013                                     image maskAtX:dstX y:dstY put:1
  2011                                     "/ wasMasked before; no longer masked now
       
  2012                                     (modeSymbol == #withMask or:[modeSymbol == #under]) ifTrue:[
       
  2013                                         image maskAtX:dstX y:dstY put:1
       
  2014                                     ].
  2014                                 ].
  2015                                 ].
  2015                             ] ifTrue:[
  2016                             ] ifTrue:[
  2016                                 wasMasked ifFalse:[
  2017                                 wasMasked ifFalse:[
       
  2018                                     "/ masked now; was not masked before
  2017                                     modeSymbol == #withMask ifTrue:[
  2019                                     modeSymbol == #withMask ifTrue:[
  2018                                         image maskAtX:dstX y:dstY put:0
  2020                                         image maskAtX:dstX y:dstY put:0
  2019                                     ]
  2021                                     ]
  2020                                 ]
  2022                                 ]
  2021                             ].
  2023                             ].
  2029 "/            masterApplication imagePreView redraw: (imageBox expandedBy: 1).
  2031 "/            masterApplication imagePreView redraw: (imageBox expandedBy: 1).
  2030             self setModified.
  2032             self setModified.
  2031         ]
  2033         ]
  2032    ]
  2034    ]
  2033 
  2035 
  2034     "Modified: / 08-10-2017 / 08:53:48 / cg"
  2036     "Modified: / 07-12-2017 / 15:56:42 / cg"
  2035 !
  2037 !
  2036 
  2038 
  2037 shiftImageHorizontal:shiftH vertical:shiftV
  2039 shiftImageHorizontal:shiftH vertical:shiftV
  2038     self shiftImageHorizontal:shiftH vertical:shiftV wrap:false
  2040     self shiftImageHorizontal:shiftH vertical:shiftV wrap:false
  2039 !
  2041 !