pwnaz0r
2007-04-03 00:20:41
Well we dont have one of these and i thought it would be helpful to have for autocoloring.
function ColorToRGB(color : integer) : string;
var
red, blue, green : integer;
begin
red := (Color mod 256);
green := ((Color / 256) mod 256);
blue := ((Color / 256) / 256);
result := ('Red : '+ IntToStr(Red) +', Green : '+ IntToStr(Green)+', Blue : '+ IntToStr(Blue));
Writeln(result);
end;
function GetRanges(colorarray : array of integer) : string;
var
qwerty12, ffgf, hhhh, hhhhh : integer;
iColor1, iColor2, maxdiff1, maxdiff2 : extended;
begin
qwerty12 := (GetArrayLength(colorarray) - 1);
for ffgf := 0 to qwerty12 do
begin
hhhh := hhhh + 1;
hhhhh := hhhh + 1;
If(ffgf = (qwerty12 - 1)) then break;
iColor1 := abs(colorarray[hhhh]);
iColor2 := abs(colorarray[hhhhh]);
If(iColor1 = iColor2)then maxdiff1 := 0;
If(iColor1 > iColor2)then maxdiff1 := iColor1 - iColor2;
If(iColor2 > iColor1)then maxdiff1 := iColor2 - iColor1;
If(maxdiff1 < maxdiff2)then maxdiff1 := maxdiff2;
end;
result := 'Max Difference is '+ IntToStr(ExtToInt(maxdiff1));
writeln(result);
end;