ImageEditor.st
changeset 3405 02c67d9a5e65
parent 3404 cd90f4aece50
child 3407 2e0024e012e9
equal deleted inserted replaced
3404:cd90f4aece50 3405:02c67d9a5e65
   263 ! !
   263 ! !
   264 
   264 
   265 !ImageEditor class methodsFor:'help specs'!
   265 !ImageEditor class methodsFor:'help specs'!
   266 
   266 
   267 flyByHelpSpec
   267 flyByHelpSpec
       
   268     <resource: #programHelp>
       
   269 
       
   270     ^super flyByHelpSpec addPairsFrom:(self helpPairs)
       
   271 
       
   272     "Modified: / 16-02-2017 / 12:30:55 / cg"
       
   273 !
       
   274 
       
   275 helpPairs
       
   276     "This resource specification was automatically generated
       
   277      by the UIHelpTool of ST/X."
       
   278 
       
   279     "Do not manually edit this!! If it is corrupted,
       
   280      the UIHelpTool may not be able to read the specification."
       
   281 
       
   282     "
       
   283      UIHelpTool openOnClass:ImageEditor    
       
   284     "
       
   285 
   268     <resource: #help>
   286     <resource: #help>
   269 
   287 
   270     ^super flyByHelpSpec addPairsFrom:(self localHelpTexts)
   288     ^ #(
   271 
   289 
   272     "Modified: / 19-01-2012 / 13:29:48 / cg"
   290 #xdrawModeBox
       
   291 'Rectangle'
       
   292 
       
   293 #xdrawModeCopy
       
   294 'Copy'
       
   295 
       
   296 #xdrawModeFill
       
   297 'Flood-fill'
       
   298 
       
   299 #xdrawModeFilledBox
       
   300 'Filled rectangle'
       
   301 
       
   302 #xdrawModePaste
       
   303 'Paste'
       
   304 
       
   305 #xdrawModePasteUnder
       
   306 'Paste under'
       
   307 
       
   308 #xdrawModePasteWithMask
       
   309 'Paste with Mask'
       
   310 
       
   311 #xdrawModePoint
       
   312 'Point'
       
   313 
       
   314 #xfileGrabImage
       
   315 'Pick from screen'
       
   316 
       
   317 #xfileLoadFromClass
       
   318 'Load from method...'
       
   319 
       
   320 #xfileLoadFromFile
       
   321 'Load from file...'
       
   322 
       
   323 #xfileNewImage
       
   324 'New image'
       
   325 
       
   326 #filePrint
       
   327 'Print'
       
   328 
       
   329 #xfileSaveAs
       
   330 'Save to file...'
       
   331 
       
   332 #xfileSaveMaskAs
       
   333 'Save mask to file...'
       
   334 
       
   335 #xfileSaveMethod
       
   336 'Save as method'
       
   337 
       
   338 #xfileSaveMethodAs
       
   339 'Save as Method...'
       
   340 
       
   341 #nextImageInSequence
       
   342 'Go to the next image in the animated gif image sequence.'
       
   343 
       
   344 #previousImageInSequence
       
   345 'Go to the previous image in the animated gif image sequence.'
       
   346 
       
   347 #colorMap
       
   348 'ColorMap functions'
       
   349 
       
   350 #colorMap1
       
   351 'Convert to depth-1 image'
       
   352 
       
   353 #colorMap1M
       
   354 'Convert to depth-1 image plus mask'
       
   355 
       
   356 #colorMap2
       
   357 'Convert to depth-2 image'
       
   358 
       
   359 #colorMap24
       
   360 'Convert to depth-24 image (rgb)'
       
   361 
       
   362 #colorMap2M
       
   363 'Convert to depth-2 image plus mask'
       
   364 
       
   365 #colorMap32
       
   366 'Convert to depth-32 image (rgba)'
       
   367 
       
   368 #colorMap4
       
   369 'Convert to depth-4 image'
       
   370 
       
   371 #colorMap4M
       
   372 'Convert to depth-4 image plus mask'
       
   373 
       
   374 #colorMap8
       
   375 'Convert to depth-8 image'
       
   376 
       
   377 #colorMap8M
       
   378 'Convert to depth-8 image plus mask'
       
   379 
       
   380 #colorMapTable
       
   381 'Shows a list of used colors of the image'
       
   382 
       
   383 #compressColormap
       
   384 'Remove unneeded entries from the colorMap'
       
   385 
       
   386 #cropAll
       
   387 'Find and remove all borders'
       
   388 
       
   389 #cropBottom
       
   390 'Find and remove bottom border'
       
   391 
       
   392 #cropLeft
       
   393 'Find and remove left border'
       
   394 
       
   395 #cropManual
       
   396 'Specify border(s) to remove.'
       
   397 
       
   398 #cropRight
       
   399 'Find and remove right border'
       
   400 
       
   401 #cropTop
       
   402 'Find and remove top border'
       
   403 
       
   404 #drawModeBox
       
   405 'Rectangle Drawing Mode'
       
   406 
       
   407 #drawModeCircle
       
   408 'Circle Drawing Mode'
       
   409 
       
   410 #drawModeCopy
       
   411 'Area Copy Mode'
       
   412 
       
   413 #drawModeFill
       
   414 'Flood Fill Mode'
       
   415 
       
   416 #drawModeFilledBox
       
   417 'Filled Rectangle Drawing Mode'
       
   418 
       
   419 #drawModePaste
       
   420 'Paste Mode'
       
   421 
       
   422 #drawModePasteUnder
       
   423 'Paste-Under Mode'
       
   424 
       
   425 #drawModePasteWithMask
       
   426 'Paste-with-Mask Mode'
       
   427 
       
   428 #drawModePoint
       
   429 'Point Drawing Mode'
       
   430 
       
   431 #drawModeSpecial
       
   432 'Special operations (select rectangle, then choose operation)'
       
   433 
       
   434 #drawModeSpray
       
   435 'Spray Drawing Mode'
       
   436 
       
   437 #editFlipHorizontal
       
   438 'Flip the image horizontally'
       
   439 
       
   440 #editFlipVertical
       
   441 'Flip the image vertically'
       
   442 
       
   443 #editMagnifyImage
       
   444 'Magnify the image'
       
   445 
       
   446 #editNegate
       
   447 'Invert the images colors'
       
   448 
       
   449 #editResize
       
   450 'Resize the image (preserving the old image)'
       
   451 
       
   452 #editRotate
       
   453 'Rotate the image'
       
   454 
       
   455 #fileGrabImageFromScreen
       
   456 'Pick an image from the screen (specify area)'
       
   457 
       
   458 #fileGrabImageFromWindow
       
   459 'Pick an image from a window on the screen (click on window)'
       
   460 
       
   461 #fileLoadFromClass
       
   462 'Select and load an image from a resource method'
       
   463 
       
   464 #fileLoadFromFile
       
   465 'Select and load an image from a file'
       
   466 
       
   467 #fileLoadFromURL
       
   468 'Load an image from the net, given its URL'
       
   469 
       
   470 #fileNewImage
       
   471 'Create a new image'
       
   472 
       
   473 #fileNewImageFromClipboard
       
   474 'Create a new image and initialize it from the clipboard'
       
   475 
       
   476 #fileNewMaskFromClipboard
       
   477 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
       
   478 
       
   479 #filePrint
       
   480 'Print the image on a postscript printer'
       
   481 
       
   482 #fileSave
       
   483 'Save the image'
       
   484 
       
   485 #fileSaveAs
       
   486 'Save the image to a file'
       
   487 
       
   488 #fileSaveButtonImageAs
       
   489 'Save an image of a button with the image to a file (for html use)'
       
   490 
       
   491 #fileSaveMaskAs
       
   492 'Save the mask of the image to a file'
       
   493 
       
   494 #fileSaveMethod
       
   495 'Save the image as resource method in the current class and selector'
       
   496 
       
   497 #fileSaveMethodAs
       
   498 'Save the image as resource method in a class'
       
   499 
       
   500 #magnificationNumber
       
   501 'Shows the current magnification'
       
   502 
       
   503 #magnifyImageDown
       
   504 'Decrease magnification'
       
   505 
       
   506 #magnifyImageUp
       
   507 'Increase magnification'
       
   508 
       
   509 #mouseKeyColorMode
       
   510 'Toggle between left and right mouse button color'
       
   511 
       
   512 #previewView
       
   513 'Shows a preview of the image'
       
   514 
       
   515 #settingsGridMagnification
       
   516 'Change the grid magnification of the edit view'
       
   517 
       
   518 
       
   519 
       
   520 
       
   521 #drawModeFilledCircle
       
   522 'Filled Circle Drawing Mode'
       
   523 
       
   524 #drawModeMaskOutsideCircle
       
   525 'Mask everything outside a Circle'
       
   526 
       
   527 #drawModeMaskOutsideRectangle
       
   528 'Mask everything outside a Rectangle'
       
   529 
       
   530 #edit3DProjection
       
   531 'Generate a 3D projection'
       
   532 
       
   533 #fileEditMask
       
   534 'Load Mask from a File'
       
   535 
       
   536 
       
   537 #gropBottom
       
   538 'Cut off the specified number of pixels at the bottom'
       
   539 
       
   540 #gropLeft
       
   541 'Cut off the specified number of pixels at the left'
       
   542 
       
   543 #gropRight
       
   544 'Cut off the specified number of pixels at the right'
       
   545 
       
   546 #gropTop
       
   547 'Cut off the specified number of pixels at the top'
       
   548 
       
   549 
       
   550 )
       
   551 
       
   552     "Created: / 16-02-2017 / 12:29:54 / cg"
   273 !
   553 !
   274 
   554 
   275 helpSpec
   555 helpSpec
   276     "This resource specification was automatically generated
   556     "This resource specification was automatically generated
   277      by the UIHelpTool of ST/X."
   557      by the UIHelpTool of ST/X."
   281 
   561 
   282     "
   562     "
   283      UIHelpTool openOnClass:ImageEditor
   563      UIHelpTool openOnClass:ImageEditor
   284     "
   564     "
   285 
   565 
   286     <resource: #help>
   566     <resource: #programHelp>
   287 
   567 
   288     ^ super helpSpec addPairsFrom:#(
   568     ^super helpSpec addPairsFrom:(self helpPairs)
   289 
   569 
   290 #colorMap
   570     "Modified: / 16-02-2017 / 12:30:50 / cg"
   291 'ColorMap functions'
       
   292 
       
   293 #colorMap1
       
   294 'Convert to depth-1 image'
       
   295 
       
   296 #colorMap1M
       
   297 'Convert to depth-1 image plus mask'
       
   298 
       
   299 #colorMap2
       
   300 'Convert to depth-2 image'
       
   301 
       
   302 #colorMap24
       
   303 'Convert to depth-24 image (rgb)'
       
   304 
       
   305 #colorMap2M
       
   306 'Convert to depth-2 image plus mask'
       
   307 
       
   308 #colorMap32
       
   309 'Convert to depth-32 image (rgba)'
       
   310 
       
   311 #colorMap4
       
   312 'Convert to depth-4 image'
       
   313 
       
   314 #colorMap4M
       
   315 'Convert to depth-4 image plus mask'
       
   316 
       
   317 #colorMap8
       
   318 'Convert to depth-8 image'
       
   319 
       
   320 #colorMap8M
       
   321 'Convert to depth-8 image plus mask'
       
   322 
       
   323 #colorMapTable
       
   324 'Shows a list of used colors of the image'
       
   325 
       
   326 #compressColormap
       
   327 'Remove unneeded entries from the colorMap'
       
   328 
       
   329 #cropAll
       
   330 'Find and remove all borders'
       
   331 
       
   332 #cropBottom
       
   333 'Find and remove bottom border'
       
   334 
       
   335 #cropLeft
       
   336 'Find and remove left border'
       
   337 
       
   338 #cropManual
       
   339 'Specify border(s) to remove.'
       
   340 
       
   341 #cropRight
       
   342 'Find and remove right border'
       
   343 
       
   344 #cropTop
       
   345 'Find and remove top border'
       
   346 
       
   347 #drawModeBox
       
   348 'Rectangle Drawing Mode'
       
   349 
       
   350 #drawModeCircle
       
   351 'Circle Drawing Mode'
       
   352 
       
   353 #drawModeCopy
       
   354 'Area Copy Mode'
       
   355 
       
   356 #drawModeFill
       
   357 'Flood Fill Mode'
       
   358 
       
   359 #drawModeFilledBox
       
   360 'Filled Rectangle Drawing Mode'
       
   361 
       
   362 #drawModePaste
       
   363 'Paste Mode'
       
   364 
       
   365 #drawModePasteUnder
       
   366 'Paste-Under Mode'
       
   367 
       
   368 #drawModePasteWithMask
       
   369 'Paste-with-Mask Mode'
       
   370 
       
   371 #drawModePoint
       
   372 'Point Drawing Mode'
       
   373 
       
   374 #drawModeSpecial
       
   375 'Special operations (select rectangle, then choose operation)'
       
   376 
       
   377 #drawModeSpray
       
   378 'Spray Drawing Mode'
       
   379 
       
   380 #edit3DProjection
       
   381 ''
       
   382 
       
   383 #editFlipHorizontal
       
   384 'Flip the image horizontally'
       
   385 
       
   386 #editFlipVertical
       
   387 'Flip the image vertically'
       
   388 
       
   389 #editMagnifyImage
       
   390 'Magnify the image'
       
   391 
       
   392 #editNegate
       
   393 'Invert the images colors'
       
   394 
       
   395 #editResize
       
   396 'Resize the image (preserving the old image)'
       
   397 
       
   398 #editRotate
       
   399 'Rotate the image'
       
   400 
       
   401 #fileEditMask
       
   402 ''
       
   403 
       
   404 #fileGrabImageFromScreen
       
   405 'Pick an image from the screen (specify area)'
       
   406 
       
   407 #fileGrabImageFromWindow
       
   408 'Pick an image from a window on the screen (click on window)'
       
   409 
       
   410 #fileLoadFromClass
       
   411 'Select and load an image from a resource method'
       
   412 
       
   413 #fileLoadFromFile
       
   414 'Select and load an image from a file'
       
   415 
       
   416 #fileLoadFromURL
       
   417 'Load an image from the net, given its URL'
       
   418 
       
   419 #fileNewImage
       
   420 'Create a new image'
       
   421 
       
   422 #fileNewImageFromClipboard
       
   423 'Create a new image and initialize it from the clipboard'
       
   424 
       
   425 #fileNewMaskFromClipboard
       
   426 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
       
   427 
       
   428 #filePrint
       
   429 'Print the image on a postscript printer'
       
   430 
       
   431 #fileSave
       
   432 'Save the image'
       
   433 
       
   434 #fileSaveAs
       
   435 'Save the image to a file'
       
   436 
       
   437 #fileSaveButtonImageAs
       
   438 'Save an image of a button with the image to a file (for html use)'
       
   439 
       
   440 #fileSaveMaskAs
       
   441 'Save the mask of the image to a file'
       
   442 
       
   443 #fileSaveMethod
       
   444 'Save the image as resource method in the current class and selector'
       
   445 
       
   446 #fileSaveMethodAs
       
   447 'Save the image as resource method in a class'
       
   448 
       
   449 #gropBottom
       
   450 'Cut off the specified number of pixels at the bottom'
       
   451 
       
   452 #gropLeft
       
   453 'Cut off the specified number of pixels at the left'
       
   454 
       
   455 #gropRight
       
   456 'Cut off the specified number of pixels at the right'
       
   457 
       
   458 #gropTop
       
   459 'Cut off the specified number of pixels at the top'
       
   460 
       
   461 #magnificationNumber
       
   462 'Shows the current magnification'
       
   463 
       
   464 #magnifyImageDown
       
   465 'Decrease magnification'
       
   466 
       
   467 #magnifyImageUp
       
   468 'Increase magnification'
       
   469 
       
   470 #mouseKeyColorMode
       
   471 'Toggle between left and right mouse button color'
       
   472 
       
   473 #nextImageInSequence
       
   474 'Go to the next image in the animated gif image sequence.'
       
   475 
       
   476 #previewView
       
   477 'Shows a preview of the image'
       
   478 
       
   479 #previousImageInSequence
       
   480 'Go to the previous image in the animated gif image sequence.'
       
   481 
       
   482 #settingsGridMagnification
       
   483 'Change the grid magnification of the edit view'
       
   484 
       
   485 #xdrawModeBox
       
   486 'Rectangle'
       
   487 
       
   488 #xdrawModeCopy
       
   489 'Copy'
       
   490 
       
   491 #xdrawModeFill
       
   492 'Flood-fill'
       
   493 
       
   494 #xdrawModeFilledBox
       
   495 'Filled rectangle'
       
   496 
       
   497 #xdrawModePaste
       
   498 'Paste'
       
   499 
       
   500 #xdrawModePasteUnder
       
   501 'Paste under'
       
   502 
       
   503 #xdrawModePasteWithMask
       
   504 'Paste with Mask'
       
   505 
       
   506 #xdrawModePoint
       
   507 'Point'
       
   508 
       
   509 #xfileGrabImage
       
   510 'Pick from screen'
       
   511 
       
   512 #xfileLoadFromClass
       
   513 'Load from method...'
       
   514 
       
   515 #xfileLoadFromFile
       
   516 'Load from file...'
       
   517 
       
   518 #xfileNewImage
       
   519 'New image'
       
   520 
       
   521 #xfileSaveAs
       
   522 'Save to file...'
       
   523 
       
   524 #xfileSaveMaskAs
       
   525 'Save mask to file...'
       
   526 
       
   527 #xfileSaveMethod
       
   528 'Save as method'
       
   529 
       
   530 #xfileSaveMethodAs
       
   531 'Save as Method...'
       
   532 
       
   533 )
       
   534 !
       
   535 
       
   536 localHelpTexts
       
   537     "This resource specification was automatically generated
       
   538      by the UIHelpTool of ST/X."
       
   539 
       
   540     "Do not manually edit this!! If it is corrupted,
       
   541      the UIHelpTool may not be able to read the specification."
       
   542 
       
   543     "
       
   544      UIHelpTool openOnClass:ImageEditor    
       
   545     "
       
   546 
       
   547     <resource: #help>
       
   548 
       
   549     ^ #(
       
   550 
       
   551 #xdrawModeBox
       
   552 'Rectangle'
       
   553 
       
   554 #xdrawModeCopy
       
   555 'Copy'
       
   556 
       
   557 #xdrawModeFill
       
   558 'Flood-fill'
       
   559 
       
   560 #xdrawModeFilledBox
       
   561 'Filled rectangle'
       
   562 
       
   563 #xdrawModePaste
       
   564 'Paste'
       
   565 
       
   566 #xdrawModePasteUnder
       
   567 'Paste under'
       
   568 
       
   569 #xdrawModePasteWithMask
       
   570 'Paste with Mask'
       
   571 
       
   572 #xdrawModePoint
       
   573 'Point'
       
   574 
       
   575 #xfileGrabImage
       
   576 'Pick from screen'
       
   577 
       
   578 #xfileLoadFromClass
       
   579 'Load from method...'
       
   580 
       
   581 #xfileLoadFromFile
       
   582 'Load from file...'
       
   583 
       
   584 #xfileNewImage
       
   585 'New image'
       
   586 
       
   587 #filePrint
       
   588 'Print'
       
   589 
       
   590 #xfileSaveAs
       
   591 'Save to file...'
       
   592 
       
   593 #xfileSaveMaskAs
       
   594 'Save mask to file...'
       
   595 
       
   596 #xfileSaveMethod
       
   597 'Save as method'
       
   598 
       
   599 #xfileSaveMethodAs
       
   600 'Save as Method...'
       
   601 
       
   602 #nextImageInSequence
       
   603 'Go to the next image in the animated gif image sequence.'
       
   604 
       
   605 #previousImageInSequence
       
   606 'Go to the previous image in the animated gif image sequence.'
       
   607 
       
   608 #colorMap
       
   609 'ColorMap functions'
       
   610 
       
   611 #colorMap1
       
   612 'Convert to depth-1 image'
       
   613 
       
   614 #colorMap1M
       
   615 'Convert to depth-1 image plus mask'
       
   616 
       
   617 #colorMap2
       
   618 'Convert to depth-2 image'
       
   619 
       
   620 #colorMap24
       
   621 'Convert to depth-24 image (rgb)'
       
   622 
       
   623 #colorMap2M
       
   624 'Convert to depth-2 image plus mask'
       
   625 
       
   626 #colorMap32
       
   627 'Convert to depth-32 image (rgba)'
       
   628 
       
   629 #colorMap4
       
   630 'Convert to depth-4 image'
       
   631 
       
   632 #colorMap4M
       
   633 'Convert to depth-4 image plus mask'
       
   634 
       
   635 #colorMap8
       
   636 'Convert to depth-8 image'
       
   637 
       
   638 #colorMap8M
       
   639 'Convert to depth-8 image plus mask'
       
   640 
       
   641 #colorMapTable
       
   642 'Shows a list of used colors of the image'
       
   643 
       
   644 #compressColormap
       
   645 'Remove unneeded entries from the colorMap'
       
   646 
       
   647 #cropAll
       
   648 'Find and remove all borders'
       
   649 
       
   650 #cropBottom
       
   651 'Find and remove bottom border'
       
   652 
       
   653 #cropLeft
       
   654 'Find and remove left border'
       
   655 
       
   656 #cropManual
       
   657 'Specify border(s) to remove.'
       
   658 
       
   659 #cropRight
       
   660 'Find and remove right border'
       
   661 
       
   662 #cropTop
       
   663 'Find and remove top border'
       
   664 
       
   665 #drawModeBox
       
   666 'Rectangle Drawing Mode'
       
   667 
       
   668 #drawModeCircle
       
   669 'Circle Drawing Mode'
       
   670 
       
   671 #drawModeCopy
       
   672 'Area Copy Mode'
       
   673 
       
   674 #drawModeFill
       
   675 'Flood Fill Mode'
       
   676 
       
   677 #drawModeFilledBox
       
   678 'Filled Rectangle Drawing Mode'
       
   679 
       
   680 #drawModePaste
       
   681 'Paste Mode'
       
   682 
       
   683 #drawModePasteUnder
       
   684 'Paste-Under Mode'
       
   685 
       
   686 #drawModePasteWithMask
       
   687 'Paste-with-Mask Mode'
       
   688 
       
   689 #drawModePoint
       
   690 'Point Drawing Mode'
       
   691 
       
   692 #drawModeSpecial
       
   693 'Special operations (select rectangle, then choose operation)'
       
   694 
       
   695 #drawModeSpray
       
   696 'Spray Drawing Mode'
       
   697 
       
   698 #editFlipHorizontal
       
   699 'Flip the image horizontally'
       
   700 
       
   701 #editFlipVertical
       
   702 'Flip the image vertically'
       
   703 
       
   704 #editMagnifyImage
       
   705 'Magnify the image'
       
   706 
       
   707 #editNegate
       
   708 'Invert the images colors'
       
   709 
       
   710 #editResize
       
   711 'Resize the image (preserving the old image)'
       
   712 
       
   713 #editRotate
       
   714 'Rotate the image'
       
   715 
       
   716 #fileGrabImageFromScreen
       
   717 'Pick an image from the screen (specify area)'
       
   718 
       
   719 #fileGrabImageFromWindow
       
   720 'Pick an image from a window on the screen (click on window)'
       
   721 
       
   722 #fileLoadFromClass
       
   723 'Select and load an image from a resource method'
       
   724 
       
   725 #fileLoadFromFile
       
   726 'Select and load an image from a file'
       
   727 
       
   728 #fileLoadFromURL
       
   729 'Load an image from the net, given its URL'
       
   730 
       
   731 #fileNewImage
       
   732 'Create a new image'
       
   733 
       
   734 #fileNewImageFromClipboard
       
   735 'Create a new image and initialize it from the clipboard'
       
   736 
       
   737 #fileNewMaskFromClipboard
       
   738 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
       
   739 
       
   740 #filePrint
       
   741 'Print the image on a postscript printer'
       
   742 
       
   743 #fileSave
       
   744 'Save the image'
       
   745 
       
   746 #fileSaveAs
       
   747 'Save the image to a file'
       
   748 
       
   749 #fileSaveButtonImageAs
       
   750 'Save an image of a button with the image to a file (for html use)'
       
   751 
       
   752 #fileSaveMaskAs
       
   753 'Save the mask of the image to a file'
       
   754 
       
   755 #fileSaveMethod
       
   756 'Save the image as resource method in the current class and selector'
       
   757 
       
   758 #fileSaveMethodAs
       
   759 'Save the image as resource method in a class'
       
   760 
       
   761 #magnificationNumber
       
   762 'Shows the current magnification'
       
   763 
       
   764 #magnifyImageDown
       
   765 'Decrease magnification'
       
   766 
       
   767 #magnifyImageUp
       
   768 'Increase magnification'
       
   769 
       
   770 #mouseKeyColorMode
       
   771 'Toggle between left and right mouse button color'
       
   772 
       
   773 #previewView
       
   774 'Shows a preview of the image'
       
   775 
       
   776 #settingsGridMagnification
       
   777 'Change the grid magnification of the edit view'
       
   778 
       
   779 )
       
   780 
       
   781     "Created: / 19-01-2012 / 13:29:31 / cg"
       
   782 ! !
   571 ! !
   783 
   572 
   784 !ImageEditor class methodsFor:'image specs'!
   573 !ImageEditor class methodsFor:'image specs'!
   785 
   574 
   786 circleIcon
   575 circleIcon
   849 
   638 
   850 defaultIcon
   639 defaultIcon
   851     <resource: #programImage>
   640     <resource: #programImage>
   852 
   641 
   853     ^ ToolbarIconLibrary startImageEditorIcon
   642     ^ ToolbarIconLibrary startImageEditorIcon
       
   643 !
       
   644 
       
   645 fillCircleIcon
       
   646     "This resource specification was automatically generated
       
   647      by the ImageEditor of ST/X."
       
   648 
       
   649     "Do not manually edit this!! If it is corrupted,
       
   650      the ImageEditor may not be able to read the specification."
       
   651 
       
   652     "
       
   653      self fillCircleIcon inspect
       
   654      ImageEditor openOnClass:self andSelector:#fillCircleIcon
       
   655      Icon flushCachedIcons
       
   656     "
       
   657 
       
   658     <resource: #image>
       
   659 
       
   660     ^Icon
       
   661         constantNamed:'ImageEditor class fillCircleIcon'
       
   662         ifAbsentPut:[(Depth1Image width:14 height:14) bits:(ByteArray fromPackedString:'@@@@@@@A@@@@@@@@@@@@@@@C@@@@@@@@@@@@@@@a')
       
   663             colorMapFromArray:#[0 0 0 255 0 0]
       
   664             mask:((ImageMask width:14 height:14) bits:(ByteArray fromPackedString:'@@@@@@N@C>@_<A?0O? ?>C?8G?@_<@? @8@@@@@a'); yourself); yourself]
   854 !
   665 !
   855 
   666 
   856 fillGradientRectIcon
   667 fillGradientRectIcon
   857     <resource: #image>
   668     <resource: #image>
   858     "This resource specification was automatically generated
   669     "This resource specification was automatically generated
  1110                             bits:(ByteArray 
   921                             bits:(ByteArray 
  1111                                         fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b');
   922                                         fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b');
  1112                             yourself);
   923                             yourself);
  1113                 yourself
   924                 yourself
  1114         ]
   925         ]
       
   926 !
       
   927 
       
   928 maskOutsideCircleIcon
       
   929     "This resource specification was automatically generated
       
   930      by the ImageEditor of ST/X."
       
   931 
       
   932     "Do not manually edit this!! If it is corrupted,
       
   933      the ImageEditor may not be able to read the specification."
       
   934 
       
   935     "
       
   936      self maskOutsideCircleIcon inspect
       
   937      ImageEditor openOnClass:self andSelector:#maskOutsideCircleIcon
       
   938      Icon flushCachedIcons
       
   939     "
       
   940 
       
   941     <resource: #image>
       
   942 
       
   943     ^Icon
       
   944         constantNamed:'ImageEditor class maskOutsideCircleIcon'
       
   945         ifAbsentPut:[(Depth1Image width:14 height:14) bits:(ByteArray fromPackedString:'??3??O1=<A3 CN@L0@S@AL@G8@3 CO@\?G3??@@a')
       
   946             colorMapFromArray:#[0 0 0 255 0 0]
       
   947             mask:((ImageMask width:14 height:14) bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); yourself); yourself]
       
   948 !
       
   949 
       
   950 maskOutsideRectangleIcon
       
   951     "This resource specification was automatically generated
       
   952      by the ImageEditor of ST/X."
       
   953 
       
   954     "Do not manually edit this!! If it is corrupted,
       
   955      the ImageEditor may not be able to read the specification."
       
   956 
       
   957     "
       
   958      self maskOutsideRectangleIcon inspect
       
   959      ImageEditor openOnClass:self andSelector:#maskOutsideRectangleIcon
       
   960      Icon flushCachedIcons
       
   961     "
       
   962 
       
   963     <resource: #image>
       
   964 
       
   965     ^Icon
       
   966         constantNamed:'ImageEditor class maskOutsideRectangleIcon'
       
   967         ifAbsentPut:[(Depth1Image width:14 height:14) bits:(ByteArray fromPackedString:'??3??L@M0@3@CL@L0@3@CL@L0@3@CL@L??7??@@a')
       
   968             colorMapFromArray:#[0 0 0 255 0 0]
       
   969             mask:((ImageMask width:14 height:14) bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a'); yourself); yourself]
  1115 !
   970 !
  1116 
   971 
  1117 pasteIcon
   972 pasteIcon
  1118     <resource: #image>
   973     <resource: #image>
  1119     "This resource specification was automatically generated
   974     "This resource specification was automatically generated
  2543 
  2398 
  2544     ^ 
  2399     ^ 
  2545      #(Menu
  2400      #(Menu
  2546         (
  2401         (
  2547          (MenuItem
  2402          (MenuItem
  2548             enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth
  2403             "/ enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth
       
  2404             enabled: imageIsLoaded
  2549             label: 'Depth'
  2405             label: 'Depth'
  2550             translateLabel: true
  2406             translateLabel: true
  2551             submenu: 
  2407             submenu: 
  2552            (Menu
  2408            (Menu
  2553               (
  2409               (
  2557                   itemValue: colorMapMode:
  2413                   itemValue: colorMapMode:
  2558                   translateLabel: true
  2414                   translateLabel: true
  2559                   argument: depth1
  2415                   argument: depth1
  2560                   choice: colorMapMode
  2416                   choice: colorMapMode
  2561                   choiceValue: depth1
  2417                   choiceValue: depth1
       
  2418             enabled: imageIsLoadedAndNotReadonlyHolder
  2562                 )
  2419                 )
  2563                (MenuItem
  2420                (MenuItem
  2564                   activeHelpKey: colorMap1M
  2421                   activeHelpKey: colorMap1M
  2565                   label: '1-Plane + Mask'
  2422                   label: '1-Plane + Mask'
  2566                   itemValue: colorMapMode:
  2423                   itemValue: colorMapMode:
  2567                   translateLabel: true
  2424                   translateLabel: true
  2568                   argument: masked1
  2425                   argument: masked1
  2569                   choice: colorMapMode
  2426                   choice: colorMapMode
  2570                   choiceValue: masked1
  2427                   choiceValue: masked1
       
  2428             enabled: imageIsLoadedAndNotReadonlyHolder
  2571                 )
  2429                 )
  2572                (MenuItem
  2430                (MenuItem
  2573                   label: '-'
  2431                   label: '-'
  2574                 )
  2432                 )
  2575                (MenuItem
  2433                (MenuItem
  2578                   itemValue: colorMapMode:
  2436                   itemValue: colorMapMode:
  2579                   translateLabel: true
  2437                   translateLabel: true
  2580                   argument: depth2
  2438                   argument: depth2
  2581                   choice: colorMapMode
  2439                   choice: colorMapMode
  2582                   choiceValue: depth2
  2440                   choiceValue: depth2
       
  2441             enabled: imageIsLoadedAndNotReadonlyHolder
  2583                 )
  2442                 )
  2584                (MenuItem
  2443                (MenuItem
  2585                   activeHelpKey: colorMap2M
  2444                   activeHelpKey: colorMap2M
  2586                   label: '2-Plane + Mask'
  2445                   label: '2-Plane + Mask'
  2587                   itemValue: colorMapMode:
  2446                   itemValue: colorMapMode:
  2588                   translateLabel: true
  2447                   translateLabel: true
  2589                   argument: masked2
  2448                   argument: masked2
  2590                   choice: colorMapMode
  2449                   choice: colorMapMode
  2591                   choiceValue: masked2
  2450                   choiceValue: masked2
       
  2451             enabled: imageIsLoadedAndNotReadonlyHolder
  2592                 )
  2452                 )
  2593                (MenuItem
  2453                (MenuItem
  2594                   label: '-'
  2454                   label: '-'
  2595                 )
  2455                 )
  2596                (MenuItem
  2456                (MenuItem
  2599                   itemValue: colorMapMode:
  2459                   itemValue: colorMapMode:
  2600                   translateLabel: true
  2460                   translateLabel: true
  2601                   argument: depth4
  2461                   argument: depth4
  2602                   choice: colorMapMode
  2462                   choice: colorMapMode
  2603                   choiceValue: depth4
  2463                   choiceValue: depth4
       
  2464             enabled: imageIsLoadedAndNotReadonlyHolder
  2604                 )
  2465                 )
  2605                (MenuItem
  2466                (MenuItem
  2606                   activeHelpKey: colorMap4M
  2467                   activeHelpKey: colorMap4M
  2607                   label: '4-Plane + Mask'
  2468                   label: '4-Plane + Mask'
  2608                   itemValue: colorMapMode:
  2469                   itemValue: colorMapMode:
  2609                   translateLabel: true
  2470                   translateLabel: true
  2610                   argument: masked4
  2471                   argument: masked4
  2611                   choice: colorMapMode
  2472                   choice: colorMapMode
  2612                   choiceValue: masked4
  2473                   choiceValue: masked4
       
  2474             enabled: imageIsLoadedAndNotReadonlyHolder
  2613                 )
  2475                 )
  2614                (MenuItem
  2476                (MenuItem
  2615                   label: '-'
  2477                   label: '-'
  2616                 )
  2478                 )
  2617                (MenuItem
  2479                (MenuItem
  2620                   itemValue: colorMapMode:
  2482                   itemValue: colorMapMode:
  2621                   translateLabel: true
  2483                   translateLabel: true
  2622                   argument: depth8
  2484                   argument: depth8
  2623                   choice: colorMapMode
  2485                   choice: colorMapMode
  2624                   choiceValue: depth8
  2486                   choiceValue: depth8
       
  2487             enabled: imageIsLoadedAndNotReadonlyHolder
  2625                 )
  2488                 )
  2626                (MenuItem
  2489                (MenuItem
  2627                   activeHelpKey: colorMap8M
  2490                   activeHelpKey: colorMap8M
  2628                   label: '8-Plane + Mask'
  2491                   label: '8-Plane + Mask'
  2629                   itemValue: colorMapMode:
  2492                   itemValue: colorMapMode:
  2630                   translateLabel: true
  2493                   translateLabel: true
  2631                   argument: masked8
  2494                   argument: masked8
  2632                   choice: colorMapMode
  2495                   choice: colorMapMode
  2633                   choiceValue: masked8
  2496                   choiceValue: masked8
       
  2497             enabled: imageIsLoadedAndNotReadonlyHolder
  2634                 )
  2498                 )
  2635                (MenuItem
  2499                (MenuItem
  2636                   label: '-'
  2500                   label: '-'
  2637                 )
  2501                 )
  2638                (MenuItem
  2502                (MenuItem
  2641                   itemValue: colorMapMode:
  2505                   itemValue: colorMapMode:
  2642                   translateLabel: true
  2506                   translateLabel: true
  2643                   argument: depth16
  2507                   argument: depth16
  2644                   choice: colorMapMode
  2508                   choice: colorMapMode
  2645                   choiceValue: depth16
  2509                   choiceValue: depth16
       
  2510             enabled: imageIsLoadedAndNotReadonlyHolder
  2646                 )
  2511                 )
  2647                (MenuItem
  2512                (MenuItem
  2648                   activeHelpKey: colorMap16M
  2513                   activeHelpKey: colorMap16M
  2649                   label: '16-Plane + Mask'
  2514                   label: '16-Plane + Mask'
  2650                   itemValue: colorMapMode:
  2515                   itemValue: colorMapMode:
  2651                   translateLabel: true
  2516                   translateLabel: true
  2652                   argument: masked16
  2517                   argument: masked16
  2653                   choice: colorMapMode
  2518                   choice: colorMapMode
  2654                   choiceValue: masked16
  2519                   choiceValue: masked16
       
  2520             enabled: imageIsLoadedAndNotReadonlyHolder
  2655                 )
  2521                 )
  2656                (MenuItem
  2522                (MenuItem
  2657                   label: '-'
  2523                   label: '-'
  2658                 )
  2524                 )
  2659                (MenuItem
  2525                (MenuItem
  2662                   itemValue: colorMapMode:
  2528                   itemValue: colorMapMode:
  2663                   translateLabel: true
  2529                   translateLabel: true
  2664                   argument: depth24
  2530                   argument: depth24
  2665                   choice: colorMapMode
  2531                   choice: colorMapMode
  2666                   choiceValue: depth24
  2532                   choiceValue: depth24
       
  2533             enabled: imageIsLoadedAndNotReadonlyHolder
  2667                 )
  2534                 )
  2668                (MenuItem
  2535                (MenuItem
  2669                   activeHelpKey: colorMap24M
  2536                   activeHelpKey: colorMap24M
  2670                   label: '24-Plane + Mask'
  2537                   label: '24-Plane + Mask'
  2671                   itemValue: colorMapMode:
  2538                   itemValue: colorMapMode:
  2672                   translateLabel: true
  2539                   translateLabel: true
  2673                   argument: masked24
  2540                   argument: masked24
  2674                   choice: colorMapMode
  2541                   choice: colorMapMode
  2675                   choiceValue: masked24
  2542                   choiceValue: masked24
       
  2543             enabled: imageIsLoadedAndNotReadonlyHolder
  2676                 )
  2544                 )
  2677                (MenuItem
  2545                (MenuItem
  2678                   label: '-'
  2546                   label: '-'
  2679                 )
  2547                 )
  2680                (MenuItem
  2548                (MenuItem
  2683                   itemValue: colorMapMode:
  2551                   itemValue: colorMapMode:
  2684                   translateLabel: true
  2552                   translateLabel: true
  2685                   argument: depth32
  2553                   argument: depth32
  2686                   choice: colorMapMode
  2554                   choice: colorMapMode
  2687                   choiceValue: depth32
  2555                   choiceValue: depth32
       
  2556             enabled: imageIsLoadedAndNotReadonlyHolder
  2688                 )
  2557                 )
  2689                )
  2558                )
  2690               nil
  2559               nil
  2691               nil
  2560               nil
  2692             )
  2561             )
  2693           )
  2562           )
  2694          (MenuItem
  2563          (MenuItem
  2695             enabled: imageIsLoadedHolder
  2564             enabled: imageIsLoadedAndNotReadonlyHolder
  2696             label: 'ColorMap'
  2565             label: 'ColorMap'
  2697             translateLabel: true
  2566             translateLabel: true
  2698             submenu: 
  2567             submenu: 
  2699            (Menu
  2568            (Menu
  2700               (
  2569               (
  2751               nil
  2620               nil
  2752               nil
  2621               nil
  2753             )
  2622             )
  2754           )
  2623           )
  2755          (MenuItem
  2624          (MenuItem
  2756             enabled: imageIsLoadedHolder
  2625             enabled: imageIsLoadedAndNotReadonlyHolder
  2757             label: 'Process'
  2626             label: 'Process'
  2758             translateLabel: true
  2627             translateLabel: true
  2759             submenu: 
  2628             submenu: 
  2760            (Menu
  2629            (Menu
  2761               (
  2630               (
  2819               nil
  2688               nil
  2820               nil
  2689               nil
  2821             )
  2690             )
  2822           )
  2691           )
  2823          (MenuItem
  2692          (MenuItem
  2824             enabled: imageIsLoadedHolder
  2693             enabled: imageIsLoadedAndNotReadonlyHolder
  2825             label: 'Mask'
  2694             label: 'Mask'
  2826             translateLabel: true
  2695             translateLabel: true
  2827             submenu: 
  2696             submenu: 
  2828            (Menu
  2697            (Menu
  2829               (
  2698               (
  2860           )
  2729           )
  2861          )
  2730          )
  2862         nil
  2731         nil
  2863         nil
  2732         nil
  2864       )
  2733       )
       
  2734 
       
  2735     "Modified: / 16-02-2017 / 10:27:13 / cg"
  2865 !
  2736 !
  2866 
  2737 
  2867 menuEdit
  2738 menuEdit
  2868     "This resource specification was automatically generated
  2739     "This resource specification was automatically generated
  2869      by the MenuEditor of ST/X."
  2740      by the MenuEditor of ST/X."
  2934             label: '3D Projection...'
  2805             label: '3D Projection...'
  2935             itemValue: do3DProjection
  2806             itemValue: do3DProjection
  2936             translateLabel: true
  2807             translateLabel: true
  2937           )
  2808           )
  2938          (MenuItem
  2809          (MenuItem
  2939             enabled: imageIsLoadedHolder
  2810             enabled: imageIsLoadedAndAllowedToFlipHolder
  2940             label: 'Flip'
  2811             label: 'Flip'
  2941             translateLabel: true
  2812             translateLabel: true
  2942             submenu: 
  2813             submenu: 
  2943            (Menu
  2814            (Menu
  2944               (
  2815               (
  2945                (MenuItem
  2816                (MenuItem
  2946                   activeHelpKey: editFlipVertical
  2817                   activeHelpKey: editFlipVertical
  2947                   enabled: imageIsLoadedHolder
  2818                   enabled: imageIsLoadedAndNotReadonlyHolder
  2948                   label: 'Flip - Vertical'
  2819                   label: 'Flip - Vertical'
  2949                   itemValue: doFlipVertical
  2820                   itemValue: doFlipVertical
  2950                   translateLabel: true
  2821                   translateLabel: true
  2951                   labelImage: (ResourceRetriever ImageEditor flipVerticalIcon 'Flip - Vertical')
  2822                   labelImage: (ResourceRetriever ImageEditor flipVerticalIcon 'Flip - Vertical')
  2952                 )
  2823                 )
  2953                (MenuItem
  2824                (MenuItem
  2954                   activeHelpKey: editFlipHorizontal
  2825                   activeHelpKey: editFlipHorizontal
  2955                   enabled: imageIsLoadedHolder
  2826                   enabled: imageIsLoadedAndNotReadonlyHolder
  2956                   label: 'Flip - Horizontal'
  2827                   label: 'Flip - Horizontal'
  2957                   itemValue: doFlipHorizontal
  2828                   itemValue: doFlipHorizontal
  2958                   translateLabel: true
  2829                   translateLabel: true
  2959                   labelImage: (ResourceRetriever ImageEditor flipHorizontalIcon 'Flip - Horizontal')
  2830                   labelImage: (ResourceRetriever ImageEditor flipHorizontalIcon 'Flip - Horizontal')
  2960                 )
  2831                 )
  2965           )
  2836           )
  2966          (MenuItem
  2837          (MenuItem
  2967             label: '-'
  2838             label: '-'
  2968           )
  2839           )
  2969          (MenuItem
  2840          (MenuItem
  2970             enabled: imageIsLoadedAndAllowedToChangeImageDimensionAndDepth
  2841             enabled: imageIsLoadedAndAllowedToChangeImageDimension
  2971             label: 'Crop'
  2842             label: 'Crop'
  2972             translateLabel: true
  2843             translateLabel: true
  2973             submenu: 
  2844             submenu: 
  2974            (Menu
  2845            (Menu
  2975               (
  2846               (
  3027             itemValue: doUnCropManual
  2898             itemValue: doUnCropManual
  3028             translateLabel: true
  2899             translateLabel: true
  3029           )
  2900           )
  3030          (MenuItem
  2901          (MenuItem
  3031             activeHelpKey: shiftManual
  2902             activeHelpKey: shiftManual
  3032             enabled: imageIsLoadedHolder
  2903             enabled: imageIsLoadedAndAllowedToChangeImageDimension
  3033             label: 'Shift...'
  2904             label: 'Shift...'
  3034             itemValue: doShiftManual
  2905             itemValue: doShiftManual
  3035             translateLabel: true
  2906             translateLabel: true
  3036           )
  2907           )
  3037          (MenuItem
  2908          (MenuItem
  3043             label: 'Edit Mask'
  2914             label: 'Edit Mask'
  3044             itemValue: doEditMask
  2915             itemValue: doEditMask
  3045             translateLabel: true
  2916             translateLabel: true
  3046           )
  2917           )
  3047          (MenuItem
  2918          (MenuItem
  3048             enabled: imageIsLoadedHolder
  2919             enabled: imageIsLoadedAndNotReadonlyHolder
  3049             label: 'Text...'
  2920             label: 'Text...'
  3050             itemValue: doInsertTextFromUser
  2921             itemValue: doInsertTextFromUser
  3051             translateLabel: true
  2922             translateLabel: true
  3052           )
  2923           )
  3053          (MenuItem
  2924          (MenuItem
  3054             label: '-'
  2925             label: '-'
  3055           )
  2926           )
  3056          (MenuItem
  2927          (MenuItem
       
  2928             enabled: imageIsLoadedHolder
  3057             label: 'Animation Sequence'
  2929             label: 'Animation Sequence'
  3058             translateLabel: true
  2930             translateLabel: true
  3059             submenu: 
  2931             submenu: 
  3060            (Menu
  2932            (Menu
  3061               (
  2933               (
  3087           )
  2959           )
  3088          )
  2960          )
  3089         nil
  2961         nil
  3090         nil
  2962         nil
  3091       )
  2963       )
       
  2964 
       
  2965     "Modified: / 16-02-2017 / 11:01:52 / cg"
  3092 !
  2966 !
  3093 
  2967 
  3094 menuFile
  2968 menuFile
  3095     "This resource specification was automatically generated
  2969     "This resource specification was automatically generated
  3096      by the MenuEditor of ST/X."
  2970      by the MenuEditor of ST/X."
  3531      by the MenuEditor of ST/X."
  3405      by the MenuEditor of ST/X."
  3532 
  3406 
  3533     "Do not manually edit this!! If it is corrupted,
  3407     "Do not manually edit this!! If it is corrupted,
  3534      the MenuEditor may not be able to read the specification."
  3408      the MenuEditor may not be able to read the specification."
  3535 
  3409 
       
  3410 
  3536     "
  3411     "
  3537      MenuEditor new openOnClass:ImageEditor andSelector:#modeMenu
  3412      MenuEditor new openOnClass:ImageEditor andSelector:#modeMenu
  3538      (Menu new fromLiteralArrayEncoding:(ImageEditor modeMenu)) startUp
  3413      (Menu new fromLiteralArrayEncoding:(ImageEditor modeMenu)) startUp
  3539     "
  3414     "
  3540 
  3415 
  3545         (
  3420         (
  3546          (MenuItem
  3421          (MenuItem
  3547             activeHelpKey: drawModePoint
  3422             activeHelpKey: drawModePoint
  3548             enabled: imageIsLoadedHolder
  3423             enabled: imageIsLoadedHolder
  3549             label: 'Point'
  3424             label: 'Point'
  3550             translateLabel: true
       
  3551             labelImage: (ResourceRetriever ImageEditor pointIcon 'Point')
  3425             labelImage: (ResourceRetriever ImageEditor pointIcon 'Point')
  3552             choice: editMode
  3426             choice: editMode
  3553             choiceValue: point
  3427             choiceValue: point
  3554           )
  3428           )
  3555          (MenuItem
  3429          (MenuItem
       
  3430             label: '-'
       
  3431           )
       
  3432          (MenuItem
  3556             activeHelpKey: drawModePoint
  3433             activeHelpKey: drawModePoint
  3557             enabled: imageIsLoadedHolder
  3434             enabled: imageIsLoadedHolder
  3558             label: 'Spray'
  3435             label: 'Spray'
  3559             translateLabel: true
       
  3560             labelImage: (ResourceRetriever ImageEditor sprayIcon 'Spray')
  3436             labelImage: (ResourceRetriever ImageEditor sprayIcon 'Spray')
  3561             choice: editMode
  3437             choice: editMode
  3562             choiceValue: spray
  3438             choiceValue: spray
  3563           )
  3439           )
  3564          (MenuItem
  3440          (MenuItem
  3565             activeHelpKey: drawModeSmooth
  3441             activeHelpKey: drawModeSmooth
  3566             enabled: imageIsLoadedHolder
  3442             enabled: imageIsLoadedHolder
  3567             label: 'Smooth'
  3443             label: 'Smooth'
  3568             translateLabel: true
       
  3569             labelImage: (ResourceRetriever ImageEditor smoothIcon 'Smooth')
  3444             labelImage: (ResourceRetriever ImageEditor smoothIcon 'Smooth')
  3570             choice: editMode
  3445             choice: editMode
  3571             choiceValue: smooth
  3446             choiceValue: smooth
  3572           )
  3447           )
  3573          (MenuItem
  3448          (MenuItem
       
  3449             label: '-'
       
  3450           )
       
  3451          (MenuItem
  3574             activeHelpKey: drawModeBox
  3452             activeHelpKey: drawModeBox
  3575             enabled: imageIsLoadedHolder
  3453             enabled: imageIsLoadedHolder
  3576             label: 'Rect'
  3454             label: 'Rect'
  3577             translateLabel: true
       
  3578             labelImage: (ResourceRetriever ImageEditor rectIcon 'Rect')
  3455             labelImage: (ResourceRetriever ImageEditor rectIcon 'Rect')
  3579             choice: editMode
  3456             choice: editMode
  3580             choiceValue: box
  3457             choiceValue: box
  3581           )
  3458           )
  3582          (MenuItem
  3459          (MenuItem
  3583             activeHelpKey: drawModeFilledBox
  3460             activeHelpKey: drawModeFilledBox
  3584             enabled: imageIsLoadedHolder
  3461             enabled: imageIsLoadedHolder
  3585             label: 'Filled Rectangle'
  3462             label: 'Filled Rectangle'
  3586             translateLabel: true
       
  3587             labelImage: (ResourceRetriever ImageEditor fillRectIcon 'Filled Rectangle')
  3463             labelImage: (ResourceRetriever ImageEditor fillRectIcon 'Filled Rectangle')
  3588             choice: editMode
  3464             choice: editMode
  3589             choiceValue: filledBox
  3465             choiceValue: filledBox
  3590           )
  3466           )
  3591          (MenuItem
  3467          (MenuItem
  3592             activeHelpKey: drawModeBox
  3468             activeHelpKey: drawModeCircle
  3593             enabled: imageIsLoadedHolder
  3469             enabled: imageIsLoadedHolder
  3594             label: 'Circle'
  3470             label: 'Circle'
  3595             translateLabel: true
       
  3596             labelImage: (ResourceRetriever ImageEditor circleIcon 'Circle')
  3471             labelImage: (ResourceRetriever ImageEditor circleIcon 'Circle')
  3597             choice: editMode
  3472             choice: editMode
  3598             choiceValue: circle
  3473             choiceValue: circle
  3599           )
  3474           )
  3600          (MenuItem
  3475          (MenuItem
       
  3476             activeHelpKey: drawModeFilledCircle
       
  3477             enabled: imageIsLoadedHolder
       
  3478             label: 'Filled Circle'
       
  3479             labelImage: (ResourceRetriever ImageEditor fillCircleIcon 'Filled Circle')
       
  3480             choice: editMode
       
  3481             choiceValue: filledCircle
       
  3482           )
       
  3483          (MenuItem
  3601             activeHelpKey: drawModeFill
  3484             activeHelpKey: drawModeFill
  3602             enabled: imageIsLoadedHolder
  3485             enabled: imageIsLoadedHolder
  3603             label: 'Fill'
  3486             label: 'Fill'
  3604             translateLabel: true
       
  3605             labelImage: (ResourceRetriever ImageEditor fillIcon 'Fill')
  3487             labelImage: (ResourceRetriever ImageEditor fillIcon 'Fill')
  3606             choice: editMode
  3488             choice: editMode
  3607             choiceValue: fill
  3489             choiceValue: fill
  3608           )
  3490           )
  3609          (MenuItem
  3491          (MenuItem
       
  3492             label: '-'
       
  3493           )
       
  3494          (MenuItem
       
  3495             activeHelpKey: drawModeMaskOutsideRectangle
       
  3496             enabled: imageHasMaskAndIsNotReadOnlyHolder
       
  3497             label: 'Mask Outside Rectangle'
       
  3498             labelImage: (ResourceRetriever ImageEditor maskOutsideRectangleIcon 'Mask Outside Rectangle')
       
  3499             choice: editMode
       
  3500             choiceValue: maskOutsideRect
       
  3501           )
       
  3502          (MenuItem
       
  3503             activeHelpKey: drawModeMaskOutsideCircle
       
  3504             enabled: imageHasMaskAndIsNotReadOnlyHolder
       
  3505             label: 'Mask Outside Circle'
       
  3506             labelImage: (ResourceRetriever ImageEditor maskOutsideCircleIcon 'Mask Outside Circle')
       
  3507             choice: editMode
       
  3508             choiceValue: maskOutsideCircle
       
  3509           )
       
  3510          (MenuItem
       
  3511             label: '-'
       
  3512           )
       
  3513          (MenuItem
  3610             activeHelpKey: drawModeCopy
  3514             activeHelpKey: drawModeCopy
  3611             enabled: imageIsLoadedHolder
  3515             enabled: imageIsLoadedHolder
  3612             label: 'Copy'
  3516             label: 'Copy'
  3613             translateLabel: true
       
  3614             labelImage: (ResourceRetriever ImageEditor copyIcon 'Copy')
  3517             labelImage: (ResourceRetriever ImageEditor copyIcon 'Copy')
  3615             choice: editMode
  3518             choice: editMode
  3616             choiceValue: copy
  3519             choiceValue: copy
  3617           )
  3520           )
  3618          (MenuItem
  3521          (MenuItem
  3619             activeHelpKey: drawModePaste
  3522             activeHelpKey: drawModePaste
  3620             enabled: imageIsLoadedHolder
  3523             enabled: imageIsLoadedHolder
  3621             label: 'Paste'
  3524             label: 'Paste'
  3622             translateLabel: true
       
  3623             labelImage: (ResourceRetriever ImageEditor pasteIcon 'Paste')
  3525             labelImage: (ResourceRetriever ImageEditor pasteIcon 'Paste')
  3624             choice: editMode
  3526             choice: editMode
  3625             choiceValue: paste
  3527             choiceValue: paste
  3626           )
  3528           )
  3627          (MenuItem
  3529          (MenuItem
  3628             activeHelpKey: drawModePasteUnder
  3530             activeHelpKey: drawModePasteUnder
  3629             enabled: imageIsLoadedHolder
  3531             enabled: imageIsLoadedHolder
  3630             label: 'Paste Under'
  3532             label: 'Paste Under'
  3631             translateLabel: true
       
  3632             labelImage: (ResourceRetriever ImageEditor pasteUnderIcon 'Paste Under')
  3533             labelImage: (ResourceRetriever ImageEditor pasteUnderIcon 'Paste Under')
  3633             choice: editMode
  3534             choice: editMode
  3634             choiceValue: pasteUnder
  3535             choiceValue: pasteUnder
  3635           )
  3536           )
  3636          (MenuItem
  3537          (MenuItem
  3637             activeHelpKey: drawModePasteWithMask
  3538             activeHelpKey: drawModePasteWithMask
  3638             enabled: imageIsLoadedHolder
  3539             enabled: imageIsLoadedHolder
  3639             label: 'Paste with Mask'
  3540             label: 'Paste with Mask'
  3640             translateLabel: true
       
  3641             labelImage: (ResourceRetriever ImageEditor pasteWithMaskIcon 'Paste with Mask')
  3541             labelImage: (ResourceRetriever ImageEditor pasteWithMaskIcon 'Paste with Mask')
  3642             choice: editMode
  3542             choice: editMode
  3643             choiceValue: pasteWithMask
  3543             choiceValue: pasteWithMask
  3644           )
  3544           )
  3645          (MenuItem
  3545          (MenuItem
       
  3546             label: '-'
       
  3547           )
       
  3548          (MenuItem
  3646             activeHelpKey: drawModeSpecial
  3549             activeHelpKey: drawModeSpecial
  3647             enabled: imageIsLoadedHolder
  3550             enabled: imageIsLoadedHolder
  3648             label: 'Special'
  3551             label: 'Special'
  3649             translateLabel: true
       
  3650             labelImage: (ResourceRetriever ImageEditor specialIcon 'Special')
  3552             labelImage: (ResourceRetriever ImageEditor specialIcon 'Special')
  3651             choice: editMode
  3553             choice: editMode
  3652             choiceValue: specialOperation
  3554             choiceValue: specialOperation
  3653           )
  3555           )
  3654          )
  3556          )
  3655         nil
  3557         nil
  3656         nil
  3558         nil
  3657       )
  3559       )
  3658 
       
  3659     "Modified: / 04-07-2010 / 10:18:08 / cg"
       
  3660 !
  3560 !
  3661 
  3561 
  3662 previewMenu
  3562 previewMenu
  3663     "This resource specification was automatically generated
  3563     "This resource specification was automatically generated
  3664      by the MenuEditor of ST/X."
  3564      by the MenuEditor of ST/X."
  3972     ^ savedImage
  3872     ^ savedImage
  3973 ! !
  3873 ! !
  3974 
  3874 
  3975 !ImageEditor methodsFor:'accessing-behavior'!
  3875 !ImageEditor methodsFor:'accessing-behavior'!
  3976 
  3876 
       
  3877 allowedToChangeImageDimension
       
  3878     "used to edit an existing image's contents only (Expecco)"
       
  3879 
       
  3880     ^ self allowedToChangeImageDimensionAndDepth
       
  3881 
       
  3882     "Created: / 16-02-2017 / 01:59:21 / cg"
       
  3883 !
       
  3884 
  3977 allowedToChangeImageDimensionAndDepth
  3885 allowedToChangeImageDimensionAndDepth
  3978     "used to edit an existing image's contents only (Expecco)"
  3886     "used to edit an existing image's contents only (Expecco)"
  3979 
  3887 
  3980     self readOnly ifTrue:[^ false].
  3888     self readOnly ifTrue:[^ false].
  3981     ^ allowedToChangeImageDimensionAndDepth ? true
  3889     ^ allowedToChangeImageDimensionAndDepth ? true
  4150     ^ holder
  4058     ^ holder
  4151 
  4059 
  4152     "Modified: / 21-10-2010 / 14:36:57 / cg"
  4060     "Modified: / 21-10-2010 / 14:36:57 / cg"
  4153 !
  4061 !
  4154 
  4062 
       
  4063 imageHasMaskAndIsNotReadOnlyHolder
       
  4064     "returns whether an image is loaded and editable as value holder"
       
  4065 
       
  4066     ^ BlockValue
       
  4067         with:[:loaded | loaded and:[ self image mask notNil and:[self readOnly not] ]]
       
  4068         argument:(self imageIsLoadedHolder)
       
  4069 
       
  4070     "Created: / 16-02-2017 / 12:17:25 / cg"
       
  4071 !
       
  4072 
  4155 imageHasNextImage
  4073 imageHasNextImage
  4156     ^ self imageHasImageSequence and:[ (imageSeqNr ? 1) < self image imageSequence size ]
  4074     ^ self imageHasImageSequence and:[ (imageSeqNr ? 1) < self image imageSequence size ]
  4157 
  4075 
  4158     "Created: / 21-10-2010 / 14:37:10 / cg"
  4076     "Created: / 21-10-2010 / 14:37:10 / cg"
  4159 !
  4077 !
  4195         builder aspectAt:#imageInfoHolder put:(holder :=  '' asValue).
  4113         builder aspectAt:#imageInfoHolder put:(holder :=  '' asValue).
  4196     ].
  4114     ].
  4197     ^ holder
  4115     ^ holder
  4198 
  4116 
  4199     "Modified: / 04-07-2010 / 10:15:14 / cg"
  4117     "Modified: / 04-07-2010 / 10:15:14 / cg"
       
  4118 !
       
  4119 
       
  4120 imageIsLoadedAndAllowedToChangeImageDimension
       
  4121     "returns whether an image is loaded as value holder"
       
  4122 
       
  4123     ^ [ 
       
  4124         self imageIsLoadedHolder value
       
  4125         and:[ self allowedToChangeImageDimension ] 
       
  4126       ]
       
  4127 
       
  4128     "Created: / 16-02-2017 / 01:58:41 / cg"
  4200 !
  4129 !
  4201 
  4130 
  4202 imageIsLoadedAndAllowedToChangeImageDimensionAndDepth
  4131 imageIsLoadedAndAllowedToChangeImageDimensionAndDepth
  4203     "returns whether an image is loaded as value holder"
  4132     "returns whether an image is loaded as value holder"
  4204 
  4133 
  4221 !
  4150 !
  4222 
  4151 
  4223 imageIsLoadedAndNotReadonlyHolder
  4152 imageIsLoadedAndNotReadonlyHolder
  4224     "returns whether an image is loaded and editable as value holder"
  4153     "returns whether an image is loaded and editable as value holder"
  4225 
  4154 
  4226     ^ [ 
  4155     ^ BlockValue
  4227         self imageIsLoadedHolder value
  4156         with:[:loaded | loaded and:[ self readOnly not ]]
  4228         and:[ self readOnly not  ] 
  4157         argument:(self imageIsLoadedHolder)
  4229       ]
  4158 
  4230 
  4159     "Modified: / 16-02-2017 / 12:11:31 / cg"
  4231     "Modified: / 04-07-2010 / 10:15:43 / cg"
       
  4232 !
  4160 !
  4233 
  4161 
  4234 imageIsLoadedHolder
  4162 imageIsLoadedHolder
  4235     "returns whether an image is loaded as value holder"
  4163     "returns whether an image is loaded as value holder"
  4236 
  4164 
  4442         ].
  4370         ].
  4443     ].
  4371     ].
  4444 !
  4372 !
  4445 
  4373 
  4446 update:something with:aParameter from:changedObject
  4374 update:something with:aParameter from:changedObject
  4447     |clrIndex img imagePreView clr changedColor cMap|
  4375     |clrIndex image imagePreView clr changedColor cMap|
  4448 
  4376 
  4449     img := self image.
  4377     image := self image.
  4450     imagePreView := self imagePreView.
  4378     imagePreView := self imagePreView.
  4451 
  4379 
  4452     changedObject == self tileModeHolder ifTrue:[
  4380     changedObject == self tileModeHolder ifTrue:[
  4453         imagePreView 
  4381         imagePreView 
  4454             tileMode:(changedObject value) tileOffset:(img extent);
  4382             tileMode:(changedObject value) tileOffset:(image extent);
  4455             clear; 
  4383             clear; 
  4456             invalidate.
  4384             invalidate.
  4457         ^ self
  4385         ^ self
  4458     ].
  4386     ].
  4459     changedObject == self previewBackgroundColorHolder ifTrue:[
  4387     changedObject == self previewBackgroundColorHolder ifTrue:[
  4477             ].
  4405             ].
  4478             changedColor := changedObject at:aParameter.
  4406             changedColor := changedObject at:aParameter.
  4479             drawingColormap notNil ifTrue:[
  4407             drawingColormap notNil ifTrue:[
  4480                 drawingColormap at:clrIndex put:changedColor.
  4408                 drawingColormap at:clrIndex put:changedColor.
  4481             ].
  4409             ].
  4482             cMap := img colorMap.
  4410             cMap := image colorMap.
  4483             (cMap notNil and:[cMap isMappedPalette not and:[cMap isFixedPalette not]]) ifTrue:[
  4411             (cMap notNil and:[cMap isMappedPalette not and:[cMap isFixedPalette not]]) ifTrue:[
  4484                 img colorMap at:clrIndex put:changedColor.
  4412                 image colorMap at:clrIndex put:changedColor.
  4485                 self colorMapChanged.
  4413                 self colorMapChanged.
  4486             ].
  4414             ].
  4487             ^ self
  4415             ^ self
  4488         ].
  4416         ].
  4489         ^ self
  4417         ^ self
  4499             self updateListOfColorsAndColormapMode.
  4427             self updateListOfColorsAndColormapMode.
  4500             ^ self.
  4428             ^ self.
  4501         ].
  4429         ].
  4502         something == #image ifTrue:[
  4430         something == #image ifTrue:[
  4503             self updateAfterImageChange.
  4431             self updateAfterImageChange.
  4504             imagePreView image:img scroll:false.
  4432             imagePreView image:image scroll:false.
  4505             self updateListOfColorsAndColormapMode.
  4433             self updateListOfColorsAndColormapMode.
  4506             self tileModeHolder value ifTrue:[
  4434             self tileModeHolder value ifTrue:[
  4507                 imagePreView tileMode:true tileOffset:(img extent).
  4435                 imagePreView tileMode:true tileOffset:(image extent).
  4508             ].
  4436             ].
  4509             ^ self.
  4437             ^ self.
  4510         ].
  4438         ].
  4511         something == #subImageIn ifTrue:[
  4439         something == #subImageIn ifTrue:[
  4512             imagePreView image ~~ img ifTrue:[
  4440             imagePreView image ~~ image ifTrue:[
  4513                 self error:'internal error' mayProceed:true.
  4441                 self error:'internal error' mayProceed:true.
  4514             ].
  4442             ].
  4515             self tileModeHolder value ifTrue:[
  4443             self tileModeHolder value ifTrue:[
  4516                 imagePreView invalidate.
  4444                 imagePreView invalidate.
  4517             ] ifFalse:[
  4445             ] ifFalse:[
  4545     ].
  4473     ].
  4546 
  4474 
  4547     super update:something with:aParameter from:changedObject
  4475     super update:something with:aParameter from:changedObject
  4548 
  4476 
  4549     "Modified: / 03-02-2017 / 21:52:33 / cg"
  4477     "Modified: / 03-02-2017 / 21:52:33 / cg"
       
  4478     "Modified (format): / 16-02-2017 / 10:20:18 / cg"
  4550 !
  4479 !
  4551 
  4480 
  4552 updateAfterImageChange
  4481 updateAfterImageChange
  4553     |img|
  4482     |img|
  4554 
  4483 
  4837 
  4766 
  4838     |view focusView p transformation|
  4767     |view focusView p transformation|
  4839 
  4768 
  4840     view := anEvent view.
  4769     view := anEvent view.
  4841     view notNil ifTrue:[
  4770     view notNil ifTrue:[
       
  4771         
  4842         view == self imagePreView ifTrue:[
  4772         view == self imagePreView ifTrue:[
  4843             ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
  4773             ((anEvent isButtonPressEvent and:[ anEvent button == 1 ])
  4844             or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
  4774             or:[ anEvent isButtonMotionEvent and:[ anEvent hasButton1 ]])  ifTrue:[
  4845                 p := anEvent x @ anEvent y.
  4775                 p := anEvent x @ anEvent y.
  4846                 (transformation := view transformation) notNil ifTrue:[
  4776                 (transformation := view transformation) notNil ifTrue:[
  4866         ].
  4796         ].
  4867     ].
  4797     ].
  4868     ^ false.
  4798     ^ false.
  4869 
  4799 
  4870     "Modified: / 04-04-2011 / 13:50:09 / cg"
  4800     "Modified: / 04-04-2011 / 13:50:09 / cg"
       
  4801     "Modified (format): / 16-02-2017 / 09:54:01 / cg"
  4871 ! !
  4802 ! !
  4872 
  4803 
  4873 !ImageEditor methodsFor:'help'!
  4804 !ImageEditor methodsFor:'help'!
  4874 
  4805 
  4875 defaultInfoLabel
  4806 defaultInfoLabel
  4908         imageEditView image:nil.
  4839         imageEditView image:nil.
  4909         self clearModified.
  4840         self clearModified.
  4910         ^ self.
  4841         ^ self.
  4911     ].
  4842     ].
  4912 
  4843 
  4913 "/    (imageEditView resourceClass == aClass
       
  4914 "/    and:[ imageEditView resourceSelector == aSelector ]) ifTrue:[
       
  4915 "/        imageEditView modified ifFalse:[
       
  4916 "/            ^ self.
       
  4917 "/        ].
       
  4918 "/    ].
       
  4919 
       
  4920     (imageEditView loadFromClass:aClass andSelector:aSelector) notNil ifTrue:[
  4844     (imageEditView loadFromClass:aClass andSelector:aSelector) notNil ifTrue:[
  4921         self updateAfterImageChange.
  4845         self updateAfterImageChange.
  4922         self clearModified.
  4846         self clearModified.
  4923     ]
  4847     ]
  4924 
  4848 
  4925     "Modified: / 16.3.1999 / 21:44:41 / cg"
  4849     "Modified: / 16-03-1999 / 21:44:41 / cg"
       
  4850     "Modified (comment): / 16-02-2017 / 10:22:51 / cg"
  4926 !
  4851 !
  4927 
  4852 
  4928 loadFromFile:aFileName
  4853 loadFromFile:aFileName
  4929     "loads an image from aFileName and sets up color map list and other info labels"
  4854     "loads an image from aFileName and sets up color map list and other info labels"
  4930 
  4855 
  4948 
  4873 
  4949     imageEditView image:img.
  4874     imageEditView image:img.
  4950     imageEditView clearModified.
  4875     imageEditView clearModified.
  4951 
  4876 
  4952     self updateAfterImageChange.
  4877     self updateAfterImageChange.
  4953 "/    img notNil ifTrue:[    
  4878 
  4954 "/        self updateColorsFromImage:img.
  4879     "Modified: / 16-03-1999 / 21:43:56 / cg"
  4955 "/        self findColorMapMode.
  4880     "Modified (comment): / 16-02-2017 / 10:21:47 / cg"
  4956 "/        self updateLabelsAndHistory.
       
  4957 "/    ] ifFalse:[
       
  4958 "/        self updateForNoImage
       
  4959 "/    ]
       
  4960 
       
  4961     "Modified: / 16.3.1999 / 21:43:56 / cg"
       
  4962 !
  4881 !
  4963 
  4882 
  4964 loadFromOrPrepareForClass: aClass andSelector: aSelector
  4883 loadFromOrPrepareForClass: aClass andSelector: aSelector
  4965     "loads an image by evaluating aMessage;
  4884     "loads an image by evaluating aMessage;
  4966      if no image could extract from aMessage; do set the class and the selector from 
  4885      if no image could extract from aMessage; do set the class and the selector from 
  5012 
  4931 
  5013 canSprayHolder
  4932 canSprayHolder
  5014     ^ self imageIsLoadedAndNotReadonlyHolder
  4933     ^ self imageIsLoadedAndNotReadonlyHolder
  5015 
  4934 
  5016     "Created: / 16-02-2017 / 01:44:47 / cg"
  4935     "Created: / 16-02-2017 / 01:44:47 / cg"
       
  4936 !
       
  4937 
       
  4938 imageIsLoadedAndAllowedToFlipHolder
       
  4939     ^ self imageIsLoadedAndNotReadonlyHolder
       
  4940 
       
  4941     "Created: / 16-02-2017 / 01:57:02 / cg"
  5017 ! !
  4942 ! !
  5018 
  4943 
  5019 !ImageEditor methodsFor:'menu item visibility'!
  4944 !ImageEditor methodsFor:'menu item visibility'!
  5020 
  4945 
  5021 isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
  4946 isNotStandAloneAndMethodSaveAndLoadMenuItemsVisible
  5170     |img|
  5095     |img|
  5171 
  5096 
  5172     img := imageEditView image.
  5097     img := imageEditView image.
  5173     imageEditView image:img.
  5098     imageEditView image:img.
  5174     self fetchImageData.
  5099     self fetchImageData.
       
  5100     self imageIsLoadedHolder changed.
       
  5101 
       
  5102     "Modified: / 16-02-2017 / 12:18:08 / cg"
  5175 !
  5103 !
  5176 
  5104 
  5177 updateImagePreView
  5105 updateImagePreView
  5178     self tileModeHolder value ifTrue:[
  5106     self tileModeHolder value ifTrue:[
  5179         self imagePreView tileMode:true tileOffset:(self image extent).
  5107         self imagePreView tileMode:true tileOffset:(self image extent).
  5333 addColorToColormap
  5261 addColorToColormap
  5334     self addColorToColormap:(Color black)
  5262     self addColorToColormap:(Color black)
  5335 !
  5263 !
  5336 
  5264 
  5337 addColorToColormap:newColor
  5265 addColorToColormap:newColor
       
  5266     "when editing a palette image, the new color is added to the images colorMap
       
  5267      (unless it is full).
       
  5268      when editing a true-color image, it is added to my own list-of-colors,
       
  5269      which only holds drawing colors, but is not the colormap's image"
       
  5270      
  5338     |depth img cMap newColorMap newImage oldCListSize newMode listOfColors|
  5271     |depth img cMap newColorMap newImage oldCListSize newMode listOfColors|
  5339 
  5272 
  5340     img := self image.
  5273     img := self image.
  5341     img isNil ifTrue:[
  5274     img isNil ifTrue:[
  5342         self warn:'No Image.'.
  5275         self warn:'No Image.'.
  5355         self selectedColors value:{drawingColormap size}.
  5288         self selectedColors value:{drawingColormap size}.
  5356         "/ self warn:'Image has no colormap.\Change colorMap mode first.' withCRs.
  5289         "/ self warn:'Image has no colormap.\Change colorMap mode first.' withCRs.
  5357         ^ self
  5290         ^ self
  5358     ].
  5291     ].
  5359 
  5292 
  5360     ("(depth == 1)" false
  5293     (cMap size == (1 bitShift:depth)) ifTrue:[
  5361     or:[cMap size == (1 bitShift:depth)]) ifTrue:[
       
  5362         depth >= 8 ifTrue:[
  5294         depth >= 8 ifTrue:[
  5363             self warn:'No space for more colors in colormap.'.
  5295             self warn:'No space for more colors in colormap.'.
  5364             ^ self
  5296             ^ self
  5365         ].
  5297         ].
  5366         (self confirm:(resources stringWithCRs:'No space for more colors in colormap.\Change depth ?'))
  5298         (self confirm:(resources stringWithCRs:'No space for more colors in colormap.\Change depth ?'))
  5384     oldCListSize := listOfColors size.
  5316     oldCListSize := listOfColors size.
  5385 
  5317 
  5386     newColorMap := cMap copyWith:newColor.
  5318     newColorMap := cMap copyWith:newColor.
  5387 
  5319 
  5388     newImage := img species new
  5320     newImage := img species new
  5389                     width:img width
  5321                     width:(img width) height:(img height) depth:depth
  5390                     height:img height
       
  5391                     depth:depth
       
  5392                     fromArray:img bits.
  5322                     fromArray:img bits.
  5393 
  5323 
  5394     newImage colorMap:newColorMap.  
  5324     newImage colorMap:newColorMap.  
  5395     newImage fileName:img fileName.
  5325     newImage fileName:img fileName.
  5396     newImage mask:(img mask copy).
  5326     newImage mask:(img mask copy).
  5405         self selectedColors value:{listOfColors size}.
  5335         self selectedColors value:{listOfColors size}.
  5406         self updateLabelsAndHistory.
  5336         self updateLabelsAndHistory.
  5407     ]
  5337     ]
  5408 
  5338 
  5409     "Created: / 12-03-1999 / 00:20:28 / cg"
  5339     "Created: / 12-03-1999 / 00:20:28 / cg"
  5410     "Modified: / 03-02-2017 / 21:42:18 / cg"
  5340     "Modified: / 16-02-2017 / 10:17:25 / cg"
  5411 !
  5341 !
  5412 
  5342 
  5413 changeHLS
  5343 changeHLS
  5414     "interactive Hue/Light/Saturation editing"
  5344     "interactive Hue/Light/Saturation editing"
  5415 
  5345 
  5719     "Created: / 7.8.1998 / 22:26:10 / cg"
  5649     "Created: / 7.8.1998 / 22:26:10 / cg"
  5720     "Modified: / 18.8.1998 / 17:08:55 / cg"
  5650     "Modified: / 18.8.1998 / 17:08:55 / cg"
  5721 !
  5651 !
  5722 
  5652 
  5723 colorMapMode:aMode
  5653 colorMapMode:aMode
  5724     "calculates a new color map for the image from aMode"
  5654     "calculates a new color map for the image from aMode.
       
  5655      This might involve the computation of a colormap 
       
  5656      (if depth is smaller)"
  5725 
  5657 
  5726     |depth numColors newColorMap newImage 
  5658     |depth numColors newColorMap newImage 
  5727      oldImage image newColors realColorMap oldFileName
  5659      oldImage image newColors realColorMap oldFileName
  5728      usedColors useNearest usageCounts tmpBits tmpMap quest
  5660      usedColors useNearest usageCounts tmpBits tmpMap quest
  5729      prevMode maskThreshold maskImage| 
  5661      prevMode maskThreshold maskImage| 
  5757             ] ifFalse:[
  5689             ] ifFalse:[
  5758                 quest := 'Keep colormap (or use standard)'
  5690                 quest := 'Keep colormap (or use standard)'
  5759             ]
  5691             ]
  5760         ].
  5692         ].
  5761         ((prevMode = aMode)
  5693         ((prevMode = aMode)
  5762         or:[depth > oldImage depth
  5694           or:[depth > oldImage depth
  5763         or:[self confirm:(resources string:quest)]]) ifTrue:[
  5695           or:[true "self confirm:(resources string:quest)"]]
       
  5696         ) ifTrue:[
  5764             (newColorMap isOrderedCollection or:[newColorMap isFixedPalette not]) ifTrue:[
  5697             (newColorMap isOrderedCollection or:[newColorMap isFixedPalette not]) ifTrue:[
  5765 
  5698 
  5766                 "/ keep the colormap
  5699                 "/ keep the colormap
  5767                 "/ newColorMap atAllPut:Color black.
  5700                 "/ newColorMap atAllPut:Color black.
  5768                 depth > oldImage depth ifTrue:[
  5701                 depth > oldImage depth ifTrue:[
  5852         imageEditView makeUndo.
  5785         imageEditView makeUndo.
  5853 
  5786 
  5854         newImage := Image newForDepth:depth.
  5787         newImage := Image newForDepth:depth.
  5855         newImage depth:depth.
  5788         newImage depth:depth.
  5856         depth >= 16 ifTrue:[
  5789         depth >= 16 ifTrue:[
       
  5790             newImage colorMap:nil. 
  5857             depth == 32 ifTrue:[
  5791             depth == 32 ifTrue:[
  5858                 newImage colorMap:nil.
  5792                 newImage samplesPerPixel:4; photometric:#rgba.
  5859                 newImage samplesPerPixel:4.
       
  5860                 newImage photometric:#rgba.
       
  5861             ] ifFalse:[    
  5793             ] ifFalse:[    
  5862                 newImage colorMap:nil.
  5794                 newImage samplesPerPixel:3; photometric:#rgb.
  5863                 newImage samplesPerPixel:3.
       
  5864                 newImage photometric:#rgb.
       
  5865             ].    
  5795             ].    
  5866         ].    
  5796         ].   
  5867 "/        newImage photometric:oldImage photometric.
  5797         "/ newImage photometric:oldImage photometric.
  5868 
  5798 
  5869         oldFileName := oldImage fileName.
  5799         oldFileName := oldImage fileName.
  5870 
  5800 
  5871         Image imageErrorSignal handle:[:ex|
  5801         Image imageErrorSignal handle:[:ex|
  5872             "/ arrive here only if not all colors can be represented;
  5802             "/ arrive here only if not all colors can be represented;
  5922                 ] ifFalse:[
  5852                 ] ifFalse:[
  5923                     maskImage := ImageMask extent:image extent.
  5853                     maskImage := ImageMask extent:image extent.
  5924                     maskImage bits:(ByteArray 
  5854                     maskImage bits:(ByteArray 
  5925                                         new:(maskImage bytesPerRow * maskImage height)
  5855                                         new:(maskImage bytesPerRow * maskImage height)
  5926                                         withAll:16rFF).
  5856                                         withAll:16rFF).
  5927 
       
  5928 "/                    maskImage fillRectangle:(image bounds) withColor:(Color colorId:1).
       
  5929                 ].
  5857                 ].
  5930                 image mask:maskImage.
  5858                 image mask:maskImage.
  5931             ].
  5859             ].
  5932         ] ifFalse:[ 
  5860         ] ifFalse:[ 
  5933             image mask: nil.
  5861             image mask: nil.
  5957         (imageEditView image: image) notNil ifTrue:[
  5885         (imageEditView image: image) notNil ifTrue:[
  5958             self fetchImageData.
  5886             self fetchImageData.
  5959         ]
  5887         ]
  5960     ]
  5888     ]
  5961 
  5889 
  5962     "Modified: / 22-11-2016 / 03:44:00 / cg"
  5890     "Modified (format): / 16-02-2017 / 10:24:41 / cg"
  5963 !
  5891 !
  5964 
  5892 
  5965 colorize
  5893 colorize
  5966     "interactive Hue editing"
  5894     "interactive Hue editing"
  5967 
  5895 
  7366     img := self image.
  7294     img := self image.
  7367     img notNil ifTrue: [
  7295     img notNil ifTrue: [
  7368         file := img fileName
  7296         file := img fileName
  7369     ].
  7297     ].
  7370 
  7298 
  7371     title := (resources string:'Load Image From').
  7299     title := (resources string:'Load Image from File:').
  7372 
  7300 
  7373     (UserPreferences current useNativeFileDialog
  7301     (UserPreferences current useNativeFileDialog
  7374      and:[Screen current isWindowsPlatform]) ifTrue:[
  7302      and:[Screen current isWindowsPlatform]) ifTrue:[
  7375         self withWaitCursorDo:[
  7303         self withWaitCursorDo:[
  7376             file := Screen current
  7304             file := Screen current
  7406     file notNil ifTrue:[
  7334     file notNil ifTrue:[
  7407         LastDirectory := file asFilename directoryName.
  7335         LastDirectory := file asFilename directoryName.
  7408         self loadFromFile:file
  7336         self loadFromFile:file
  7409     ]
  7337     ]
  7410 
  7338 
  7411     "Modified: / 14-12-2010 / 13:52:11 / cg"
  7339     "Modified: / 16-02-2017 / 10:53:41 / cg"
  7412 !
  7340 !
  7413 
  7341 
  7414 doLoadFromURL
  7342 doLoadFromURL
  7415     "opens a dialog for loading an image from a URL"
  7343     "opens a dialog for loading an image from a URL"
  7416 
  7344 
  7417     |tempFile url response|
  7345     |tempFile url response|
  7418 
  7346 
  7419     self checkModified ifFalse:[ ^ self ].
  7347     self checkModified ifFalse:[ ^ self ].
  7420 
  7348 
  7421     url := Dialog 
  7349     url := Dialog 
  7422                 request:(resources string:'Load Image from URL')
  7350                 request:(resources string:'Load Image from URL:')
  7423                 initialAnswer:LastURL.
  7351                 initialAnswer:LastURL.
  7424 
  7352 
  7425     url notEmptyOrNil ifTrue:[
  7353     url notEmptyOrNil ifTrue:[
  7426         HTTPInterface isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/communication'].
  7354         HTTPInterface isNil ifTrue:[ Smalltalk loadPackage:'stx:goodies/communication'].
  7427 
  7355 
  7437         ].
  7365         ].
  7438         tempFile delete
  7366         tempFile delete
  7439     ]
  7367     ]
  7440 
  7368 
  7441     "Created: / 20-09-2010 / 11:30:59 / cg"
  7369     "Created: / 20-09-2010 / 11:30:59 / cg"
       
  7370     "Modified: / 16-02-2017 / 10:51:18 / cg"
  7442 !
  7371 !
  7443 
  7372 
  7444 doNewImage
  7373 doNewImage
  7445     "opens a dialog with choices of size and color map for creating a new image"
  7374     "opens a dialog with choices of size and color map for creating a new image"
  7446 
  7375 
  7545     ].
  7474     ].
  7546     newImage := image copy.
  7475     newImage := image copy.
  7547     newImage mask:mask.
  7476     newImage mask:mask.
  7548     imageEditView newImageWithUndo:newImage.
  7477     imageEditView newImageWithUndo:newImage.
  7549     self updateAfterImageChange.
  7478     self updateAfterImageChange.
  7550 "/    self updateColorsFromImage:image.
  7479 
  7551 "/    self findColorMapMode.
  7480     "Modified (comment): / 16-02-2017 / 10:22:19 / cg"
  7552 "/    self updateLabelsAndHistory.
       
  7553 !
  7481 !
  7554 
  7482 
  7555 grabScreenImage
  7483 grabScreenImage
  7556     "let user choose an area and grab that are for editing"
  7484     "let user choose an area and grab that are for editing"
  7557 
  7485 
  7675         self withWaitCursorDo:[
  7603         self withWaitCursorDo:[
  7676             "/ windows only
  7604             "/ windows only
  7677             file := Screen current
  7605             file := Screen current
  7678                 nativeFileDialogFor:(self window topView id)
  7606                 nativeFileDialogFor:(self window topView id)
  7679                 save:true
  7607                 save:true
  7680                 title:(resources string:'Save Image To')
  7608                 title:(resources string:'Save Image in File')
  7681                 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
  7609                 inDirectory:(file notNil ifTrue:[file asFilename directory pathName] ifFalse:[LastDirectory])
  7682                 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
  7610                 initialAnswer:(file notNil ifTrue:[file asFilename baseName] ifFalse:['image.png'])
  7683                 "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
  7611                 "/ flags:#( ENABLESIZING "HIDEREADONLY" EXPLORER NOCHANGEDIR)
  7684                 filter:
  7612                 filter:
  7685                   {
  7613                   {
  7708                             request:'Save Image To'
  7636                             request:'Save Image To'
  7709                             fileName:file
  7637                             fileName:file
  7710                             withFileFilters:filters.
  7638                             withFileFilters:filters.
  7711             ] ifFalse:[
  7639             ] ifFalse:[
  7712                 file := FileSelectionBrowser
  7640                 file := FileSelectionBrowser
  7713                             request:'Save Image To'
  7641                             request:'Save Image in File:'
  7714                             inDirectory:LastDirectory
  7642                             inDirectory:LastDirectory
  7715                             withFileFilters:filters.
  7643                             withFileFilters:filters.
  7716             ].
  7644             ].
  7717         ].
  7645         ].
  7718     ].
  7646     ].
  7721         LastDirectory := file asFilename directoryName.
  7649         LastDirectory := file asFilename directoryName.
  7722         self updateLabelsAndHistory.
  7650         self updateLabelsAndHistory.
  7723         self clearModifiedAndRememberImageSavedAsFile:file.
  7651         self clearModifiedAndRememberImageSavedAsFile:file.
  7724     ]
  7652     ]
  7725 
  7653 
  7726     "Modified: / 14-12-2010 / 13:51:47 / cg"
  7654     "Modified: / 16-02-2017 / 10:52:56 / cg"
  7727 !
  7655 !
  7728 
  7656 
  7729 doSaveImageMaskFileAs
  7657 doSaveImageMaskFileAs
  7730     "opens a dialog for saving mask of current image to a file"
  7658     "opens a dialog for saving mask of current image to a file"
  7731 
  7659