ImageEditor.st
changeset 3417 4960f19dca36
parent 3416 9d51a45479e3
child 3418 8d56341c2706
equal deleted inserted replaced
3416:9d51a45479e3 3417:4960f19dca36
   289 
   289 
   290     <resource: #help>
   290     <resource: #help>
   291 
   291 
   292     ^ #(
   292     ^ #(
   293 
   293 
       
   294 #autoCropAll
       
   295 'Find and remove all borders'
       
   296 
       
   297 #autoCropBottom
       
   298 'Find and remove bottom border'
       
   299 
       
   300 #autoCropLeft
       
   301 'Find and remove left border'
       
   302 
       
   303 #autoCropRight
       
   304 'Find and remove right border'
       
   305 
       
   306 #autoCropTop
       
   307 'Find and remove top border'
       
   308 
   294 #colorMap
   309 #colorMap
   295 'ColorMap functions'
   310 'ColorMap functions'
   296 
   311 
   297 #colorMap1
   312 #colorMap1
   298 'Convert to depth-1 image'
   313 'Convert to depth-1 image'
   329 
   344 
   330 #compressColormap
   345 #compressColormap
   331 'Remove unneeded entries from the colorMap'
   346 'Remove unneeded entries from the colorMap'
   332 
   347 
   333 #cropAll
   348 #cropAll
   334 'Find and remove all borders'
   349 'Crop (cut off) all four sides by the amounts entered into the above fields.'
   335 
   350 
   336 #cropBottom
   351 #cropBottom
   337 'Find and remove bottom border'
   352 'Cut off the specified number of pixels at the bottom'
       
   353 
       
   354 #cropBySelectingArea
       
   355 'Select new area in the right detail view.'
   338 
   356 
   339 #cropLeft
   357 #cropLeft
   340 'Find and remove left border'
   358 'Cut off the specified number of pixels at the left'
   341 
   359 
   342 #cropManual
   360 #cropManual
   343 'Specify border(s) to remove.'
   361 'Specify border(s) to remove.'
   344 
   362 
   345 #cropRight
   363 #cropRight
   346 'Find and remove right border'
   364 'Cut off the specified number of pixels at the right'
   347 
   365 
   348 #cropTop
   366 #cropTop
   349 'Find and remove top border'
   367 'Cut off the specified number of pixels at the top'
       
   368 
       
   369 #cropubImage
       
   370 'Select a subarea as the image''s new dimension'
   350 
   371 
   351 #drawModeBox
   372 #drawModeBox
   352 'Rectangle Drawing Mode'
   373 'Rectangle Drawing Mode'
   353 
   374 
   354 #drawModeCircle
   375 #drawModeCircle
   437 
   458 
   438 #fileNewMaskFromClipboard
   459 #fileNewMaskFromClipboard
   439 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
   460 'Paste the image in the clipboard as a mask. Must be a depth-1 image'
   440 
   461 
   441 #filePrint
   462 #filePrint
       
   463 'Print the image on a postscript printer'
       
   464 
       
   465 #filePrint
   442 'Print'
   466 'Print'
   443 
       
   444 #filePrint
       
   445 'Print the image on a postscript printer'
       
   446 
   467 
   447 #fileSave
   468 #fileSave
   448 'Save the image'
   469 'Save the image'
   449 
   470 
   450 #fileSaveAs
   471 #fileSaveAs
   463 'Save the image as resource method in a class'
   484 'Save the image as resource method in a class'
   464 
   485 
   465 #floodFillMaxError
   486 #floodFillMaxError
   466 'Specify the max. allowed deviation from the clicked pixel in a flood-fill operation.\Pixels where the hue/light values differ less than that fraction\will be included in the fill.\The range must be between 0 and 1. With 0, only areas with exactly the same pixel will be filled.\With 1, every other pixel is included.\\When filling gradiented areas, start with small values, such as 0.05, and increase slowly.'
   487 'Specify the max. allowed deviation from the clicked pixel in a flood-fill operation.\Pixels where the hue/light values differ less than that fraction\will be included in the fill.\The range must be between 0 and 1. With 0, only areas with exactly the same pixel will be filled.\With 1, every other pixel is included.\\When filling gradiented areas, start with small values, such as 0.05, and increase slowly.'
   467 
   488 
   468 #cropAll
       
   469 'Crop (cut off) all four sides by the amounts entered into the above fields.'
       
   470 
       
   471 #cropBottom
       
   472 'Cut off the specified number of pixels at the bottom'
       
   473 
       
   474 #cropLeft
       
   475 'Cut off the specified number of pixels at the left'
       
   476 
       
   477 #cropRight
       
   478 'Cut off the specified number of pixels at the right'
       
   479 
       
   480 #cropTop
       
   481 'Cut off the specified number of pixels at the top'
       
   482 
       
   483 #magnificationNumber
   489 #magnificationNumber
   484 'Shows the current magnification'
   490 'Shows the current magnification'
   485 
   491 
   486 #magnifyImageDown
   492 #magnifyImageDown
   487 'Decrease magnification'
   493 'Decrease magnification'
   552 #xfileSaveMethodAs
   558 #xfileSaveMethodAs
   553 'Save as Method...'
   559 'Save as Method...'
   554 
   560 
   555 )
   561 )
   556 
   562 
   557     "Modified: / 19-02-2017 / 15:10:03 / cg"
   563     "Modified: / 20-02-2017 / 18:07:43 / cg"
   558 !
   564 !
   559 
   565 
   560 helpSpec
   566 helpSpec
   561     "This resource specification was automatically generated
   567     "This resource specification was automatically generated
   562      by the UIHelpTool of ST/X."
   568      by the UIHelpTool of ST/X."
   637                             bits:(ByteArray 
   643                             bits:(ByteArray 
   638                                         fromPackedString:'@@C? O>@??3??O?<??3??O?<??3??@_<A?0@@@@a');
   644                                         fromPackedString:'@@C? O>@??3??O?<??3??O?<??3??@_<A?0@@@@a');
   639                             yourself);
   645                             yourself);
   640                 yourself
   646                 yourself
   641         ]
   647         ]
       
   648 !
       
   649 
       
   650 cropSubImageIcon
       
   651     "This resource specification was automatically generated
       
   652      by the ImageEditor of ST/X."
       
   653 
       
   654     "Do not manually edit this!! If it is corrupted,
       
   655      the ImageEditor may not be able to read the specification."
       
   656 
       
   657     "
       
   658      self cropSubImageIcon inspect
       
   659      ImageEditor openOnClass:self andSelector:#cropSubImageIcon
       
   660      Icon flushCachedIcons
       
   661     "
       
   662 
       
   663     <resource: #image>
       
   664 
       
   665     ^Icon
       
   666         constantNamed:'ImageEditor class cropSubImageIcon'
       
   667         ifAbsentPut:[(Depth2Image width:14 height:14) bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@J**@@BUU @@%UX@@IUV@@BUU @@%UX@@J**@@@@@@@@@@@@@@@@@@b')
       
   668             colorMapFromArray:#[0 0 0 255 255 255 127 127 127 0 255 0]
       
   669             mask:((ImageMask width:14 height:14) bits:(ByteArray fromPackedString:'??2@AH@D OR_=I?4''?R_9K?$/>R?9K0D @S??@@a'); yourself); yourself]
   642 !
   670 !
   643 
   671 
   644 defaultIcon
   672 defaultIcon
   645     <resource: #programImage>
   673     <resource: #programImage>
   646 
   674 
  1491              acceptOnPointerLeave: false
  1519              acceptOnPointerLeave: false
  1492            )
  1520            )
  1493           (ActionButtonSpec
  1521           (ActionButtonSpec
  1494              label: 'Crop Now'
  1522              label: 'Crop Now'
  1495              name: 'CropLeftNowButton'
  1523              name: 'CropLeftNowButton'
  1496              layout: (LayoutFrame 133 0 21 0 232 0 50 0)
  1524              layout: (LayoutFrame 133 0 21 0 229 0 50 0)
  1497              activeHelpKey: cropLeft
  1525              activeHelpKey: cropLeft
  1498              translateLabel: true
  1526              translateLabel: true
  1499              resizeForLabel: true
  1527              resizeForLabel: true
  1500              tabable: true
  1528              tabable: true
  1501              model: cropLeftNow
  1529              model: cropLeftNow
       
  1530              autoRepeat: true
       
  1531              usePreferredWidth: true
       
  1532            )
       
  1533           (ActionButtonSpec
       
  1534              label: 'Auto'
       
  1535              name: 'Button6'
       
  1536              layout: (LayoutFrame 236 0 21 0 289 0 50 0)
       
  1537              activeHelpKey: autoCropLeft
       
  1538              translateLabel: true
       
  1539              resizeForLabel: true
       
  1540              tabable: true
       
  1541              model: autoCropLeft
  1502              autoRepeat: true
  1542              autoRepeat: true
  1503              usePreferredWidth: true
  1543              usePreferredWidth: true
  1504            )
  1544            )
  1505           (LabelSpec
  1545           (LabelSpec
  1506              label: 'Right:'
  1546              label: 'Right:'
  1521              acceptOnPointerLeave: false
  1561              acceptOnPointerLeave: false
  1522            )
  1562            )
  1523           (ActionButtonSpec
  1563           (ActionButtonSpec
  1524              label: 'Crop Now'
  1564              label: 'Crop Now'
  1525              name: 'CropRightButton'
  1565              name: 'CropRightButton'
  1526              layout: (LayoutFrame 133 0 51 0 232 0 80 0)
  1566              layout: (LayoutFrame 133 0 51 0 229 0 80 0)
  1527              activeHelpKey: cropRight
  1567              activeHelpKey: cropRight
  1528              translateLabel: true
  1568              translateLabel: true
  1529              resizeForLabel: true
  1569              resizeForLabel: true
  1530              tabable: true
  1570              tabable: true
  1531              model: cropRightNow
  1571              model: cropRightNow
       
  1572              autoRepeat: true
       
  1573              usePreferredWidth: true
       
  1574            )
       
  1575           (ActionButtonSpec
       
  1576              label: 'Auto'
       
  1577              name: 'Button7'
       
  1578              layout: (LayoutFrame 236 0 51 0 289 0 80 0)
       
  1579              activeHelpKey: autoCropRight
       
  1580              translateLabel: true
       
  1581              resizeForLabel: true
       
  1582              tabable: true
       
  1583              model: autoCropRight
  1532              autoRepeat: true
  1584              autoRepeat: true
  1533              usePreferredWidth: true
  1585              usePreferredWidth: true
  1534            )
  1586            )
  1535           (LabelSpec
  1587           (LabelSpec
  1536              label: 'Top:'
  1588              label: 'Top:'
  1551              acceptOnPointerLeave: false
  1603              acceptOnPointerLeave: false
  1552            )
  1604            )
  1553           (ActionButtonSpec
  1605           (ActionButtonSpec
  1554              label: 'Crop Now'
  1606              label: 'Crop Now'
  1555              name: 'CropTopButton'
  1607              name: 'CropTopButton'
  1556              layout: (LayoutFrame 133 0 81 0 232 0 110 0)
  1608              layout: (LayoutFrame 133 0 81 0 229 0 110 0)
  1557              activeHelpKey: cropTop
  1609              activeHelpKey: cropTop
  1558              translateLabel: true
  1610              translateLabel: true
  1559              resizeForLabel: true
  1611              resizeForLabel: true
  1560              tabable: true
  1612              tabable: true
  1561              model: cropTopNow
  1613              model: cropTopNow
       
  1614              autoRepeat: true
       
  1615              usePreferredWidth: true
       
  1616            )
       
  1617           (ActionButtonSpec
       
  1618              label: 'Auto'
       
  1619              name: 'Button8'
       
  1620              layout: (LayoutFrame 236 0 81 0 289 0 110 0)
       
  1621              activeHelpKey: autoCropTop
       
  1622              translateLabel: true
       
  1623              resizeForLabel: true
       
  1624              tabable: true
       
  1625              model: autoCropTop
  1562              autoRepeat: true
  1626              autoRepeat: true
  1563              usePreferredWidth: true
  1627              usePreferredWidth: true
  1564            )
  1628            )
  1565           (LabelSpec
  1629           (LabelSpec
  1566              label: 'Bottom:'
  1630              label: 'Bottom:'
  1581              acceptOnPointerLeave: false
  1645              acceptOnPointerLeave: false
  1582            )
  1646            )
  1583           (ActionButtonSpec
  1647           (ActionButtonSpec
  1584              label: 'Crop Now'
  1648              label: 'Crop Now'
  1585              name: 'CropBottomButton'
  1649              name: 'CropBottomButton'
  1586              layout: (LayoutFrame 133 0 111 0 232 0 140 0)
  1650              layout: (LayoutFrame 133 0 111 0 229 0 140 0)
  1587              activeHelpKey: cropBottom
  1651              activeHelpKey: cropBottom
  1588              translateLabel: true
  1652              translateLabel: true
  1589              resizeForLabel: true
  1653              resizeForLabel: true
  1590              tabable: true
  1654              tabable: true
  1591              model: cropBottomNow
  1655              model: cropBottomNow
  1592              autoRepeat: true
  1656              autoRepeat: true
  1593              usePreferredWidth: true
  1657              usePreferredWidth: true
  1594            )
  1658            )
  1595           (ActionButtonSpec
  1659           (ActionButtonSpec
  1596              label: 'Crop All'
  1660              label: 'Auto'
       
  1661              name: 'Button9'
       
  1662              layout: (LayoutFrame 236 0 111 0 289 0 140 0)
       
  1663              activeHelpKey: autoCropBottom
       
  1664              translateLabel: true
       
  1665              resizeForLabel: true
       
  1666              tabable: true
       
  1667              model: autoCropBottom
       
  1668              autoRepeat: true
       
  1669              usePreferredWidth: true
       
  1670            )
       
  1671           (ActionButtonSpec
       
  1672              label: 'All'
  1597              name: 'Button4'
  1673              name: 'Button4'
  1598              layout: (LayoutFrame 133 0 148 0 268 0 176 0)
  1674              layout: (LayoutFrame 133 0 148 0 229 0 176 0)
  1599              activeHelpKey: cropAll
  1675              activeHelpKey: cropAll
  1600              translateLabel: true
  1676              translateLabel: true
  1601              resizeForLabel: true
  1677              resizeForLabel: true
  1602              tabable: true
  1678              tabable: true
  1603              model: applyCropAction
  1679              model: applyCropAction
  1642                    extent: (Point 116 28)
  1718                    extent: (Point 116 28)
  1643                  )
  1719                  )
  1644                 )
  1720                 )
  1645               
  1721               
  1646              )
  1722              )
       
  1723            )
       
  1724           (ActionButtonSpec
       
  1725              label: 'All'
       
  1726              name: 'Button10'
       
  1727              layout: (LayoutFrame 236 0 148 0 289 0 176 0)
       
  1728              activeHelpKey: autoCropAll
       
  1729              translateLabel: true
       
  1730              resizeForLabel: true
       
  1731              tabable: true
       
  1732              model: autoCropAll
  1647            )
  1733            )
  1648           )
  1734           )
  1649         
  1735         
  1650        )
  1736        )
  1651      )
  1737      )
  3011                (MenuItem
  3097                (MenuItem
  3012                   label: '-'
  3098                   label: '-'
  3013                   isVisible: false
  3099                   isVisible: false
  3014                 )
  3100                 )
  3015                (MenuItem
  3101                (MenuItem
  3016                   activeHelpKey: cropAll
  3102                   activeHelpKey: autoCropAll
  3017                   label: 'All'
  3103                   label: 'All'
  3018                   itemValue: doCropAll
  3104                   itemValue: autoCropAll
  3019                 )
  3105                 )
  3020                (MenuItem
  3106                (MenuItem
  3021                   label: '-'
  3107                   label: '-'
  3022                 )
  3108                 )
  3023                (MenuItem
  3109                (MenuItem
  3024                   activeHelpKey: cropLeft
  3110                   activeHelpKey: autoCropLeft
  3025                   label: 'Left'
  3111                   label: 'Left'
  3026                   itemValue: doCropLeft
  3112                   itemValue: autoCropLeft
  3027                 )
  3113                 )
  3028                (MenuItem
  3114                (MenuItem
  3029                   activeHelpKey: cropRight
  3115                   activeHelpKey: autoCropRight
  3030                   label: 'Right'
  3116                   label: 'Right'
  3031                   itemValue: doCropRight
  3117                   itemValue: autoCropRight
  3032                 )
  3118                 )
  3033                (MenuItem
  3119                (MenuItem
  3034                   activeHelpKey: cropTop
  3120                   activeHelpKey: autoCropTop
  3035                   label: 'Top'
  3121                   label: 'Top'
  3036                   itemValue: doCropTop
  3122                   itemValue: autoCropTop
  3037                 )
  3123                 )
  3038                (MenuItem
  3124                (MenuItem
  3039                   activeHelpKey: cropBottom
  3125                   activeHelpKey: autoCropBottom
  3040                   label: 'Bottom'
  3126                   label: 'Bottom'
  3041                   itemValue: doCropBottom
  3127                   itemValue: autoCropBottom
  3042                 )
  3128                 )
  3043                )
  3129                )
  3044               nil
  3130               nil
  3045               nil
  3131               nil
  3046             )
  3132             )
  3105           )
  3191           )
  3106          )
  3192          )
  3107         nil
  3193         nil
  3108         nil
  3194         nil
  3109       )
  3195       )
       
  3196 
       
  3197     "Modified: / 20-02-2017 / 18:05:19 / cg"
  3110 !
  3198 !
  3111 
  3199 
  3112 menuFile
  3200 menuFile
  3113     "This resource specification was automatically generated
  3201     "This resource specification was automatically generated
  3114      by the MenuEditor of ST/X."
  3202      by the MenuEditor of ST/X."
  7021     "Created: / 30.9.1998 / 23:51:23 / cg"
  7109     "Created: / 30.9.1998 / 23:51:23 / cg"
  7022 ! !
  7110 ! !
  7023 
  7111 
  7024 !ImageEditor methodsFor:'user actions-editing'!
  7112 !ImageEditor methodsFor:'user actions-editing'!
  7025 
  7113 
       
  7114 autoCropAll
       
  7115     "find all borders and cut them off"
       
  7116 
       
  7117     imageEditView autoCropLeft:true right:true top:true bottom:true.   
       
  7118     self updateInfoLabel
       
  7119 
       
  7120     "Created: / 20-02-2017 / 18:05:38 / cg"
       
  7121 !
       
  7122 
       
  7123 autoCropBottom
       
  7124     "find a bottom border and cut it off"
       
  7125 
       
  7126     imageEditView autoCropLeft:false right:false top:false bottom:true.   
       
  7127     self updateInfoLabel
       
  7128 
       
  7129     "Created: / 20-02-2017 / 18:05:45 / cg"
       
  7130 !
       
  7131 
       
  7132 autoCropLeft
       
  7133     "find a left border and cut it off"
       
  7134 
       
  7135     imageEditView autoCropLeft:true right:false top:false bottom:false.   
       
  7136     self updateInfoLabel
       
  7137 
       
  7138     "Created: / 20-02-2017 / 18:05:52 / cg"
       
  7139 !
       
  7140 
       
  7141 autoCropRight
       
  7142     "find a right border and cut it off"
       
  7143 
       
  7144     imageEditView autoCropLeft:false right:true top:false bottom:false.   
       
  7145     self updateInfoLabel
       
  7146 
       
  7147     "Created: / 20-02-2017 / 18:04:20 / cg"
       
  7148 !
       
  7149 
       
  7150 autoCropTop
       
  7151     "find a top border and cut it off"
       
  7152 
       
  7153     imageEditView autoCropLeft:false right:false top:true bottom:false.   
       
  7154     self updateInfoLabel
       
  7155 
       
  7156     "Created: / 20-02-2017 / 18:06:03 / cg"
       
  7157 !
       
  7158 
  7026 do3DProjection
  7159 do3DProjection
  7027     |box dx1 dx2 image|
  7160     |box dx1 dx2 image|
  7028 
  7161 
  7029     image := imageEditView image.
  7162     image := imageEditView image.
  7030 
  7163 
  7073     "Modified: / 31.7.1998 / 02:01:15 / cg"
  7206     "Modified: / 31.7.1998 / 02:01:15 / cg"
  7074 !
  7207 !
  7075 
  7208 
  7076 doCopyImageToClipboard
  7209 doCopyImageToClipboard
  7077     imageEditView copyImageToClipboard.
  7210     imageEditView copyImageToClipboard.
  7078 !
       
  7079 
       
  7080 doCropAll
       
  7081     "find all borders and cut them off"
       
  7082 
       
  7083     imageEditView cropLeft:true right:true top:true bottom:true.   
       
  7084     self updateInfoLabel
       
  7085 
       
  7086     "Modified: / 7.9.1998 / 14:26:23 / cg"
       
  7087     "Created: / 7.9.1998 / 16:33:43 / cg"
       
  7088 !
       
  7089 
       
  7090 doCropBottom
       
  7091     "find a bottom border and cut it off"
       
  7092 
       
  7093     imageEditView cropLeft:false right:false top:false bottom:true.   
       
  7094     self updateInfoLabel
       
  7095 
       
  7096     "Created: / 7.9.1998 / 13:00:20 / cg"
       
  7097     "Modified: / 7.9.1998 / 14:26:23 / cg"
       
  7098 !
       
  7099 
       
  7100 doCropLeft
       
  7101     "find a left border and cut it off"
       
  7102 
       
  7103     imageEditView cropLeft:true right:false top:false bottom:false.   
       
  7104     self updateInfoLabel
       
  7105 
       
  7106     "Created: / 7.9.1998 / 13:00:14 / cg"
       
  7107     "Modified: / 7.9.1998 / 14:26:34 / cg"
       
  7108 !
  7211 !
  7109 
  7212 
  7110 doCropManual
  7213 doCropManual
  7111     "let user specify borders and cut them off"
  7214     "let user specify borders and cut them off"
  7112 
  7215 
  7167         ]
  7270         ]
  7168     ].
  7271     ].
  7169 
  7272 
  7170     "Created: / 07-09-1998 / 18:16:07 / cg"
  7273     "Created: / 07-09-1998 / 18:16:07 / cg"
  7171     "Modified: / 19-02-2017 / 15:43:50 / cg"
  7274     "Modified: / 19-02-2017 / 15:43:50 / cg"
  7172 !
       
  7173 
       
  7174 doCropRight
       
  7175     "find a right border and cut it off"
       
  7176 
       
  7177     imageEditView cropLeft:false right:true top:false bottom:false.   
       
  7178     self updateInfoLabel
       
  7179 
       
  7180     "Created: / 7.9.1998 / 13:00:14 / cg"
       
  7181     "Modified: / 7.9.1998 / 14:26:44 / cg"
       
  7182 !
       
  7183 
       
  7184 doCropTop
       
  7185     "find a top border and cut it off"
       
  7186 
       
  7187     imageEditView cropLeft:false right:false top:true bottom:false.   
       
  7188     self updateInfoLabel
       
  7189 
       
  7190     "Created: / 7.9.1998 / 13:00:19 / cg"
       
  7191     "Modified: / 7.9.1998 / 14:26:52 / cg"
       
  7192 !
  7275 !
  7193 
  7276 
  7194 doDarkenImage
  7277 doDarkenImage
  7195     imageEditView darkenImage.
  7278     imageEditView darkenImage.
  7196     self listOfColors removeAll.
  7279     self listOfColors removeAll.