[Etoys] [FIX]ColorPickerMorph tracking gray

Karl karl.ramberg at comhem.se
Tue Oct 30 18:15:12 EDT 2007


I noticed that the little circle tracking the picked up color was 
misaligned on grayscale.
I changed the hue value from 0.0 to 240.0 and it works better.

Karl


-------------- next part --------------
'From etoys2.2 of 22 September 2007 [latest update: #1737] on 30 October 2007 at 11:09:29 pm'!

!ColorPickerMorph methodsFor: 'private' stamp: 'kfr 10/30/2007 23:09'!
positionOfColor: aColor
	"Compute the position of the given color in the color chart form"
	| rgbRect x y h s v |
	rgbRect _ (0 at 0 extent: originalForm boundingBox extent) insetBy: (1@ Color colorPaletteCaptionHeight corner: Color colorPaletteGrayWidth + 1 @1).
	h _ aColor hue.
	s _ aColor saturation.
	v _ aColor brightness.
	h = 240.0 ifTrue:["gray"
		^(rgbRect right + (Color colorPaletteGrayWidth // 2)) @ (rgbRect height * (1.0 - v) + rgbRect top)].
	x _ (h + 22 \\ 360 / 360.0 * rgbRect width) rounded.
	y _ 0.5.
	s < 1.0 ifTrue:[y _ y - (1.0 - s * 0.5)].
	v < 1.0 ifTrue:[y _ y + (1.0 - v * 0.5)].
	y _ (y * rgbRect height) rounded.
	^x at y + (1 @ Color colorPaletteCaptionHeight)! !


More information about the etoys-dev mailing list