# HG changeset patch # User Claus Gittinger # Date 901840570 -7200 # Node ID 4cf126b710b39ed478aa67c2cdb359f032f4b52a # Parent 7be532d91b87c80adde83d209df36affa194763d handle errors when grabbing diff -r 7be532d91b87 -r 4cf126b710b3 ImageEditor.st --- a/ImageEditor.st Thu Jul 30 11:20:11 1998 +0200 +++ b/ImageEditor.st Fri Jul 31 01:16:10 1998 +0200 @@ -1274,25 +1274,30 @@ blueFromColor:aColor "helper used to access a color as a row in the dataSet view" + aColor isNil ifTrue:[^ 'none']. ^ aColor blueByte ? 'mask' "Created: / 26.7.1998 / 12:30:35 / cg" + "Modified: / 31.7.1998 / 01:11:18 / cg" ! greenFromColor:aColor "helper used to access a color as a row in the dataSet view" + aColor isNil ifTrue:[^ 'none']. ^ aColor greenByte ? 'mask' "Created: / 26.7.1998 / 12:30:29 / cg" + "Modified: / 31.7.1998 / 01:11:31 / cg" ! redFromColor:aColor "helper used to access a color as a row in the dataSet view" + aColor isNil ifTrue:[^ 'none']. ^ aColor redByte ? 'mask' - "Modified: / 26.7.1998 / 12:30:22 / cg" + "Modified: / 31.7.1998 / 01:11:35 / cg" ! ! !ImageEditor methodsFor:'help'! @@ -1698,23 +1703,23 @@ depth := oldImage depth. oldImage photometric ~~ #palette ifTrue:[ - self information:'Only palette images have colormaps.'. + self information:'Compress colorMap: Only palette images have colormaps.'. ^ self ]. usedColors := oldImage usedColors. usedColors size == (1 bitShift:depth) ifTrue:[ - self information:'All colors are used - no compression.'. + self information:'Compress colorMap: All colors are used - no compression.'. ^ self ]. usedColors size == oldImage colorMap size ifTrue:[ - self information:'Colormap already compressed - no compression.'. + self information:'Compress colorMap: Colormap already compressed - no compression.'. ^ self ]. imageEditView makeUndo. - self information:('%1 colors used.' bindWith:usedColors size). + self information:('Compress colorMap: %1 colors used.' bindWith:usedColors size). self withExecuteCursorDo:[ newColorMap := Array new:usedColors size. @@ -1776,7 +1781,7 @@ ] "Created: / 28.7.1998 / 20:03:11 / cg" - "Modified: / 28.7.1998 / 21:36:17 / cg" + "Modified: / 31.7.1998 / 01:13:57 / cg" ! ! !ImageEditor methodsFor:'user actions - editing'! @@ -1948,17 +1953,23 @@ image := Image fromUser. image depth > 8 ifTrue:[ - image := Depth8Image fromImage:image. + Object errorSignal handle:[:ex | + self warn:'Could not convert to depth8 image (too many colors)'. + ^ self + ] do:[ + image := Depth8Image fromImage:image. + ] ]. (imageEditView image: image) notNil ifTrue: [ self listOfColors contents:(image colorMap). self findColorMapMode. - self updateLabelsAndHistory + self updateLabelsAndHistory. ] "Created: / 29.7.1998 / 21:24:42 / cg" + "Modified: / 31.7.1998 / 01:14:33 / cg" ! ! !ImageEditor methodsFor:'user actions - saving'!