Hi Marco,
Had some fun with the code you posted :D.
This *should* be the equivalent, but with less variables so that you can access
the RBBlockNode.
[ :h :s :v | | chroma rgb |
chroma := s*v.
rgb := { 0 . 0 . 0 }.
rgb
at: ((((h + 60) // 120) \\ 3) + 1) put: chroma;
at: ((((h // 60) + 2 \\ 3) * 5 \\ 3) + 1) put: (chroma * (1.0 -
(((h/60) \\ 2) - 1.0) abs));
collect: [ :part | (part + (v - (chroma) )) * 255 ]
] sourceNode .
Best Regards,
Henrik
-----Original Message-----
From: Pharo-dev [mailto:[email protected]] On Behalf Of Marco
Naddeo
Sent: Wednesday, October 7, 2015 3:49 PM
To: Pharo-dev <[email protected]>
Subject: [Pharo-dev] Problems with a large block
Hi,
I have some problems with the large block at bottom:
-sending the message argumentNames gives me an empty array #() -sending the
message sourceNode gives me a strange result and not a RBBlockNode, as I would
expect
Best,
Marco
[ :h :s :v |
| min chroma hdash X red green blue |
red := 0.
green:= 0.
blue := 0.
chroma := s * v.
hdash := h / 60.
X := chroma * (1.0 - ((hdash % 2) - 1.0) abs).
(hdash < 1.0)
ifTrue: [ red := chroma.
green := X ]
ifFalse: [
(hdash < 2.0)
ifTrue: [ red := X.
green := chroma ]
ifFalse: [
(hdash < 3.0)
ifTrue: [ green := chroma.
blue := X ]
ifFalse: [
(hdash < 4.0)
ifTrue: [ green := X.
blue := chroma ]
ifFalse: [
(hdash < 5.0)
ifTrue: [ red := X.
blue := chroma ]
ifFalse: [
(hdash <= 6.0)
ifTrue: [ red := chroma.
blue := X ]
]
]
]
]
].
min := v - chroma.
{ #red -> ((red + min) * 255).
#green -> ((green + min) * 255).
#blue -> ((blue + min) * 255) } ]
--
Marco Naddeo
PhD Student
Dipartimento di Informatica
Università degli Studi di Torino
Corso Svizzera 185, 10149 Torino, Italy