Hi Roy,
This should fix that floating point issue:
if dr1 = 0 then dr1:=1;
r:= Trunc(r2 + (Pixel.r - r1) * dr2 / dr1);
if dg1 = 0 then dg1:=1;
g:= Trunc(g2 + (Pixel.g - g1) * dg2 / dg1);
if db1 = 0 then db1:=1;
b:= Trunc(b2 + (Pixel.b - b1) * db2 / db1);
if r < 0 then r:= 0 else if r > 255 then r:= 255;
if g < 0 then g:= 0 else if g > 255 then g:= 255;
if b < 0 then b:= 0 else if b > 255 then b:= 255;
But since you made the hard work. Can you verify that this is right fix for it :)
- Marko