'From Squeak3.2alpha of 2 October 2001 [latest update: #4445] on 28 October 2001 at 12:10:03 pm'! "Change Set: JPEGimageDepth Date: 28 October 2001 Author: Dan Ingalls The method nextImageDitheredToDepth: in JPEGReadWriter is changed to produce a form of the depth supplied (was always 32). At the sytem level, this means that JPEGs produce forms with a depth equal to that of the Squeak display."! !JPEGReadWriter methodsFor: 'public access' stamp: 'di 10/28/2001 11:42'! nextImageDitheredToDepth: depth | form xStep yStep x y bb | ditherMask _ DitherMasks at: depth ifAbsent: [self error: 'can only dither to display depths']. residuals _ WordArray new: 3. sosSeen _ false. self parseFirstMarker. [sosSeen] whileFalse: [self parseNextMarker]. "Need at least 16 bits for proper dithering" form _ Form extent: (width @ height) depth: (depth max: 16). bb _ BitBlt current toForm: form. bb sourceForm: mcuImageBuffer. bb sourceRect: mcuImageBuffer boundingBox. bb combinationRule: Form over. xStep _ mcuWidth * DCTSize. yStep _ mcuHeight * DCTSize. y _ 0. 1 to: mcuRowsInScan do: [:row | x _ 0. 1 to: mcusPerRow do: [:col | self decodeMCU. self idctMCU. self colorConvertMCU. bb destX: x; destY: y; copyBits. x _ x + xStep]. y _ y + yStep]. depth < 16 ifTrue: [^ form asFormOfDepth: depth]. ^ form! ! !FlashJPEGDecoder methodsFor: 'decoding' stamp: 'di 10/28/2001 11:41'! nextImageDitheredToDepth: depth "Overwritten to yield every now and then." | form xStep yStep x y | ditherMask _ DitherMasks at: depth ifAbsent: [self error: 'can only dither to display depths']. residuals _ WordArray new: 3. sosSeen _ false. self parseFirstMarker. [sosSeen] whileFalse: [self parseNextMarker]. "Need at least 16 bits for proper dithering" form _ Form extent: (width @ height) depth: (depth max: 16). xStep _ mcuWidth * DCTSize. yStep _ mcuHeight * DCTSize. y _ 0. 1 to: mcuRowsInScan do: [:row | "self isStreaming ifTrue:[Processor yield]." x _ 0. 1 to: mcusPerRow do: [:col | self decodeMCU. self idctMCU. self colorConvertMCU. mcuImageBuffer displayOn: form at: (x @ y). x _ x + xStep]. y _ y + yStep]. depth < 16 ifTrue: [^ form asFormOfDepth: depth]. ^ form! !