Hi Vincent,
 Just saw this message and had a few moments to take a peek at it. My C is
somewhat rusty nowadays, but it looks to me that you've got truncation
issues in the following function:

+static void HSL_to_RGB(int32_t hue, int32_t sat, int32_t lit, uint8_t *r,
uint8_t *g, uint8_t *b)
+{
+       float m1, m2;
+       float h, s, l;
+
+       h = hue/360;
+       s = sat/100;
+       l = lit/100;
+
+       m2 = (l <= 0.5) ? l * (s + 1) : l + s - l * s;
+       m1 = l * 2 - m2;
+
+       *r = hue_to_RGB(m1, m2, h + 1/3);
+       *g = hue_to_RGB(m1, m2, h      );
+       *b = hue_to_RGB(m1, m2, h - 1/3);
+}

 As all your initial hsl calculations are done on int / int you're only
going to end up with values of 0 or 1. If you change it to something akin to
h = hue / 360.0; s = sat / 100.0; l = lit / 100.0; and similarly later on
switch h + 1/3 to h + 1/3.0 then this may help you.


Thanks!

R.


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Vincent
Sanders
Sent: 21 January 2011 11:06
To: [email protected]
Subject: hsl() color still broken

with the changes from jmb/tlsa and split out...still doesnt work, if
anything its worse than before :-(


--
Regards Vincent
http://www.kyllikki.org/



Reply via email to