ImageEditor.st
changeset 1460 89549732a2c8
parent 1459 1edc1052fa77
child 1471 aa01951b16cf
equal deleted inserted replaced
1459:1edc1052fa77 1460:89549732a2c8
  2169 !
  2169 !
  2170 
  2170 
  2171 clearMaskedPixels
  2171 clearMaskedPixels
  2172     "clear all masked pixels (to pixelValue 0)"
  2172     "clear all masked pixels (to pixelValue 0)"
  2173 
  2173 
  2174     |depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| 
  2174     |newImage oldImage| 
  2175 
  2175 
  2176     oldImage := self image.
  2176     oldImage := self image.
  2177 
  2177 
  2178     imageEditView makeUndo.
  2178     imageEditView makeUndo.
  2179 
  2179 
  2180     self withExecuteCursorDo:[
  2180     self withExecuteCursorDo:[
  2181         newImage := oldImage clearMaskedPixels.
  2181         newImage := oldImage clearMaskedPixels.
       
  2182         0 to:newImage height - 1 do:[:y |
       
  2183             0 to:newImage width - 1 do:[:x |
       
  2184                 (newImage maskAtX:x y:y) == 0 ifTrue:[
       
  2185                     newImage pixelAtX:x y:y put:0
       
  2186                 ]
       
  2187             ]
       
  2188         ].
       
  2189 
  2182         (imageEditView image:newImage) notNil ifTrue:[
  2190         (imageEditView image:newImage) notNil ifTrue:[
  2183             self fetchImageData.
  2191             self fetchImageData.
  2184 "/            self listOfColors contents: newImage colorMap.
       
  2185 "/            self findColorMapMode.
       
  2186 "/            self updateLabelsAndHistory.
       
  2187         ]
  2192         ]
  2188     ]
  2193     ]
  2189 !
  2194 !
  2190 
  2195 
  2191 colorMapChanged
  2196 colorMapChanged
  2498     "Created: / 28.7.1998 / 20:03:11 / cg"
  2503     "Created: / 28.7.1998 / 20:03:11 / cg"
  2499     "Modified: / 15.9.1998 / 17:53:32 / cg"
  2504     "Modified: / 15.9.1998 / 17:53:32 / cg"
  2500 !
  2505 !
  2501 
  2506 
  2502 fetchImageData
  2507 fetchImageData
  2503         |image|
  2508     |image|
  2504 
  2509 
  2505         (image := imageEditView image) notNil ifTrue:[
  2510     (image := imageEditView image) notNil ifTrue:[
  2506             self listOfColors contents:(image colorMap).
  2511         self listOfColors contents:(image colorMap).
  2507             self findColorMapMode.
  2512         self findColorMapMode.
  2508             self updateLabelsAndHistory.
  2513         self updateLabelsAndHistory.
  2509         ]
  2514     ]
  2510 !
  2515 !
  2511 
  2516 
  2512 makeGrayScale
  2517 makeGrayScale
  2513     |anyChange img|
  2518     |anyChange img|
  2514 
  2519