lol this is how my auto roadcolor is based off.. first it trys* to find the color then.. if not found i use..
SCAR Code:
function AMostColor(DataColor : TIntegerArray; x1, y1, x2, y2 : Integer) : Integer;
var
i, most, index, Length, count: integer;
begin
Length := GetArrayLength(DataColor);
if (Length = 0) then Exit;
Most := CountColor(DataColor[0], x1, y1, x2, y2);
for i := 0 to Length-1 do
begin
Count := CountColor(DataColor[i], x1, y1, x2, y2);
if (Count > Most) then
begin
Index := i;
Most := Count;
end;
end;
Result := DataColor[index];
end;