equal
deleted
inserted
replaced
3505 |
3505 |
3506 depth := img depth. |
3506 depth := img depth. |
3507 cMap := img colorMap. |
3507 cMap := img colorMap. |
3508 cMap isNil ifTrue:[ |
3508 cMap isNil ifTrue:[ |
3509 drawingColormap isNil ifTrue:[ |
3509 drawingColormap isNil ifTrue:[ |
3510 self information:'Image has no colormap.\The shown colorMap is for drawing only.' withCRs. |
3510 self information:(resources stringWithCRs:'Image has no colormap.\The shown colorMap is for drawing only.'). |
3511 drawingColormap := OrderedCollection new. |
3511 drawingColormap := OrderedCollection new. |
3512 ]. |
3512 ]. |
3513 drawingColormap add:newColor. |
3513 drawingColormap add:newColor. |
3514 self listOfColors contents:drawingColormap. |
3514 self listOfColors contents:drawingColormap. |
3515 self selectionOfColor value:(drawingColormap size). |
3515 self selectionOfColor value:(drawingColormap size). |
3522 or:[cMap size == (1 bitShift:depth)]) ifTrue:[ |
3522 or:[cMap size == (1 bitShift:depth)]) ifTrue:[ |
3523 depth >= 8 ifTrue:[ |
3523 depth >= 8 ifTrue:[ |
3524 self warn:'No space for more colors in colormap.'. |
3524 self warn:'No space for more colors in colormap.'. |
3525 ^ self |
3525 ^ self |
3526 ]. |
3526 ]. |
3527 (self confirm:'No space for more colors in colormap.\Change depth ?' withCRs) |
3527 (self confirm:(resources stringWithCRs:'No space for more colors in colormap.\Change depth ?')) |
3528 ifFalse:[ |
3528 ifFalse:[ |
3529 ^ self |
3529 ^ self |
3530 ]. |
3530 ]. |
3531 |
3531 |
3532 imageEditView makeUndo. |
3532 imageEditView makeUndo. |
3781 newColorMap at:idx put:(tmpMap at:idx) |
3781 newColorMap at:idx put:(tmpMap at:idx) |
3782 ]. |
3782 ]. |
3783 |
3783 |
3784 useNearest := Dialog |
3784 useNearest := Dialog |
3785 confirmWithCancel:(resources |
3785 confirmWithCancel:(resources |
3786 string:'Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to first color) ?' |
3786 stringWithCRs:'Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to first color) ?' |
3787 with:usedColors size |
3787 with:usedColors size |
3788 with:(1 bitShift:depth)) withCRs |
3788 with:(1 bitShift:depth)) |
3789 labels:(resources array:#('Cancel' 'First' 'Nearest')). |
3789 labels:(resources array:#('Cancel' 'First' 'Nearest')). |
3790 useNearest isNil ifTrue:[ |
3790 useNearest isNil ifTrue:[ |
3791 colorMapMode value:prevMode. |
3791 colorMapMode value:prevMode. |
3792 ^ self "/ cancel |
3792 ^ self "/ cancel |
3793 ]. |
3793 ]. |
3797 "/ standard colormap |
3797 "/ standard colormap |
3798 usedColors := oldImage usedColors. |
3798 usedColors := oldImage usedColors. |
3799 (usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[ |
3799 (usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[ |
3800 useNearest := Dialog |
3800 useNearest := Dialog |
3801 confirmWithCancel:(resources |
3801 confirmWithCancel:(resources |
3802 string:'Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to first color) ?' |
3802 stringWithCRs:'Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to first color) ?' |
3803 ) withCRs |
3803 ) |
3804 labels:(resources string:#('Cancel' 'First' 'Nearest')). |
3804 labels:(resources string:#('Cancel' 'First' 'Nearest')). |
3805 useNearest isNil ifTrue:[ |
3805 useNearest isNil ifTrue:[ |
3806 colorMapMode value:prevMode. |
3806 colorMapMode value:prevMode. |
3807 ^ self "/ cancel |
3807 ^ self "/ cancel |
3808 ]. |
3808 ]. |
4149 selectedColorIndex isNil ifTrue:[^ self]. |
4149 selectedColorIndex isNil ifTrue:[^ self]. |
4150 |
4150 |
4151 img := self image. |
4151 img := self image. |
4152 cMap := img colorMap. |
4152 cMap := img colorMap. |
4153 cMap isNil ifTrue:[ |
4153 cMap isNil ifTrue:[ |
4154 self warn:('Image has no colormap.\Please change the colorMap mode first.' withCRs). |
4154 self warn:(resources stringWithCRs:'Image has no colormap.\Please change the colorMap mode first.'). |
4155 ^ self |
4155 ^ self |
4156 ]. |
4156 ]. |
4157 |
4157 |
4158 oldColor := cMap at:selectedColorIndex. |
4158 oldColor := cMap at:selectedColorIndex. |
4159 imageEditView makeUndo. |
4159 imageEditView makeUndo. |
4238 cmapIndex isNil ifTrue:[^ nil]. |
4238 cmapIndex isNil ifTrue:[^ nil]. |
4239 |
4239 |
4240 img := self image. |
4240 img := self image. |
4241 cMap := img colorMap. |
4241 cMap := img colorMap. |
4242 cMap isNil ifTrue:[ |
4242 cMap isNil ifTrue:[ |
4243 self warn:('Image has no colormap.\Please change the colorMap mode first.' withCRs). |
4243 self warn:(resources stringWithCRs:'Image has no colormap.\Please change the colorMap mode first.'). |
4244 ^ nil |
4244 ^ nil |
4245 ]. |
4245 ]. |
4246 ^ cMap at:cmapIndex. |
4246 ^ cMap at:cmapIndex. |
4247 ! |
4247 ! |
4248 |
4248 |