ImageEditor.st
changeset 3200 eae3e88c5cb1
parent 3196 830d70ff1d54
child 3224 98a659b6bd10
equal deleted inserted replaced
3199:ebfabb8002d1 3200:eae3e88c5cb1
   470 #fileLoadFromURL
   470 #fileLoadFromURL
   471 'Load an image from the net, given its URL'
   471 'Load an image from the net, given its URL'
   472 
   472 
   473 #fileNewImage
   473 #fileNewImage
   474 'Create a new image'
   474 'Create a new image'
       
   475 
       
   476 #fileNewImageFromClipboard
       
   477 'Create a new image and initialize it from the clipboard'
       
   478 
       
   479 #fileNewMaskFromClipboard
       
   480 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
   475 
   481 
   476 #filePrint
   482 #filePrint
   477 'Print the image on a postscript printer'
   483 'Print the image on a postscript printer'
   478 
   484 
   479 #fileSave
   485 #fileSave
  2809             activeHelpKey: fileNewImage
  2815             activeHelpKey: fileNewImage
  2810             label: 'New...'
  2816             label: 'New...'
  2811             itemValue: doNewImage
  2817             itemValue: doNewImage
  2812           )
  2818           )
  2813          (MenuItem
  2819          (MenuItem
  2814             activeHelpKey: fileNewImage
  2820             activeHelpKey: fileNewImageFromClipboard
  2815             label: 'New from ClipBoard'
  2821             label: 'New from ClipBoard'
  2816             itemValue: doNewImageFromClipboard
  2822             itemValue: doNewImageFromClipboard
       
  2823           )
       
  2824          (MenuItem
       
  2825             activeHelpKey: fileNewMaskFromClipboard
       
  2826             label: 'Mask from ClipBoard'
       
  2827             itemValue: doNewMaskFromClipboard
  2817           )
  2828           )
  2818          (MenuItem
  2829          (MenuItem
  2819             label: '-'
  2830             label: '-'
  2820           )
  2831           )
  2821          (MenuItem
  2832          (MenuItem
  7001         self findColorMapMode.
  7012         self findColorMapMode.
  7002         self updateLabelsAndHistory.
  7013         self updateLabelsAndHistory.
  7003     ]
  7014     ]
  7004 !
  7015 !
  7005 
  7016 
       
  7017 doNewMaskFromClipboard
       
  7018     |mask image newImage|
       
  7019 
       
  7020     self checkModified ifFalse:[ ^ self ].
       
  7021 
       
  7022     mask := imageEditView clipBoard.
       
  7023     mask isImageOrForm ifFalse:[
       
  7024         mask := Image readFrom:(mask asString) onError:nil.
       
  7025         mask isNil ifTrue:[
       
  7026             Dialog warn:'Clipboard does not contain an image I can use/understand'.
       
  7027             ^ self.
       
  7028         ].
       
  7029     ].
       
  7030     (image:= imageEditView image) isNil ifTrue:[
       
  7031         image := mask.
       
  7032     ].
       
  7033     mask extent ~= image extent ifTrue:[
       
  7034         mask := imageEditView resizedImage:mask to:image extent.
       
  7035     ].
       
  7036     newImage := image copy.
       
  7037     newImage mask:mask.
       
  7038     imageEditView newImageWithUndo:newImage.
       
  7039     self updateAfterImageChange.
       
  7040 "/    self updateColorsFromImage:image.
       
  7041 "/    self findColorMapMode.
       
  7042 "/    self updateLabelsAndHistory.
       
  7043 !
       
  7044 
  7006 grabScreenImage
  7045 grabScreenImage
  7007     "let user choose an area and grab that are for editing"
  7046     "let user choose an area and grab that are for editing"
  7008 
  7047 
  7009     self grabScreenImageUsing:[ 
  7048     self grabScreenImageUsing:[ 
  7010         |r|
  7049         |r|