523 |
523 |
524 #fileSaveMethodAs |
524 #fileSaveMethodAs |
525 'Save the image as resource method in a class' |
525 'Save the image as resource method in a class' |
526 |
526 |
527 #floodFillMaxError |
527 #floodFillMaxError |
528 '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.\This is especially useful when masking background areas.' |
528 '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 (undo and try with higher value).\This is especially useful when masking background areas from screenshots.' |
529 |
529 |
530 #magnificationNumber |
530 #magnificationNumber |
531 'Shows the current magnification' |
531 'Shows the current magnification' |
532 |
532 |
533 #magnifyImageDown |
533 #magnifyImageDown |
4945 self floodFillBoxVisibleHolder value:(sym == #fill). |
4945 self floodFillBoxVisibleHolder value:(sym == #fill). |
4946 |
4946 |
4947 "Created: / 19-02-2017 / 15:01:05 / cg" |
4947 "Created: / 19-02-2017 / 15:01:05 / cg" |
4948 ! |
4948 ! |
4949 |
4949 |
4950 findColorMapMode |
4950 colorMapModeFromImage:anImage |
4951 "finds the colorMapMode for a new image" |
4951 "retrieves the colorMapMode for an image" |
4952 |
4952 |
4953 |image newListOfColors colorMapModeKey drawColor1 drawColor2 someOrAllUsedColors| |
4953 |image colorMapModeKey| |
4954 |
4954 |
4955 image := self image. |
4955 image := self image. |
4956 image isNil ifTrue:[^ self ]. |
4956 image isNil ifTrue:[^ nil ]. |
4957 |
4957 |
4958 image mask notNil ifTrue: [ |
4958 image mask notNil ifTrue: [ |
4959 colorMapModeKey := 'masked'. |
4959 colorMapModeKey := 'masked'. |
4960 ] ifFalse:[ |
4960 ] ifFalse:[ |
4961 colorMapModeKey := 'depth'. |
4961 colorMapModeKey := 'depth'. |
4962 ]. |
4962 ]. |
4963 colorMapModeKey := colorMapModeKey , image depth printString. |
4963 colorMapModeKey := (colorMapModeKey , image depth printString) asSymbol. |
|
4964 ^ colorMapModeKey |
|
4965 |
|
4966 "Created: / 06-04-2017 / 13:19:19 / cg" |
|
4967 ! |
|
4968 |
|
4969 findColorMapMode |
|
4970 "finds the colorMapMode for a new image" |
|
4971 |
|
4972 |image newListOfColors colorMapModeKey drawColor1 drawColor2 someOrAllUsedColors| |
|
4973 |
|
4974 image := self image. |
|
4975 (colorMapModeKey := self colorMapModeFromImage:image) isNil ifTrue:[^ self]. |
|
4976 |
4964 self colorMapMode setValue:colorMapModeKey. |
4977 self colorMapMode setValue:colorMapModeKey. |
4965 |
4978 |
4966 image photometric == #palette ifTrue:[ |
4979 image photometric == #palette ifTrue:[ |
4967 image colorMap isNil ifTrue:[ |
4980 image colorMap isNil ifTrue:[ |
4968 image depth > 16 ifTrue:[ |
4981 image depth > 16 ifTrue:[ |
5015 ]. |
5028 ]. |
5016 self listOfColors asOrderedCollection ~= newListOfColors ifTrue:[ |
5029 self listOfColors asOrderedCollection ~= newListOfColors ifTrue:[ |
5017 self listOfColors contents:newListOfColors. |
5030 self listOfColors contents:newListOfColors. |
5018 ]. |
5031 ]. |
5019 |
5032 |
5020 "Modified: / 06-12-2016 / 12:51:36 / cg" |
5033 "Modified: / 06-04-2017 / 13:20:10 / cg" |
5021 ! |
5034 ! |
5022 |
5035 |
5023 selectedColorsChanged |
5036 selectedColorsChanged |
5024 |colorIndices selectedIndex| |
5037 |colorIndices selectedIndex| |
5025 |
5038 |
6400 |depth numColors newColorMap newImage |
6413 |depth numColors newColorMap newImage |
6401 oldImage image newColors realColorMap oldFileName |
6414 oldImage image newColors realColorMap oldFileName |
6402 usedColors useNearest usageCounts tmpBits tmpMap quest |
6415 usedColors useNearest usageCounts tmpBits tmpMap quest |
6403 prevMode maskThreshold maskImage| |
6416 prevMode maskThreshold maskImage| |
6404 |
6417 |
|
6418 oldImage := self image. |
|
6419 |
|
6420 "/ rubbish; the mode is already changed |
|
6421 "/ prevMode := colorMapMode value. |
|
6422 prevMode := self colorMapModeFromImage:oldImage. |
|
6423 prevMode == aMode ifTrue:[^ self]. |
|
6424 |
6405 self withExecuteCursorDo:[ |
6425 self withExecuteCursorDo:[ |
6406 oldImage := self image. |
|
6407 |
|
6408 prevMode := colorMapMode value. |
|
6409 |
|
6410 newColorMap := self class listOfColorMaps at:aMode. |
6426 newColorMap := self class listOfColorMaps at:aMode. |
6411 (aMode == #depth32 or:[aMode == #masked32]) ifTrue:[ |
6427 (aMode == #depth32 or:[aMode == #masked32]) ifTrue:[ |
6412 depth := 32. |
6428 depth := 32. |
6413 ] ifFalse:[ |
6429 ] ifFalse:[ |
6414 (aMode == #depth24 or:[aMode == #masked24]) ifTrue:[ |
6430 (aMode == #depth24 or:[aMode == #masked24]) ifTrue:[ |
6430 quest := 'Compute colormap (or use standard)' |
6446 quest := 'Compute colormap (or use standard)' |
6431 ] ifFalse:[ |
6447 ] ifFalse:[ |
6432 quest := 'Keep colormap (or use standard)' |
6448 quest := 'Keep colormap (or use standard)' |
6433 ] |
6449 ] |
6434 ]. |
6450 ]. |
|
6451 |
|
6452 "/ currently always true!! |
6435 ((prevMode = aMode) |
6453 ((prevMode = aMode) |
6436 or:[depth > oldImage depth |
6454 or:[depth > oldImage depth |
6437 or:[true "self confirm:(resources string:quest)"]] |
6455 or:[true "self confirm:(resources string:quest)"]] |
6438 ) ifTrue:[ |
6456 ) ifTrue:[ |
6439 (newColorMap isOrderedCollection or:[newColorMap isFixedPalette not]) ifTrue:[ |
6457 (newColorMap isOrderedCollection or:[newColorMap isFixedPalette not]) ifTrue:[ |
6746 copyColorFromColormap |
6764 copyColorFromColormap |
6747 imageEditView setClipboardObject:(self selectedColorOrNil) |
6765 imageEditView setClipboardObject:(self selectedColorOrNil) |
6748 ! |
6766 ! |
6749 |
6767 |
6750 ditherToDepth |
6768 ditherToDepth |
6751 |depth| |
6769 |oldDepth suggestion depth| |
6752 |
6770 |
6753 depth := Dialog request:'New depth ?'. |
6771 oldDepth := self image depth. |
|
6772 suggestion := oldDepth > 8 ifTrue:[8] ifFalse:[(oldDepth // 2 - 1) nextPowerOf2]. |
|
6773 |
|
6774 depth := Dialog request:'New depth ?' initialAnswer:suggestion asString. |
6754 depth isEmptyOrNil ifTrue:[^ self]. |
6775 depth isEmptyOrNil ifTrue:[^ self]. |
|
6776 |
6755 depth := Number readFrom:depth onError:nil. |
6777 depth := Number readFrom:depth onError:nil. |
6756 depth isNil ifTrue:[^ self]. |
6778 depth isNil ifTrue:[^ self]. |
6757 |
6779 |
6758 self ditherToDepth:depth |
6780 self ditherToDepth:depth |
6759 |
6781 |
6760 "Created: / 07-07-2006 / 13:22:10 / cg" |
6782 "Created: / 07-07-2006 / 13:22:10 / cg" |
|
6783 "Modified: / 06-04-2017 / 13:34:05 / cg" |
6761 ! |
6784 ! |
6762 |
6785 |
6763 ditherToDepth:depth |
6786 ditherToDepth:depth |
6764 |ditherColors newImage useStandardColors nGrey greyColorsAlready moreColors d| |
6787 |ditherColors newImage useStandardColors nGrey greyColorsAlready moreColors d| |
6765 |
6788 |