Roberty Bob
2006-07-01 06:18:19
I couldn't find anything to do this in SRL. I know it is simple :). But I think it is quite useful.
One example useage: In my autocolor procedure, I use this to check colors against a "blacklist" array of colors. I have a triple iteractive searach process with an increasing searchbox size and tolerance while stepping through a reference color array.
IsColorInArray performs a quick quick whether a color is blacklisted before proceeding in the AutoColor function.
I've attached a demonstration of its useage. :D ENJOY.
[PHP]
{*******************************************************************************
function IsColorInArray (var TheColor:integer ; TheArray: array of Integer; ArraySize:integer):boolean;
By: Roberty Bob
Description: Returns true if the specified color is found in the array.
*******************************************************************************}
function IsColorInArray (var TheColor:integer ; TheArray: array of Integer; ArraySize:integer):boolean;
var
ColorFound: boolean;
var
i: integer;
begin
ColorFound:= false;
i:= 0;
repeat
if TheArray= TheColor then
begin
ColorFound:= true;
break;
end;
i:= i+1;
until i = (ArraySize)
result:= ColorFound;
end;
[/PHP]
One example useage: In my autocolor procedure, I use this to check colors against a "blacklist" array of colors. I have a triple iteractive searach process with an increasing searchbox size and tolerance while stepping through a reference color array.
IsColorInArray performs a quick quick whether a color is blacklisted before proceeding in the AutoColor function.
I've attached a demonstration of its useage. :D ENJOY.
[PHP]
{*******************************************************************************
function IsColorInArray (var TheColor:integer ; TheArray: array of Integer; ArraySize:integer):boolean;
By: Roberty Bob
Description: Returns true if the specified color is found in the array.
*******************************************************************************}
function IsColorInArray (var TheColor:integer ; TheArray: array of Integer; ArraySize:integer):boolean;
var
ColorFound: boolean;
var
i: integer;
begin
ColorFound:= false;
i:= 0;
repeat
if TheArray= TheColor then
begin
ColorFound:= true;
break;
end;
i:= i+1;
until i = (ArraySize)
result:= ColorFound;
end;
[/PHP]