1631 acceptOnPointerLeave: false |
1631 acceptOnPointerLeave: false |
1632 ) |
1632 ) |
1633 (ActionButtonSpec |
1633 (ActionButtonSpec |
1634 label: 'Now' |
1634 label: 'Now' |
1635 name: 'GropLeftNowButton' |
1635 name: 'GropLeftNowButton' |
1636 layout: (LayoutFrame 148 0 21 0 221 0 50 0) |
1636 layout: (LayoutFrame 148 0 21 0 200 0 50 0) |
1637 activeHelpKey: gropLeft |
1637 activeHelpKey: gropLeft |
1638 translateLabel: true |
1638 translateLabel: true |
1639 resizeForLabel: true |
1639 resizeForLabel: true |
1640 tabable: true |
1640 tabable: true |
1641 model: gropLeftNow |
1641 model: gropLeftNow |
1661 acceptOnPointerLeave: false |
1661 acceptOnPointerLeave: false |
1662 ) |
1662 ) |
1663 (ActionButtonSpec |
1663 (ActionButtonSpec |
1664 label: 'Now' |
1664 label: 'Now' |
1665 name: 'GropRightButton' |
1665 name: 'GropRightButton' |
1666 layout: (LayoutFrame 148 0 51 0 221 0 80 0) |
1666 layout: (LayoutFrame 148 0 51 0 200 0 80 0) |
1667 activeHelpKey: gropRight |
1667 activeHelpKey: gropRight |
1668 translateLabel: true |
1668 translateLabel: true |
1669 resizeForLabel: true |
1669 resizeForLabel: true |
1670 tabable: true |
1670 tabable: true |
1671 model: gropRightNow |
1671 model: gropRightNow |
1691 acceptOnPointerLeave: false |
1691 acceptOnPointerLeave: false |
1692 ) |
1692 ) |
1693 (ActionButtonSpec |
1693 (ActionButtonSpec |
1694 label: 'Now' |
1694 label: 'Now' |
1695 name: 'GropTopButton' |
1695 name: 'GropTopButton' |
1696 layout: (LayoutFrame 148 0 81 0 221 0 110 0) |
1696 layout: (LayoutFrame 148 0 81 0 200 0 110 0) |
1697 activeHelpKey: gropTop |
1697 activeHelpKey: gropTop |
1698 translateLabel: true |
1698 translateLabel: true |
1699 resizeForLabel: true |
1699 resizeForLabel: true |
1700 tabable: true |
1700 tabable: true |
1701 model: gropTopNow |
1701 model: gropTopNow |
1721 acceptOnPointerLeave: false |
1721 acceptOnPointerLeave: false |
1722 ) |
1722 ) |
1723 (ActionButtonSpec |
1723 (ActionButtonSpec |
1724 label: 'Now' |
1724 label: 'Now' |
1725 name: 'GropBottomButton' |
1725 name: 'GropBottomButton' |
1726 layout: (LayoutFrame 148 0 111 0 221 0 140 0) |
1726 layout: (LayoutFrame 148 0 111 0 200 0 140 0) |
1727 activeHelpKey: gropBottom |
1727 activeHelpKey: gropBottom |
1728 translateLabel: true |
1728 translateLabel: true |
1729 resizeForLabel: true |
1729 resizeForLabel: true |
1730 tabable: true |
1730 tabable: true |
1731 model: gropBottomNow |
1731 model: gropBottomNow |
1732 autoRepeat: true |
1732 autoRepeat: true |
1733 usePreferredWidth: true |
1733 usePreferredWidth: true |
1734 ) |
1734 ) |
1735 (HorizontalPanelViewSpec |
1735 (HorizontalPanelViewSpec |
1736 name: 'HorizontalPanel1' |
1736 name: 'HorizontalPanel1' |
1737 layout: (LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
1737 layout: (LayoutFrame 0 0.0 -30 1 -16 1.0 0 1) |
1738 horizontalLayout: fitSpace |
1738 horizontalLayout: fitSpace |
1739 verticalLayout: center |
1739 verticalLayout: center |
1740 horizontalSpace: 3 |
1740 horizontalSpace: 3 |
1741 verticalSpace: 3 |
1741 verticalSpace: 3 |
1742 reverseOrderIfOKAtLeft: true |
1742 reverseOrderIfOKAtLeft: true |
1744 (SpecCollection |
1744 (SpecCollection |
1745 collection: ( |
1745 collection: ( |
1746 (ActionButtonSpec |
1746 (ActionButtonSpec |
1747 label: 'Cancel' |
1747 label: 'Cancel' |
1748 name: 'Button1' |
1748 name: 'Button1' |
|
1749 visibilityChannel: cropBoxIsDialog |
1749 translateLabel: true |
1750 translateLabel: true |
1750 resizeForLabel: true |
1751 resizeForLabel: true |
1751 tabable: true |
1752 tabable: true |
1752 model: cancel |
1753 model: cancel |
1753 extent: (Point 91 22) |
1754 extent: (Point 100 28) |
1754 ) |
1755 ) |
1755 (ActionButtonSpec |
1756 (ActionButtonSpec |
1756 label: 'Apply' |
1757 label: 'Apply' |
1757 name: 'Button3' |
1758 name: 'Button3' |
1758 translateLabel: true |
1759 translateLabel: true |
1759 resizeForLabel: true |
1760 resizeForLabel: true |
1760 tabable: true |
1761 tabable: true |
1761 model: applyAction |
1762 model: applyAction |
1762 extent: (Point 91 22) |
1763 extent: (Point 100 28) |
1763 ) |
1764 ) |
1764 (ActionButtonSpec |
1765 (ActionButtonSpec |
1765 label: 'OK' |
1766 label: 'OK' |
1766 name: 'Button2' |
1767 name: 'Button2' |
|
1768 visibilityChannel: cropBoxIsDialog |
1767 translateLabel: true |
1769 translateLabel: true |
1768 resizeForLabel: true |
1770 resizeForLabel: true |
1769 tabable: true |
1771 tabable: true |
1770 model: accept |
1772 model: accept |
1771 extent: (Point 92 22) |
1773 extent: (Point 100 28) |
1772 ) |
1774 ) |
1773 ) |
1775 ) |
1774 |
1776 |
1775 ) |
1777 ) |
1776 keepSpaceForOSXResizeHandleH: true |
1778 keepSpaceForOSXResizeHandleH: true |
2175 snapMode: both |
2177 snapMode: both |
2176 component: |
2178 component: |
2177 (SpecCollection |
2179 (SpecCollection |
2178 collection: ( |
2180 collection: ( |
2179 (ViewSpec |
2181 (ViewSpec |
2180 name: 'View1' |
2182 name: 'ColorBox' |
2181 component: |
2183 component: |
2182 (SpecCollection |
2184 (SpecCollection |
2183 collection: ( |
2185 collection: ( |
2184 (MenuPanelSpec |
2186 (MenuPanelSpec |
2185 name: 'MouseButtonColorToolBar' |
2187 name: 'MouseButtonColorToolBar' |
2186 layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0) |
2188 layout: (LayoutFrame 0 0.0 0 0 0 1.0 24 0) |
2187 level: 0 |
2189 level: 0 |
|
2190 visibilityChannel: colorBoxVisibleHolder |
2188 menu: menuMouseButtonColors |
2191 menu: menuMouseButtonColors |
2189 ) |
2192 ) |
2190 (DataSetSpec |
2193 (DataSetSpec |
2191 name: 'colorDataSetView' |
2194 name: 'colorDataSetView' |
2192 layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) |
2195 layout: (LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) |
2193 activeHelpKey: colorMapTable |
2196 activeHelpKey: colorMapTable |
2194 style: (FontDescription helvetica medium roman 10) |
2197 style: (FontDescription helvetica medium roman 10) |
|
2198 visibilityChannel: colorBoxVisibleHolder |
2195 model: selectedColors |
2199 model: selectedColors |
2196 menu: colorMapMenu |
2200 menu: colorMapMenu |
2197 hasHorizontalScrollBar: true |
2201 hasHorizontalScrollBar: true |
2198 hasVerticalScrollBar: true |
2202 hasVerticalScrollBar: true |
2199 miniScrollerHorizontal: true |
2203 miniScrollerHorizontal: true |
2203 doubleClickSelector: doubleClickOnColor: |
2207 doubleClickSelector: doubleClickOnColor: |
2204 columnHolder: colorTableColumns |
2208 columnHolder: colorTableColumns |
2205 multipleSelectOk: true |
2209 multipleSelectOk: true |
2206 verticalSpacing: 1 |
2210 verticalSpacing: 1 |
2207 columnAdaptor: colorColumnAdaptor |
2211 columnAdaptor: colorColumnAdaptor |
|
2212 ) |
|
2213 (ViewSpec |
|
2214 name: 'CropBox' |
|
2215 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
2216 visibilityChannel: cropBoxVisibleHolder |
|
2217 component: |
|
2218 (SpecCollection |
|
2219 collection: ( |
|
2220 (UISubSpecification |
|
2221 name: 'SubSpecification1' |
|
2222 layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
2223 minorKey: cropDialogSpec |
|
2224 ) |
|
2225 ) |
|
2226 |
|
2227 ) |
2208 ) |
2228 ) |
2209 ) |
2229 ) |
2210 |
2230 |
2211 ) |
2231 ) |
2212 ) |
2232 ) |
4015 |
4035 |
4016 canResizeImage |
4036 canResizeImage |
4017 ^ self imageIsLoadedAndNotReadonlyHolder |
4037 ^ self imageIsLoadedAndNotReadonlyHolder |
4018 ! |
4038 ! |
4019 |
4039 |
|
4040 colorBoxVisibleHolder |
|
4041 |holder| |
|
4042 |
|
4043 (holder := builder bindingAt:#colorBoxVisibleHolder) isNil ifTrue:[ |
|
4044 builder aspectAt:#colorBoxVisibleHolder put:(holder := true asValue). |
|
4045 ]. |
|
4046 ^ holder |
|
4047 |
|
4048 "Created: / 03-02-2017 / 11:20:21 / cg" |
|
4049 ! |
|
4050 |
4020 colorColumnAdaptor |
4051 colorColumnAdaptor |
4021 ^ self |
4052 ^ self |
4022 |
4053 |
4023 "Created: / 26.7.1998 / 12:17:03 / cg" |
4054 "Created: / 26.7.1998 / 12:17:03 / cg" |
|
4055 ! |
|
4056 |
|
4057 cropBoxIsDialog |
|
4058 ^ true |
|
4059 |
|
4060 "Created: / 03-02-2017 / 11:23:50 / cg" |
|
4061 ! |
|
4062 |
|
4063 cropBoxVisibleHolder |
|
4064 |holder| |
|
4065 |
|
4066 (holder := builder bindingAt:#cropBoxVisibleHolder) isNil ifTrue:[ |
|
4067 builder aspectAt:#cropBoxVisibleHolder put:(holder := false asValue). |
|
4068 ]. |
|
4069 ^ holder |
|
4070 |
|
4071 "Created: / 03-02-2017 / 11:20:13 / cg" |
4024 ! |
4072 ! |
4025 |
4073 |
4026 hasClassAndSelectorDefinedHolder |
4074 hasClassAndSelectorDefinedHolder |
4027 ^ [ |
4075 ^ [ |
4028 |cls| |
4076 |cls| |
4421 clrIndex := aParameter. |
4469 clrIndex := aParameter. |
4422 (self hasMask) ifTrue:[ |
4470 (self hasMask) ifTrue:[ |
4423 clrIndex := clrIndex - 1. |
4471 clrIndex := clrIndex - 1. |
4424 ]. |
4472 ]. |
4425 changedColor := changedObject at:aParameter. |
4473 changedColor := changedObject at:aParameter. |
4426 img colorMap notNil ifTrue:[ |
4474 drawingColormap notNil ifTrue:[ |
|
4475 drawingColormap at:clrIndex put:changedColor. |
|
4476 ]. |
|
4477 cMap := img colorMap. |
|
4478 (cMap notNil and:[cMap isMappedPalette not and:[cMap isFixedPalette not]]) ifTrue:[ |
4427 img colorMap at:clrIndex put:changedColor. |
4479 img colorMap at:clrIndex put:changedColor. |
4428 self colorMapChanged. |
4480 self colorMapChanged. |
4429 ] ifFalse:[ |
|
4430 drawingColormap notNil ifTrue:[ |
|
4431 drawingColormap at:clrIndex put:changedColor. |
|
4432 ]. |
|
4433 ]. |
4481 ]. |
4434 ^ self |
4482 ^ self |
4435 ]. |
4483 ]. |
4436 ^ self |
4484 ^ self |
4437 ]. |
4485 ]. |
5148 |
5196 |
5149 |clr pixel| |
5197 |clr pixel| |
5150 |
5198 |
5151 selectedColorIndex := anIndex. |
5199 selectedColorIndex := anIndex. |
5152 anIndex isNil ifTrue:[^ self]. |
5200 anIndex isNil ifTrue:[^ self]. |
|
5201 |
5153 clr := self listOfColors at:anIndex ifAbsent:nil. |
5202 clr := self listOfColors at:anIndex ifAbsent:nil. |
5154 clr isNil ifTrue:[^ self]. |
5203 clr isNil ifTrue:[^ self]. |
5155 |
5204 |
5156 pixel := anIndex - 1. |
5205 pixel := anIndex - 1. |
5157 (self listOfColors at:1) = Color noColor ifTrue:[ |
5206 (self listOfColors at:1) = Color noColor ifTrue:[ |
5249 ^ self |
5300 ^ self |
5250 ]. |
5301 ]. |
5251 |
5302 |
5252 depth := img depth. |
5303 depth := img depth. |
5253 cMap := img colorMap. |
5304 cMap := img colorMap. |
5254 cMap isNil ifTrue:[ |
5305 (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[ |
5255 drawingColormap isNil ifTrue:[ |
5306 drawingColormap isNil ifTrue:[ |
5256 self information:(resources stringWithCRs:'Image has no colormap.\The shown colorMap is for drawing only.'). |
5307 self information:(resources stringWithCRs:'Image has no colormap.\The shown colorMap is for drawing only.'). |
5257 drawingColormap := OrderedCollection new. |
5308 drawingColormap := OrderedCollection new. |
5258 ]. |
5309 ]. |
5259 drawingColormap add:newColor. |
5310 drawingColormap add:newColor. |
5310 ]. |
5361 ]. |
5311 self selectedColors value:{listOfColors size}. |
5362 self selectedColors value:{listOfColors size}. |
5312 self updateLabelsAndHistory. |
5363 self updateLabelsAndHistory. |
5313 ] |
5364 ] |
5314 |
5365 |
5315 "Created: / 12.3.1999 / 00:20:28 / cg" |
5366 "Created: / 12-03-1999 / 00:20:28 / cg" |
5316 "Modified: / 16.3.1999 / 21:57:26 / cg" |
5367 "Modified: / 03-02-2017 / 21:42:18 / cg" |
5317 ! |
5368 ! |
5318 |
5369 |
5319 changeHLS |
5370 changeHLS |
5320 "interactive Hue/Light/Saturation editing" |
5371 "interactive Hue/Light/Saturation editing" |
5321 |
5372 |
6310 "Modified: / 15.9.1998 / 17:53:32 / cg" |
6361 "Modified: / 15.9.1998 / 17:53:32 / cg" |
6311 "Created: / 30.9.1998 / 23:51:23 / cg" |
6362 "Created: / 30.9.1998 / 23:51:23 / cg" |
6312 ! |
6363 ! |
6313 |
6364 |
6314 pasteColorIntoColormap |
6365 pasteColorIntoColormap |
6315 |copyBufferColor| |
6366 |copyBufferColor cmap| |
6316 |
6367 |
6317 copyBufferColor := imageEditView getClipboardObject. |
6368 copyBufferColor := imageEditView getClipboardObject. |
6318 copyBufferColor isColor ifFalse:[ |
6369 copyBufferColor isColor ifFalse:[ |
6319 UserPreferences current beepInEditor ifTrue:[ |
6370 UserPreferences current beepInEditor ifTrue:[ |
6320 self window beep. |
6371 self window beep. |
6321 ]. |
6372 ]. |
6322 ^ self |
6373 ^ self |
6323 ]. |
6374 ]. |
6324 |
6375 |
|
6376 cmap := self image colorMap. |
|
6377 (cmap isNil or:[cmap isMappedPalette or:[cmap isFixedPalette]]) ifTrue:[ |
|
6378 drawingColormap isNil ifTrue:[ |
|
6379 drawingColormap := #() |
|
6380 ]. |
|
6381 drawingColormap := drawingColormap copyWith:copyBufferColor. |
|
6382 self selectedColors value:drawingColormap size. |
|
6383 ^ self. |
|
6384 ]. |
|
6385 |
6325 self processSelectedColorWith:[:clr | |
6386 self processSelectedColorWith:[:clr | |
6326 copyBufferColor |
6387 copyBufferColor |
6327 ] |
6388 ] |
|
6389 |
|
6390 "Modified: / 03-02-2017 / 21:45:45 / cg" |
6328 ! |
6391 ! |
6329 |
6392 |
6330 pickAndAddColorToColormap |
6393 pickAndAddColorToColormap |
6331 self addColorToColormap:(Color fromUser) |
6394 self addColorToColormap:(Color fromUser) |
6332 ! |
6395 ! |
6356 |
6419 |
6357 selectedColorIndices := self selectedColors value. |
6420 selectedColorIndices := self selectedColors value. |
6358 selectedColorIndices isEmptyOrNil ifTrue:[^ self]. |
6421 selectedColorIndices isEmptyOrNil ifTrue:[^ self]. |
6359 |
6422 |
6360 img := self image. |
6423 img := self image. |
6361 cMap := img colorMap. |
|
6362 cMap isNil ifTrue:[ |
|
6363 self warn:(resources stringWithCRs:'Image has no colormap.\Please change the colorMap mode first.'). |
|
6364 ^ self |
|
6365 ]. |
|
6366 self hasMask ifTrue:[ |
6424 self hasMask ifTrue:[ |
6367 maskOffset := 1. |
6425 maskOffset := 1. |
6368 ] ifFalse:[ |
6426 ] ifFalse:[ |
6369 maskOffset := 0. |
6427 maskOffset := 0. |
6370 ]. |
6428 ]. |
6371 oldColors := selectedColorIndices collect:[:idx | cMap at:idx-maskOffset]. |
6429 cMap := img colorMap. |
|
6430 (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[ |
|
6431 oldColors := drawingColormap |
|
6432 ] ifFalse:[ |
|
6433 oldColors := selectedColorIndices collect:[:idx | cMap at:idx-maskOffset]. |
|
6434 ]. |
6372 imageEditView makeUndo. |
6435 imageEditView makeUndo. |
6373 |
6436 |
6374 modifiedColormap := cMap asNewArray. |
6437 modifiedColormap := cMap asNewArray. |
6375 |
6438 |
6376 newColors := oldColors collect:aBlock. |
6439 newColors := oldColors collect:aBlock. |
6382 width:img width |
6445 width:img width |
6383 height:img height |
6446 height:img height |
6384 depth:img depth |
6447 depth:img depth |
6385 fromArray:img bits. |
6448 fromArray:img bits. |
6386 |
6449 |
6387 newImage colorMap:modifiedColormap. |
6450 (cMap isNil or:[cMap isMappedPalette or:[cMap isFixedPalette]]) ifTrue:[ |
|
6451 "/ only a dummy... |
|
6452 ] ifFalse:[ |
|
6453 newImage colorMap:modifiedColormap. |
|
6454 ]. |
6388 newImage fileName:img fileName. |
6455 newImage fileName:img fileName. |
6389 newImage mask:(img mask copy). |
6456 newImage mask:(img mask copy). |
6390 |
6457 |
6391 (imageEditView image:newImage) notNil ifTrue:[ |
6458 (imageEditView image:newImage) notNil ifTrue:[ |
6392 self fetchImageData. |
6459 self fetchImageData. |
6393 ]. |
6460 ]. |
6394 self selectedColors value:selectedColorIndices. |
6461 self selectedColors value:selectedColorIndices. |
|
6462 |
|
6463 "Modified: / 03-02-2017 / 22:05:33 / cg" |
6395 ! |
6464 ! |
6396 |
6465 |
6397 reduceNumberOfColors |
6466 reduceNumberOfColors |
6398 |s n anyChange img usedColors| |
6467 |s n anyChange img usedColors| |
6399 |
6468 |