1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-29 04:22:16 -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,3 +1,8 @@
function GetColor(x,y : integer) : TColor;
begin;
Result := CurrThread.Client.MWindow.GetColor(x,y);
end;
function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean; function findcolor(var x, y: integer; color, x1, y1, x2, y2: integer): boolean;
begin begin
Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2); Result := CurrThread.Client.MFinder.FindColor(x, y, color, x1, y1, x2, y2);

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}