diff -r cf317c6af373 -r c4b680a69618 Image.st --- a/Image.st Thu Aug 31 16:38:58 2017 +0200 +++ b/Image.st Thu Aug 31 16:39:32 2017 +0200 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + " COPYRIGHT (c) 1991 by Claus Gittinger All Rights Reserved @@ -6705,18 +6707,7 @@ |type ddepth| ddepth := aDevice depth. - - aDevice hasGrayscales ifFalse:[ - ^ self asMonochromeFormOn:aDevice - ]. - type := aDevice visualType. - (type == #StaticGray) ifTrue:[ - ddepth == 8 ifTrue:[ - ^ self paletteImageAsGray8FormOn:aDevice - ]. - ^ self asGrayFormOn:aDevice - ]. (type == #TrueColor) ifTrue:[ DitherAlgorithm == #floydSteinberg ifTrue:[ @@ -6731,8 +6722,20 @@ ^ self paletteImageAsTrueColorFormOn:aDevice ]. + aDevice hasGrayscales ifFalse:[ + ^ self asMonochromeFormOn:aDevice + ]. + + (type == #StaticGray) ifTrue:[ + "/ ddepth == 8 ifTrue:[ + "/ ^ self paletteImageAsGray8FormOn:aDevice + "/ ]. + ^ self asGrayFormOn:aDevice + ]. + "/ the PseudoColor conversion also works for - "/ StaticColor, GrayScale & DirectColor; although possibly with suboptimal results + "/ StaticColor, GrayScale & DirectColor; + "/ although possibly with suboptimal results ^ self paletteImageAsPseudoFormOn:aDevice @@ -13668,17 +13671,16 @@ deviceImageDepth := entry at:#depth. deviceImageBitsPerPixel := entry at:#bitsPerPixel. - "/ for now, ignore all depth's which are neither 1 nor the - "/ devices depth. + "/ for now, ignore all depth's which are neither 1 nor the device's depth. "/ (actually, many devices can handle other pixMap formats, - "/ but I don't know (yet) how to pass the correct color info + "/ but I don't know (yet) how to pass the correct color info) ((deviceImageDepth == 1) or:[deviceImageDepth == aDevice depth]) ifTrue:[ deviceImageBitsPerPixel > maxBitsPerPixel ifTrue:[ maxInfo := entry. - "/ maxBitsPerPixel := deviceImageBitsPerPixel. - "/ maxDepth := deviceImageDepth. + "/ maxBitsPerPixel := deviceImageBitsPerPixel. + "/ maxDepth := deviceImageDepth. ]. deviceImageDepth >= myDepth ifTrue:[ @@ -13686,7 +13688,8 @@ "/ take the better one ... (bestDeviceDepth isNil or:[(bestDeviceBitsPerPixel ~~ bestDeviceDepth) - and:[deviceImageDepth == deviceImageBitsPerPixel]]) ifTrue:[ + and:[deviceImageDepth == deviceImageBitsPerPixel]] + ) ifTrue:[ bestInfo := entry. bestDeviceDepth := deviceImageDepth. bestDeviceBitsPerPixel := deviceImageBitsPerPixel. @@ -13694,7 +13697,8 @@ ] ifFalse:[ "/ take the next-larger depth (bestDeviceDepth isNil - or:[deviceImageBitsPerPixel < bestDeviceBitsPerPixel]) ifTrue:[ + or:[deviceImageBitsPerPixel < bestDeviceBitsPerPixel] + ) ifTrue:[ bestInfo := entry. bestDeviceDepth := deviceImageDepth. bestDeviceBitsPerPixel := deviceImageBitsPerPixel.