SRL Archive - Bugs

Bug in XYZTo[x]?


any_one

2010-12-11 21:50:13

If the r, g, or b value for a colour is below 11, if you convert to xyz and then back it is ignored - ie. becomes 0.

program new;
var x,y,z : Extended;
r,g,b,i : Integer;
begin
for i := 1 to 11 do
begin
RGBToXYZ(i,i,i,x,y,z);
XYZToRGB(x,y,z,r,g,b);
Writeln('r: ' + ToStr(r) + ' g: ' + ToStr(g) + ' b: ' + ToStr(b) );
end;
end.

Gives:
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 0 g: 0 b: 0
r: 11 g: 11 b: 11

Note that if you make either r, g, or b 11 or higher its value is preserved properly.

Edit: OK, the problem is not with [x]ToXYZ it is with XYZ back to x, I'm guessing some kind of rounding error?

i luffs yeww

2010-12-11 21:56:46

Definitely a rounding error is all.

mastaraymond

2010-12-12 05:28:43

No, this is a bug.

i luffs yeww

2010-12-12 05:32:07

Definitely a bug is all.

mastaraymond

2010-12-12 05:43:31

Fixed it :). Made a stupid math error (divided instead of multiplying)

any_one

2010-12-12 06:16:58

Nice. (Just out of curiosity) when will this show up in simba? Next "release" version? Or is it updated quite often :)

mastaraymond

2010-12-12 06:19:19

From: any_one
Nice. (Just out of curiosity) when will this show up in simba? Next "release" version? Or is it updated quite often :)

Not sure, yet. I can't commit it since I don't have the commit rights on this PC, so might take a while :(. This bug only appears when either of the RGB components have a value below 10 :P.

Wizzup?

2010-12-12 07:46:33

From: any_one
Nice. (Just out of curiosity) when will this show up in simba? Next "release" version? Or is it updated quite often :)


If there is an important update, we can release an upgrade quickly. I'll upload it to the unstable branch later today. (See my signature)

Wizzup?

2011-01-09 07:16:36

See Simba 0.95RC; should be fixed in there.