scar Code:
{*******************************************************************************
function ListUniqueColours(x1, y1, x2, y2: Integer): TIntegerArray;
By: Dan's The Man
Description: Results a list of all the unique colours found within x1, y1 and x2,
y2.
*******************************************************************************}
function ListUniqueColours(x1, y1, x2, y2: Integer): TIntegerArray;
var
cL, rL: Integer;
begin
cL := 0;
rL := 0;
repeat
if(CountColor(cL, x1, y1, x2, y2) = 1) then
begin
SetLength(Result, rL + 1);
Result[rL] := cL;
Inc(rL);
end;
Inc(cL);
Until(cL > 16777215);
end;
{*******************************************************************************
function FindUniqueSymbolColour(BMP: Integer; x1, y1, x2, y2: Integer): Integer;
By: Dan's The Man
Description: Returns a unique colour from the bitmap BMP, results -1 if none
found.
*******************************************************************************}
function FindUniqueSymbolColour(BMP: Integer; x1, y1, x2, y2: Integer): Integer;
var
clw, clh, fx, fy: Integer;
I, D: Integer;
cmx, cmy: Integer;
fB: Boolean;
begin
Result := -1;
GetBitmapSize(BMP, clw, clh);
GetClientDimensions(cmx, cmy);
if(FindBitmapIn(BMP, fx, fy, x1, y1, x2, y2)) then
begin
clw := fx + clw;
clh := fy + clh;
for I := fy to clh do
for D := fx to clw do
begin
Result := GetColor(I, D);
if(CountColor(Result, 0, 0, cmx, cmy) = 1) then
Exit;
end;
end;
end;