1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 10:42:20 -05:00

Added GetColor

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@70 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2009-09-18 20:08:15 +00:00
parent a8c09d2149
commit 68c49e0774
3 changed files with 45 additions and 24 deletions

View File

@ -1,24 +1,29 @@
function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean; function GetColor(x,y : integer) : TColor;
begin begin;
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2); Result := CurrThread.Client.MWindow.GetColor(x,y);
end; end;
function findcolortolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean; function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;
begin begin
Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol); Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);
end; end;
function FindColors(var TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean; function findcolortolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;
begin begin
Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2); Result := CurrThread.Client.MFinder.FindColorTolerance(x, y, color, x1, y1, x2, y2, tol);
end; end;
procedure SetColorToleranceSpeed(cts: Integer); function FindColors(var TPA: TPointArray; Color, x1, y1, x2, y2: Integer): Boolean;
begin begin
CurrThread.Client.MFinder.SetToleranceSpeed(cts); Result := CurrThread.Client.MFinder.FindColors(TPA, color, x1, y1, x2, y2);
end; end;
function SimilarColors(Col1,Col2,Tol : integer) : boolean; procedure SetColorToleranceSpeed(cts: Integer);
begin; begin
Result := CurrThread.Client.MFinder.SimilarColors(Col1,Col2,Tol); CurrThread.Client.MFinder.SetToleranceSpeed(cts);
end; end;
function SimilarColors(Col1,Col2,Tol : integer) : boolean;
begin;
Result := CurrThread.Client.MFinder.SimilarColors(Col1,Col2,Tol);
end;

View File

@ -7,6 +7,7 @@ Sender.Comp.AddTypeS('TBmpMirrorStyle','(MirrorWidth,MirrorHeight,MirrorLine)');
Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;'); Sender.AddFunction(@ThreadSafeCall,'function ThreadSafeCall(ProcName: string; var V: TVariantArray): Variant;');
Sender.AddFunction(@psWriteln,'procedure writeln(s : string);'); Sender.AddFunction(@psWriteln,'procedure writeln(s : string);');
Sender.AddFunction(@GetColor,'function GetColor(x, y: Integer): Integer;');
Sender.AddFunction(@FindColor, 'function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;'); Sender.AddFunction(@FindColor, 'function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;');
Sender.AddFunction(@FindColorTolerance, 'function findcolortolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;'); Sender.AddFunction(@FindColorTolerance, 'function findcolortolerance(var x, y: integer; color, x1, y1, x2, y2, tol: integer): boolean;');
Sender.AddFunction(@FindColors, 'function findcolors(var TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;'); Sender.AddFunction(@FindColors, 'function findcolors(var TPA: TPointArray; color, x1, y1, x2, y2: integer): boolean;');

View File

@ -20,6 +20,7 @@ type
{ TMWindow } { TMWindow }
TMWindow = class(TObject) TMWindow = class(TObject)
function GetColor(x,y : integer) : TColor;
function ReturnData(xs, ys, width, height: Integer): TRetData; function ReturnData(xs, ys, width, height: Integer): TRetData;
procedure FreeReturnData; procedure FreeReturnData;
procedure GetDimensions(var W, H: Integer); procedure GetDimensions(var W, H: Integer);
@ -183,6 +184,20 @@ begin
inherited; inherited;
end; end;
function TMWindow.GetColor(x, y: integer): TColor;
begin
if Self.TargetMode = w_Window then
Result := GetPixel(Self.TargetDC,x,y)
else
begin
with ReturnData(x,y,1,1) do
Result := RGBToColor(Ptr[0].r,Ptr[0].g,Ptr[0].b);
FreeReturnData;
end;
end;
function TMWindow.ReturnData(xs, ys, width, height: Integer): TRetData; function TMWindow.ReturnData(xs, ys, width, height: Integer): TRetData;
var var
{$IFDEF LINUX} {$IFDEF LINUX}