Cazax
2009-01-11 20:49:15
Function AutoColorIt(Color : TColor): Integer;
Var
TPA, TPA2 : TPointArray;
I, J, bestCol, maxTol : Integer;
Cols : TIntegerArray;
Begin
SetLength(TPA2, 0);
FindColorsTolerance(TPA, Color, MMX1, MMY1, MMX2, MMY2, 25);
For I := 0 To High(TPA) Do
If rs_OnMinimap(TPA[I].X, TPA[I].Y) Then
Begin
SetArrayLength(TPA2, Length(TPA2) + 1);
TPA2[High(TPA2)] := TPA[I];
End;
Cols := GetColors(TPA2);
maxTol := 50;
For I := 0 To High(Cols) Do
If SimilarColors(Cols[I], Color, maxTol) And (Cols[I] <> bestCol) Then
Begin
bestCol := Cols[I];
For J := 0 To 442 Do
If SimilarColors(bestCol, Color, J) Then
Begin
maxTol := J;
Break;
End;
End;
If maxTol > 30 Then
Exit;
Result := bestCol;
Writeln('Max Tolerance Found = ' + IntToStr(maxTol));
Writeln('Color = ' + IntToStr(Color));
End;Autocolors non-static colors. Checks for the best tolerance and color. No need for tolerance or other specifications, just insert the color.Now, some pics:
WaterColor:

Trees(in MM):

RoadColor:

:)