[squeak-dev] The Inbox: Graphics-kfr.526.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 30 19:42:01 UTC 2022

A new version of Graphics was added to project The Inbox:

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

Name: Graphics-kfr.526
Author: kfr
Time: 30 June 2022, 9:41:53.097057 pm
UUID: 111c75a9-d031-6048-a2fa-b047db4319b0
Ancestors: Graphics-mt.525

Forms of 32 bit depth, don't try to color reduce

=============== Diff against Graphics-mt.525 ===============

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]."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