[squeak-dev] The Trunk: Graphics-kfr.527.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jul 2 07:45:09 UTC 2022


Marcel Taeumel uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-kfr.527.mcz

==================== Summary ====================

Name: Graphics-kfr.527
Author: kfr
Time: 1 July 2022, 7:15:00.033758 pm
UUID: 45123247-99ec-da41-b9a2-a3680dfe2f66
Ancestors: Graphics-kfr.526

We can't reduce color of 32 bit depth directly.
Convert to 16 bits first to get around problem.

=============== Diff against Graphics-kfr.526 ===============

Item was changed:
  ----- Method: Form>>copyWithColorsReducedTo: (in category 'converting') -----
  copyWithColorsReducedTo: nColors
  	"Note: this has not been engineered.
  	There are better solutions in the literature."
  	| palette colorMap |
+ 	self depth > 16 ifTrue:[^(self asFormOfDepth: 16) copyWithColorsReducedTo: nColors]. "First reduce to 16 bit depth"
- 	self depth > 16 ifTrue:[^self]."bail out. will cause problems on 32 bit depth forms"
  	palette := self reducedPaletteOfSize: nColors.
  	colorMap := (1 to: (1 bitShift: depth)) collect:
  		[:i | | pc closest |
  		pc := Color colorFromPixelValue: i-1 depth: depth.
  		closest := palette detectMin: [:c | c diff: pc].
  		closest pixelValueForDepth: depth].
  	^ self deepCopy copyBits: self boundingBox from: self at: 0 at 0 colorMap: (colorMap as: Bitmap)
  		!



More information about the Squeak-dev mailing list