2995 |
3002 |
2996 image depth > 12 ifTrue:[ |
3003 image depth > 12 ifTrue:[ |
2997 listOfColors removeAll. |
3004 listOfColors removeAll. |
2998 image colorMap isEmptyOrNil ifTrue:[ |
3005 image colorMap isEmptyOrNil ifTrue:[ |
2999 someOrAllUsedColors := image usedColorsMax:10000. |
3006 someOrAllUsedColors := image usedColorsMax:10000. |
3000 someOrAllUsedColors := someOrAllUsedColors asArray. |
3007 someOrAllUsedColors notNil ifTrue:[ |
3001 someOrAllUsedColors sort:self sortBlockForColors. |
3008 someOrAllUsedColors := someOrAllUsedColors asArray. |
3002 listOfColors addAll:someOrAllUsedColors. |
3009 someOrAllUsedColors sort:self sortBlockForColors. |
3003 "/ listOfColors add:Color black; add:Color white. |
3010 listOfColors addAll:someOrAllUsedColors. |
|
3011 "/ listOfColors add:Color black; add:Color white. |
|
3012 ] |
3004 ] ifFalse:[ |
3013 ] ifFalse:[ |
3005 listOfColors addAll:(image colorMap). |
3014 listOfColors addAll:(image colorMap). |
3006 ]. |
3015 ]. |
3007 ] ifFalse:[ |
3016 ] ifFalse:[ |
3008 listOfColors isEmpty ifTrue:[ |
3017 listOfColors isEmpty ifTrue:[ |
3009 self colorMapMode: colorMapMode value. |
3018 self colorMapMode: colorMapMode value. |
3010 image := self image. |
3019 image := self image. |
3011 ]. |
3020 ]. |
3012 ]. |
3021 ]. |
3013 drawColor1 := listOfColors at:1. |
3022 listOfColors notEmptyOrNil ifTrue:[ |
3014 drawColor2 := listOfColors at:2 ifAbsent:drawColor1. |
3023 drawColor1 := listOfColors at:1. |
3015 |
3024 drawColor2 := listOfColors at:2 ifAbsent:drawColor1. |
3016 self hasMask ifTrue: [ |
3025 |
3017 (listOfColors contains: [:clr| clr = (Color colorId:0)]) |
3026 self hasMask ifTrue: [ |
3018 ifFalse:[ |
3027 (listOfColors contains: [:clr| clr = (Color colorId:0)]) |
3019 listOfColors addFirst:(Color colorId:0). |
3028 ifFalse:[ |
3020 drawColor1 := listOfColors at:2. |
3029 listOfColors addFirst:(Color colorId:0). |
3021 drawColor2 := listOfColors at:3 ifAbsent:drawColor1. |
3030 drawColor1 := listOfColors at:2. |
3022 ] |
3031 drawColor2 := listOfColors at:3 ifAbsent:drawColor1. |
3023 ]. |
3032 ] |
3024 |
3033 ]. |
3025 imageEditView drawingColors:(Array with: drawColor1 with: drawColor2). |
3034 |
3026 |
3035 imageEditView drawingColors:(Array with: drawColor1 with: drawColor2). |
3027 self selectionOfColor |
3036 |
3028 setValue: 0; |
3037 self selectionOfColor |
3029 value: (listOfColors indexOf: imageEditView selectedColor). |
3038 setValue: 0; |
|
3039 value: (listOfColors indexOf: imageEditView selectedColor). |
|
3040 ]. |
|
3041 |
|
3042 "Modified: / 07-07-2006 / 12:27:43 / cg" |
3030 ! |
3043 ! |
3031 |
3044 |
3032 update:something with:aParameter from:changedObject |
3045 update:something with:aParameter from:changedObject |
3033 |clrIndex img imagePreView clr changedColor| |
3046 |clrIndex img imagePreView clr changedColor| |
3034 |
3047 |
4228 |
4241 |
4229 mask := self image mask. |
4242 mask := self image mask. |
4230 MaskClipboard := mask subImageIn: (0@0 extent:mask extent). |
4243 MaskClipboard := mask subImageIn: (0@0 extent:mask extent). |
4231 ! |
4244 ! |
4232 |
4245 |
|
4246 ditherToDepth |
|
4247 |depth| |
|
4248 |
|
4249 depth := Dialog request:'New depth ?'. |
|
4250 depth isEmptyOrNil ifTrue:[^ self]. |
|
4251 depth := Number readFrom:depth onError:nil. |
|
4252 depth isNil ifTrue:[^ self]. |
|
4253 |
|
4254 self ditherToDepth:depth |
|
4255 |
|
4256 "Created: / 07-07-2006 / 13:22:10 / cg" |
|
4257 ! |
|
4258 |
|
4259 ditherToDepth:depth |
|
4260 |ditherColors newImage| |
|
4261 |
|
4262 depth = 1 ifTrue:[ |
|
4263 ditherColors := Array with:(Color black) with:(Color white). |
|
4264 ] ifFalse:[ depth = 2 ifTrue:[ |
|
4265 ditherColors := Array |
|
4266 with:(Color black) |
|
4267 with:(Color darkGrey) |
|
4268 with:(Color lightGrey) |
|
4269 with:(Color white). |
|
4270 ] ifFalse:[ depth = 3 ifTrue:[ |
|
4271 ditherColors := Color colorCubeWithRed:2 green:2 blue:2. |
|
4272 ] ifFalse:[ depth = 4 ifTrue:[ |
|
4273 ditherColors := Color vgaColors. |
|
4274 ] ifFalse:[ depth = 5 ifTrue:[ |
|
4275 ditherColors := Color colorCubeWithRed:4 green:4 blue:2. |
|
4276 ] ifFalse:[ depth = 5 ifTrue:[ |
|
4277 ditherColors := Color colorCubeWithRed:4 green:4 blue:3. |
|
4278 ] ifFalse:[ depth <= 8 ifTrue:[ |
|
4279 ditherColors := Color colorCubeWithRed:6 green:6 blue:5. |
|
4280 ] ifFalse:[ |
|
4281 self halt. |
|
4282 ]]]]]]]. |
|
4283 |
|
4284 self withExecuteCursorDo:[ |
|
4285 newImage := self image asDitheredImageUsing:ditherColors depth:8. |
|
4286 |
|
4287 imageEditView makeUndo. |
|
4288 imageEditView image:newImage. |
|
4289 imageEditView setModified. |
|
4290 self updateImage. |
|
4291 self updateImagePreView. |
|
4292 |
|
4293 self fetchImageData. |
|
4294 ]. |
|
4295 |
|
4296 "Created: / 07-07-2006 / 13:20:56 / cg" |
|
4297 ! |
|
4298 |
4233 editSelectedColor |
4299 editSelectedColor |
4234 self processSelectedColorWith:[:clr | |
4300 self processSelectedColorWith:[:clr | |
4235 |editor| |
4301 |editor| |
4236 |
4302 |
4237 editor := ColorEditDialog new. |
4303 editor := ColorEditDialog new. |
4470 ^ self |
4536 ^ self |
4471 ]. |
4537 ]. |
4472 |
4538 |
4473 self withExecuteCursorDo:[ |
4539 self withExecuteCursorDo:[ |
4474 image := self image. |
4540 image := self image. |
4475 usedColors := image usedColors. |
4541 "/ usedColors := image usedColorsMax:4096. |
4476 imageEditView makeUndo. |
4542 imageEditView makeUndo. |
4477 |
4543 |
4478 newImage := image copy. |
4544 newImage := image copy. |
4479 image |
4545 image |
4480 colorsFromX:0 y:0 toX:(image width-1) y:(image height-1) |
4546 colorsFromX:0 y:0 toX:(image width-1) y:(image height-1) |