ImageEditor.st
changeset 1951 9ad40a628278
parent 1949 00defdb89630
child 1952 73a141744891
equal deleted inserted replaced
1950:aaf6499564ba 1951:9ad40a628278
  3173     self findColorMapMode.
  3173     self findColorMapMode.
  3174 ! !
  3174 ! !
  3175 
  3175 
  3176 !ImageEditor methodsFor:'data access'!
  3176 !ImageEditor methodsFor:'data access'!
  3177 
  3177 
  3178 atColor:aOldColor put:newColor
  3178 atColor:anOldColor put:newColor
  3179     "a color changed to a new color
  3179     "a color changed to a new color
  3180     "
  3180     "
  3181     |index list oldColor image newImage oldSel|
  3181     |index list oldColor image newImage oldSel|
  3182 
  3182 
  3183     list  := self listOfColors.
  3183     list  := self listOfColors.
  3184     index := list identityIndexOf:aOldColor.
  3184     index := list identityIndexOf:anOldColor.
  3185 
  3185 
  3186     oldSel := self selectionOfColor value.
  3186     oldSel := self selectionOfColor value.
  3187     index ~~ 0 ifTrue:[
  3187     index ~~ 0 ifTrue:[
  3188         oldColor := list at:index.
  3188         oldColor := list at:index.
  3189         list at:index put:newColor
  3189         list at:index put:newColor
  3201             newImage
  3201             newImage
  3202                 colorsFromX:0 y:0 toX:(image width-1) y:(image height-1) 
  3202                 colorsFromX:0 y:0 toX:(image width-1) y:(image height-1) 
  3203                 do:[:x :y :clr |
  3203                 do:[:x :y :clr |
  3204                     |newClr|
  3204                     |newClr|
  3205 
  3205 
  3206                     newClr := (clr = oldColor) ifTrue:newColor ifFalse:clr.
  3206                     newClr := (clr = oldColor) ifTrue:[newColor] ifFalse:[clr].
  3207                     newImage colorAtX:x y:y put:newClr
  3207                     newImage colorAtX:x y:y put:newClr
  3208                 ].
  3208                 ].
  3209             imageEditView image:newImage.
  3209             imageEditView image:newImage.
  3210             imageEditView setModified.
  3210             imageEditView setModified.
  3211             self updateImage.
  3211             self updateImage.