[ENH][FIX] Color picker
Lic. Edgar J. De Cleene
edgardec2001 at yahoo.com.ar
Tue Sep 14 10:28:21 UTC 2004
On 13/09/04 17:06, "John M McIntosh" <johnmci at smalltalkconsulting.com>
wrote:
> At ESUG 2004 I was informed there was a problem picking color to make
> wonderful artwork.
> It appears this is likely due to the fact that:
>
> "As reported at ESUG2004 the choice for color in the color picker
> morphic, or the paint tool morphic was lousy. First it was 16 bit
> resolution, then it was limited to a couple of hundred colors. I
> changed the size to 360*180 + grey scale which gives 64980 colors along
> with changing the color spectum form from to 32 bits versus 16. I also
> fixed some lingering bugs in the morphic painting tool when it enforces
> selection boundaries for the color selection widget. Please note for
> perfect color a better tool would be required, one that would allow you
> to access millions of colors... "
>
>
> I also noticed that both the morphic painter tool and the morphic color
> picker use two different sets of code to track the mouse location and
> the user's choice by using a small circle. Now I fixed up the morphic
> painter tool to work correctly, as far as I can tell it was broken in
> the past. However I couldn't quite see how the morphic color picker
> does it's magic (other than spinning the cpu). So I'll let someone else
> fix it?
>
> I'll note having a color wheel, and the ability to pick across millions
> of colors via a slider and/or using input data, and/or picking HTML
> safe colors etc etc might be nice someday too.
John:
Here I have a selector for HTML safe colors, sure someone could improve.
Do HVHtmlColorPalette example and click your favorite color.
Later , you do HVHtmlColorPalette getColor for use.
Edgar
-------------- next part --------------
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 14 September 2004 at 7:15:45 am'!
Object subclass: #HVHtmlColorPalette
instanceVariableNames: ''
classVariableNames: 'HtmlColor '
poolDictionaries: ''
category: 'HV-base'!
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
HVHtmlColorPalette class
instanceVariableNames: ''!
!HVHtmlColorPalette class methodsFor: 'as yet unclassified' stamp: 'edc 11/3/2003 08:22'!
example
| htmlValues r v a m rS vS aS x y container htmlColor htmlColorTable index |
htmlColorTable := OrderedCollection new.
container := PasteUpMorph new behaveLikeHolder openInWorld.
container borderWidth: 2; borderColor: Color black; color: Color white.
htmlValues := #('00' '33' '66' '99' 'CC' 'FF' ).
x := 0.
y := 0.
index := 0.
1
to: 6
do: [:rojo |
r := htmlValues at: rojo.
1
to: 6
do: [:verde |
v := htmlValues at: verde.
1
to: 6
do: [:azul |
a := htmlValues at: azul.
htmlColor := '#' , r , v , a.
htmlColorTable add: htmlColor.
rS := (Number readFrom: r base: 16)
/ 255.
vS := (Number readFrom: v base: 16)
/ 255.
aS := (Number readFrom: a base: 16)
/ 255.
index := index + 1.
m := SimpleButtonMorph newWithLabel: ''.
m extent: 15 @ 15.
m target: self;
actionSelector: #setColor:;
arguments: (Array
with: (htmlColorTable at: index));
color: (Color
r: rS
g: vS
b: aS).
m label: ''.
m position: x @ y.
container addMorph: m.
x := m right + 2].
x := 0.
y := m bottom + 2]].
container extent: 190 @ 410! !
!HVHtmlColorPalette class methodsFor: 'as yet unclassified' stamp: 'edc 11/1/2003 10:36'!
getColor
^ HtmlColor ! !
!HVHtmlColorPalette class methodsFor: 'as yet unclassified' stamp: 'edc 11/1/2003 10:36'!
setColor: b
HtmlColor _ b! !
More information about the Squeak-dev
mailing list
|