6486 ! |
6488 ! |
6487 |
6489 |
6488 doMagnifyImage |
6490 doMagnifyImage |
6489 "magnifies the current image to a new size" |
6491 "magnifies the current image to a new size" |
6490 |
6492 |
6491 |box newSize image| |
6493 |box newSize image antiAliased| |
6492 |
6494 |
|
6495 antiAliased := false asValue. |
6493 image := imageEditView image. |
6496 image := imageEditView image. |
6494 |
6497 |
6495 box := EnterBox new. |
6498 box := EnterBox new. |
6496 box title:(resources string:'Images new size:'). |
6499 box title:(resources string:'Images new size:'). |
6497 box okText:(resources string:'OK'). |
6500 box okText:(resources string:'OK'). |
6498 box abortText:(resources string:'Cancel'). |
6501 box abortText:(resources string:'Cancel'). |
6499 box initialText:image extent printString. |
6502 box initialText:image extent printString. |
|
6503 box addCheckBox:(resources string:'Antialiased') on:antiAliased. |
6500 box showAtPointer. |
6504 box showAtPointer. |
|
6505 |
6501 (box accepted |
6506 (box accepted |
6502 and: [(newSize := self pointFromString:(box contents)) notNil]) |
6507 and: [(newSize := self pointFromString:(box contents)) notNil]) |
6503 ifTrue:[ |
6508 ifTrue:[ |
6504 newSize isPoint ifFalse:[ |
6509 newSize isPoint ifFalse:[ |
6505 self warn:'please enter the new size as ''x @ y''.'. |
6510 self warn:'Please enter the new size as ''x @ y''.'. |
6506 ^ self. |
6511 ^ self. |
6507 ]. |
6512 ]. |
6508 imageEditView magnifyImageTo:newSize. |
6513 antiAliased value ifTrue:[ |
|
6514 imageEditView magnifyAntiAliasedImageTo:newSize. |
|
6515 ] ifFalse:[ |
|
6516 imageEditView magnifyImageTo:newSize. |
|
6517 ]. |
6509 ]. |
6518 ]. |
6510 |
6519 |
6511 self updateInfoLabel |
6520 self updateInfoLabel |
6512 ! |
6521 ! |
6513 |
6522 |
6514 doMagnifyImageBy |
6523 doMagnifyImageBy |
6515 "magnifies the current image (by a scale)" |
6524 "magnifies the current image (by a scale)" |
6516 |
6525 |
6517 |box oldSize newSize scaleString scale image| |
6526 |oldSize newSize scaleString scale image antiAliased| |
6518 |
6527 |
6519 image := imageEditView image. |
6528 image := imageEditView image. |
6520 oldSize := image extent. |
6529 oldSize := image extent. |
6521 |
6530 |
6522 scaleString := Dialog |
6531 antiAliased := false asValue. |
|
6532 |
|
6533 Dialog modifyingBoxWith:[:box | |
|
6534 box addCheckBox:(resources string:'Antialiased') on:antiAliased. |
|
6535 ] do:[ |
|
6536 scaleString := Dialog |
6523 request:(resources string:'Scale factor (<1 to shrink; >1 to magnify):') |
6537 request:(resources string:'Scale factor (<1 to shrink; >1 to magnify):') |
6524 initialAnswer:'1' |
6538 initialAnswer:'1' |
6525 list:#('0.25' '0.5' '2' '4'). |
6539 list:#('0.25' '0.5' '2' '4'). |
|
6540 ]. |
|
6541 scaleString isNil ifTrue:[^ self]. |
6526 |
6542 |
6527 "/ box := EnterBox new. |
6543 "/ box := EnterBox new. |
6528 "/ box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):'). |
6544 "/ box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):'). |
6529 "/ box okText:(resources string:'OK'). |
6545 "/ box okText:(resources string:'OK'). |
6530 "/ box abortText:(resources string:'Cancel'). |
6546 "/ box abortText:(resources string:'Cancel'). |
6540 scale isNumber ifFalse:[ |
6556 scale isNumber ifFalse:[ |
6541 self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'. |
6557 self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'. |
6542 ^ self. |
6558 ^ self. |
6543 ]. |
6559 ]. |
6544 newSize := oldSize * scale. |
6560 newSize := oldSize * scale. |
6545 imageEditView magnifyImageTo:newSize. |
6561 antiAliased value ifTrue:[ |
|
6562 imageEditView magnifyAntiAliasedImageTo:newSize. |
|
6563 ] ifFalse:[ |
|
6564 imageEditView magnifyImageTo:newSize. |
|
6565 ]. |
6546 ]. |
6566 ]. |
6547 |
6567 |
6548 self updateInfoLabel |
6568 self updateInfoLabel |
6549 ! |
6569 ! |
6550 |
6570 |