SRL Archive - SRL Archives

Something Stupid..


Home

2006-09-22 05:01:57

I didn't know where else to post this :P

This won't even probs work.. Or wtf i was even thinking :duh:
[PHP]
//GetColor With Tolerance :P

Function GetColorTol(Px, Py, TheColor, Tol: integer): boolean;
Var
Aha, Times: integer;
Begin
Times := 0;
Aha := 0;
Repeat
Times := Times + 1;
If (GetColor(Px, Py) = TheColor + Aha) Then
Result := true
Aha := Aha + 1;
Until (Times = Tol) Or (Result)
End;[/PHP]

… *Laughs :P*

EDIT: Now when i look it :/ it really looks it won't work..

Yakman

2006-09-22 10:31:41

try this


//function SimilarColors(col1, col2, tolerance: integer): Boolean - Function to test weather two colors are within tolerance range. If they are within range, it returns true, if not false.
good luck with that

Mad Cow

2006-09-23 20:40:46

And that could also be simplified to..

Function GetColorTol(Px, Py, TheColor, Tol: integer): boolean;
Var
Aha : integer;
Begin
Aha := 0;
Repeat
If (GetColor(Px, Py) = TheColor + Aha) Then
Result := true
Aha := Aha + 1;
Until (Aha = Tol) Or (Result)
End;