# HG changeset patch # User Claus Gittinger # Date 1036262863 -3600 # Node ID 91b7ea254a3b4929767e65484f8766927721b94e # Parent 8119edd52cf823fbce86c828e87e5a960433fc9a some changes to support drawing into 24-bit images diff -r 8119edd52cf8 -r 91b7ea254a3b ImageEditor.st --- a/ImageEditor.st Thu Oct 31 17:32:36 2002 +0100 +++ b/ImageEditor.st Sat Nov 02 19:47:43 2002 +0100 @@ -14,7 +14,7 @@ ToolApplicationModel subclass:#ImageEditor instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode - selectedColorIndex postOpenAction imageSeqNr' + selectedColorIndex postOpenAction imageSeqNr drawingColormap' classVariableNames:'LastDirectory LastSizeString MaskClipboard LastColormapMode DefaultRelativeSizes' poolDictionaries:'' @@ -2498,7 +2498,7 @@ clrIndex := clrIndex - 1. ]. - img colorMap at:clrIndex put:(changedObject at:aParameter). + (img colorMap ? drawingColormap) at:clrIndex put:(changedObject at:aParameter). self colorMapChanged. ^ self ]. @@ -2989,7 +2989,7 @@ !ImageEditor methodsFor:'user actions - colormap'! addColorToColormap - |depth img cMap newColorMap newImage oldCListSize newMode| + |depth img cMap newColorMap newImage oldCListSize newMode listOfColors| img := self image. img isNil ifTrue:[ @@ -3000,7 +3000,15 @@ depth := img depth. cMap := img colorMap. cMap isNil ifTrue:[ - self warn:'Image has no colormap.\Change colorMap mode first.' withCRs. + drawingColormap isNil ifTrue:[ + self information:'Image has no colormap.\The shown colorMap is for drawing only.' withCRs. + drawingColormap := OrderedCollection new. + ]. + drawingColormap add:(Color black). + self listOfColors contents:drawingColormap. + self selectionOfColor value:(drawingColormap size). + + "/ self warn:'Image has no colormap.\Change colorMap mode first.' withCRs. ^ self ]. @@ -3023,7 +3031,8 @@ ]. cMap := cMap asArray. - oldCListSize := self listOfColors size. + listOfColors := self listOfColors. + oldCListSize := listOfColors size. "/ (colorMapMode value asString endsWith:'mask') ifTrue:[ "/ cMap last = Color noColor ifTrue:[ @@ -3049,13 +3058,13 @@ newImage mask:(img mask copy). (imageEditView image:newImage) notNil ifTrue:[ - self listOfColors contents: newImage colorMap. + listOfColors contents: newImage colorMap. self findColorMapMode. "/ mhmh - somehow, we get two colors added ... (sigh findColorMapMode adds another one ...) - self listOfColors size > (oldCListSize + 1) ifTrue:[ - self listOfColors removeLast + listOfColors size > (oldCListSize + 1) ifTrue:[ + listOfColors removeLast ]. - self selectionOfColor value:(self listOfColors size). + self selectionOfColor value:(listOfColors size). self updateLabelsAndHistory. ]