ImageEditor.st
changeset 2708 c180af16b1b3
parent 2707 6610854318eb
child 2711 4700f54d0040
equal deleted inserted replaced
2707:6610854318eb 2708:c180af16b1b3
  5950     self grabScreenImageUsing:[ 
  5950     self grabScreenImageUsing:[ 
  5951         |r|
  5951         |r|
  5952 
  5952 
  5953         [Screen current leftButtonPressed] whileTrue:[Delay waitForSeconds:0.05].
  5953         [Screen current leftButtonPressed] whileTrue:[Delay waitForSeconds:0.05].
  5954         r := Rectangle fromUser.
  5954         r := Rectangle fromUser.
  5955         r width == 0 ifTrue:[^ nil].
  5955         (r width == 0 or:[r height == 0]) ifTrue:[
  5956         r height == 0 ifTrue:[^ nil].
  5956             nil
  5957         lastGrabbedScreenArea := r.
  5957         ] ifFalse:[
  5958         ^ Image fromScreen:r
  5958             lastGrabbedScreenArea := r.
       
  5959             Image fromScreen:r
       
  5960         ]
  5959     ].
  5961     ].
  5960 !
  5962 !
  5961 
  5963 
  5962 grabScreenImageFromLastArea
  5964 grabScreenImageFromLastArea
  5963     "grab again from the previous area for editing"
  5965     "grab again from the previous area for editing"
  5964 
  5966 
  5965     self grabScreenImageUsing:[ 
  5967     self grabScreenImageUsing:[ 
  5966         ^ Image fromScreen:lastGrabbedScreenArea
  5968         Image fromScreen:lastGrabbedScreenArea
  5967     ].
  5969     ].
  5968 !
  5970 !
  5969 
  5971 
  5970 grabScreenImageUsing:aBlock
  5972 grabScreenImageUsing:aBlock
  5971     "let user choose an area and grab that are for editing"
  5973     "let user choose an area and grab that are for editing"
  5976         addTimedBlock:[
  5978         addTimedBlock:[
  5977             |image d8image img|
  5979             |image d8image img|
  5978 
  5980 
  5979             imageSeqNr := nil.
  5981             imageSeqNr := nil.
  5980             image := aBlock value.
  5982             image := aBlock value.
  5981             image isNil ifFalse:[
  5983             image notNil ifTrue:[
  5982                 image depth > 8 ifTrue:[
  5984                 image depth > 8 ifTrue:[
  5983 false ifTrue:[
  5985 false ifTrue:[
  5984                     Error handle:[:ex | |sig|
  5986                     Error handle:[:ex | |sig|
  5985                         (sig := ex signal) == HaltInterrupt ifTrue:[ex reject].
  5987                         (sig := ex signal) == HaltInterrupt ifTrue:[ex reject].
  5986                         sig == Signal noHandlerSignal ifTrue:[ex reject].
  5988                         sig == Signal noHandlerSignal ifTrue:[ex reject].