1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-22 01:02:17 -05:00

Added support for array pointers.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@13 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-09-04 01:59:31 +00:00
parent 50ce4db8b4
commit f14b73983b
7 changed files with 621 additions and 488 deletions

View File

@ -20,6 +20,11 @@ type
procedure SetMousePos(X, Y: Integer);
procedure MouseButtonAction(x,y : integer; mClick: TClickType; mPress: TMousePress);
procedure ClickMouse(X, Y: Integer; mClick: TClickType);
{
Possibly change to GetMouseButtonStates? Then people can get the
states bitwise. Like X and WinAPI.
}
function IsMouseButtonDown(mType: TClickType): Boolean;
public
@ -129,17 +134,19 @@ var
rect : TRect;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
GetWindowRect(TClient(Client).MWindow.TargetHandle, Rect);
Windows.SetCursorPos(x + Rect.Left, y + Rect.Top);
{$ENDIF}
{$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
XWarpPointer(TClient(Client).MWindow.XDisplay, 0, TClient(Client).MWindow.CurWindow, 0, 0, 0, 0, X, Y);
XFlush(TClient(Client).MWindow.XDisplay);
XSetErrorHandler(Old_Handler);
{$ENDIF}
end;
procedure TMInput.MouseButtonAction(x,y : integer; mClick: TClickType; mPress: TMousePress);
@ -154,14 +161,14 @@ var
Input : TInput;
Rect : TRect;
{$ENDIF}
begin;
begin
{$IFDEF MSWINDOWS}
GetWindowRect(TClient(Client).MWindow.TargetHandle, Rect);
Input.Itype:= INPUT_MOUSE;
Input.mi.dx:= x + Rect.left;
Input.mi.dy:= y + Rect.Top;
if mPress = mouse_Down then
begin;
begin
case mClick of
Mouse_Left: Input.mi.dwFlags:= MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTDOWN;
Mouse_Middle: Input.mi.dwFlags:= MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_MIDDLEDOWN;
@ -175,6 +182,7 @@ begin;
end;
SendInput(1,Input, sizeof(Input));
{$ENDIF}
{$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
@ -209,8 +217,6 @@ begin;
{$ENDIF}
end;
// ff omzetten naar MouseButtonDown(), en dan Click gewoon down en dan up.
// holdmouse releasemouse
procedure TMInput.ClickMouse(X, Y: Integer; mClick: TClickType);
begin
@ -228,6 +234,7 @@ var
Old_Handler: TXErrorHandler;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
case mType of
Mouse_Left: Result := (GetAsyncKeyState(VK_LBUTTON) <> 0);
@ -235,6 +242,7 @@ begin
mouse_Right: Result := (GetAsyncKeyState(VK_RBUTTON) <> 0);
end;
{$ENDIF}
{$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
XQueryPointer(TClient(Client).MWindow.XDisplay,TClient(Client).MWindow.CurWindow,@root,@child,@rootx,@rooty,@x,@y,@xmask);
@ -247,6 +255,7 @@ begin
XSetErrorHandler(Old_Handler);
{$ENDIF}
end;
end.

View File

@ -5,11 +5,11 @@ unit Window;
interface
uses
Classes, SysUtils, mufasatypes
Classes, SysUtils, mufasatypes,
{$IFDEF MSWINDOWS}
,windows // For windows API
{$ENDIF}
, graphics,
graphics,
LCLType,
LCLIntf // for ReleaseDC and such
@ -33,7 +33,7 @@ type
function UpdateDrawBitmap:boolean;
{$ENDIF}
function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
function SetTarget(ArrPtr: PRGB32): integer; overload;
function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
constructor Create(Client: TObject);
destructor Destroy; override;
@ -91,6 +91,9 @@ type
{$ENDIF}
ArrayPtr: PRGB32;
ArraySize: TPoint;
end;
@ -107,6 +110,10 @@ constructor TMWindow.Create(Client: TObject);
begin
inherited Create;
Self.Client := Client;
Self.ArrayPtr := nil;
Self.ArraySize := Point(-1, -1);
{$IFDEF MSWINDOWS}
Self.DrawBitmap := TBitmap.Create;
Self.TargetMode:= w_Window;
@ -114,6 +121,7 @@ begin
Self.TargetDC:= GetWindowDC(Self.TargetHandle);
Self.UpdateDrawBitmap;
{$ENDIF}
{$IFDEF LINUX}
Self.TargetMode := w_XWindow;
@ -153,6 +161,8 @@ function TMWindow.ReturnData(xs, ys, width, height: Integer): PRGB32;
var
Old_Handler: TXErrorHandler;
{$ENDIF}
TmpData: PRGB32;
begin
case Self.TargetMode of
w_Window:
@ -186,6 +196,12 @@ begin
WriteLn('Windows doesn''t support XImage');
{$ENDIF}
end;
w_ArrayPtr:
begin
TmpData := Self.ArrayPtr;
Inc(TmpData, ys * Height + xs);
Result := TmpData;
end;
end;
end;
@ -221,13 +237,16 @@ begin
inttostr(ye));
ww := xe-xs;
hh := ye-ys;
if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
begin
writeln('Faulty coordinates');
exit;
end;
case Self.TargetMode Of
w_Window:
begin
{$IFDEF MSWINDOWS}
if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
Writeln('pervet');
Result := TBitmap.Create;
Result.SetSize(ww+1,hh+1);
BitBlt(result.canvas.handle,0,0,ww+1,hh+1,
@ -239,15 +258,7 @@ begin
{$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
begin
writeln('Faulty coordinates');
XSetErrorHandler(Old_Handler);
exit;
end;
Img := XGetImage(Self.XDisplay, Self.curWindow, xs, ys, ww, hh, AllPlanes, ZPixmap);
XImageToRawImage(Img, Raw);
Bmp := TBitmap.Create;
Bmp.LoadFromRawImage(Raw, False);
@ -266,6 +277,15 @@ begin
writeln('Windows and tXWindow');
{$ENDIF}
end;
w_ArrayPtr:
begin
ArrDataToRawImage(Self.ArrayPtr, Self.ArraySize, Raw);
Bmp := TBitmap.Create;
Bmp.LoadFromRawImage(Raw, False);
Result := Bmp;
end;
end;
end;
@ -336,6 +356,8 @@ begin
end;
w_ArrayPtr:
begin
W := Self.ArraySize.X;
H := Self.ArraySize.Y;
end;
end;
end;
@ -375,10 +397,28 @@ begin
{$ENDIF}
end;
function TMWindow.SetTarget(ArrPtr: PRGB32): integer; overload;
begin
{
This functionality is very BETA.
We have no way to send events to a window, so we should probably use the
desktop window?
eg: In mouse/keys: if Self.TargetMode not in [w_Window, w_XWindow], send it
to the desktop.
}
function TMWindow.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
begin
Self.ArrayPtr := ArrPtr;
Self.ArraySize := Size;
Self.TargetMode:= w_ArrayPtr;
{$IFDEF LINUX}
Self.CurWindow := Self.DesktopWindow;
{$ENDIF}
{$IFDEF WINDOWS}
Self.TargetHandle:= windows.GetDesktopWindow;
{$ENDIF}
end;
end.

View File

@ -6,19 +6,23 @@ interface
uses
Classes, SysUtils,
ctypes // for cint, etc
{$IFDEF LINUX},
ctypes, // for cint, etc
{$IFDEF LINUX}
x, xlib, // For X* stuff.
GraphType // For TRawImage
{$ENDIF};
GraphType, // For TRawImage
{$ENDIF}
mufasatypes;
{$IFDEF LINUX}
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
{$ENDIF}
implementation
{$IFDEF LINUX}
// Too global.
@ -81,5 +85,45 @@ Begin
End;
{$ENDIF}
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
Begin
RawImage.Init; { Calls raw.Description.Init as well }
RawImage.Description.PaletteColorCount:=0;
RawImage.Description.MaskBitsPerPixel:=0;
RawImage.Description.Width := Size.X;
RawImage.Description.Height:= Size.Y;
RawImage.Description.Format := ricfRGBA;
RawImage.Description.ByteOrder := riboLSBFirst;
RawImage.Description.BitOrder:= riboBitsInOrder; // should be fine
RawImage.Description.Depth:=24;
RawImage.Description.BitsPerPixel:=32;
RawImage.Description.LineOrder:=riloTopToBottom;
RawImage.Description.LineEnd := rileDWordBoundary;
RawImage.Description.RedPrec := 8;
RawImage.Description.GreenPrec:= 8;
RawImage.Description.BluePrec:= 8;
RawImage.Description.AlphaPrec:=0;
RawImage.Description.RedShift:=16;
RawImage.Description.GreenShift:=8;
RawImage.Description.BlueShift:=0;
RawImage.DataSize := RawImage.Description.Width * RawImage.Description.Height
* (RawImage.Description.bitsperpixel shr 3);
RawImage.Data := PByte(Ptr);
End;
end.

View File

@ -6,7 +6,7 @@
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="3"/>
<ActiveEditorIndexAtStart Value="2"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -38,7 +38,7 @@
<CursorPos X="1" Y="19"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="48"/>
<UsageCount Value="51"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -49,7 +49,7 @@
<UnitName Value="TestUnit"/>
<CursorPos X="33" Y="57"/>
<TopLine Value="32"/>
<UsageCount Value="48"/>
<UsageCount Value="51"/>
</Unit1>
<Unit2>
<Filename Value="client.pas"/>
@ -57,7 +57,7 @@
<UnitName Value="Client"/>
<CursorPos X="18" Y="34"/>
<TopLine Value="10"/>
<UsageCount Value="48"/>
<UsageCount Value="51"/>
</Unit2>
<Unit3>
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
@ -72,7 +72,7 @@
<UnitName Value="MufasaTypes"/>
<CursorPos X="52" Y="20"/>
<TopLine Value="1"/>
<UsageCount Value="48"/>
<UsageCount Value="51"/>
</Unit4>
<Unit5>
<Filename Value="window.pas"/>
@ -80,7 +80,7 @@
<UnitName Value="Window"/>
<CursorPos X="4" Y="100"/>
<TopLine Value="85"/>
<UsageCount Value="48"/>
<UsageCount Value="51"/>
</Unit5>
<Unit6>
<Filename Value="../Documents/fpc/rtl/inc/systemh.inc"/>
@ -94,7 +94,7 @@
<UnitName Value="Input"/>
<CursorPos X="5" Y="20"/>
<TopLine Value="15"/>
<UsageCount Value="47"/>
<UsageCount Value="50"/>
</Unit7>
<Unit8>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
@ -106,46 +106,48 @@
<Unit9>
<Filename Value="Units/MMLCore/client.pas"/>
<UnitName Value="Client"/>
<CursorPos X="27" Y="16"/>
<CursorPos X="46" Y="8"/>
<TopLine Value="1"/>
<EditorIndex Value="5"/>
<UsageCount Value="20"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="Units/MMLCore/input.pas"/>
<UnitName Value="Input"/>
<CursorPos X="52" Y="241"/>
<TopLine Value="222"/>
<EditorIndex Value="1"/>
<UsageCount Value="20"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="6"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
<Filename Value="Units/MMLCore/mufasatypes.pas"/>
<UnitName Value="MufasaTypes"/>
<CursorPos X="20" Y="3"/>
<CursorPos X="1" Y="18"/>
<TopLine Value="1"/>
<EditorIndex Value="2"/>
<UsageCount Value="20"/>
<EditorIndex Value="1"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="Units/MMLCore/window.pas"/>
<UnitName Value="Window"/>
<CursorPos X="9" Y="370"/>
<TopLine Value="353"/>
<EditorIndex Value="3"/>
<UsageCount Value="20"/>
<CursorPos X="10" Y="416"/>
<TopLine Value="396"/>
<EditorIndex Value="2"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit12>
<Unit13>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="windowutil"/>
<CursorPos X="45" Y="13"/>
<TopLine Value="1"/>
<UsageCount Value="40"/>
<CursorPos X="53" Y="122"/>
<TopLine Value="100"/>
<EditorIndex Value="3"/>
<UsageCount Value="43"/>
<Loaded Value="True"/>
</Unit13>
<Unit14>
<Filename Value="../Documents/lazarus/lcl/graphics.pp"/>
@ -180,10 +182,10 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="44" Y="67"/>
<TopLine Value="50"/>
<CursorPos X="41" Y="71"/>
<TopLine Value="54"/>
<EditorIndex Value="4"/>
<UsageCount Value="17"/>
<UsageCount Value="19"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
@ -282,103 +284,127 @@
<UsageCount Value="10"/>
</Unit32>
</Units>
<JumpHistory Count="24" HistoryIndex="23">
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="18" Column="30" TopLine="1"/>
<Caret Line="215" Column="10" TopLine="205"/>
</Position1>
<Position2>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="156" Column="10" TopLine="146"/>
<Caret Line="225" Column="19" TopLine="215"/>
</Position2>
<Position3>
<Filename Value="testunit.pas"/>
<Caret Line="58" Column="34" TopLine="43"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="239" Column="19" TopLine="229"/>
</Position3>
<Position4>
<Filename Value="testunit.pas"/>
<Caret Line="28" Column="59" TopLine="1"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="261" Column="17" TopLine="251"/>
</Position4>
<Position5>
<Filename Value="project1.lpr"/>
<Caret Line="16" Column="60" TopLine="1"/>
<Filename Value="testunit.pas"/>
<Caret Line="68" Column="20" TopLine="53"/>
</Position5>
<Position6>
<Filename Value="project1.lpr"/>
<Caret Line="19" Column="1" TopLine="1"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="329" Column="14" TopLine="298"/>
</Position6>
<Position7>
<Filename Value="testunit.pas"/>
<Caret Line="50" Column="42" TopLine="35"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="10" Column="10" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="testunit.pas"/>
<Caret Line="62" Column="32" TopLine="59"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="367" Column="46" TopLine="353"/>
</Position8>
<Position9>
<Filename Value="testunit.pas"/>
<Caret Line="57" Column="22" TopLine="41"/>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="115" Column="36" TopLine="106"/>
</Position9>
<Position10>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="18" Column="27" TopLine="14"/>
<Caret Line="114" Column="24" TopLine="99"/>
</Position10>
<Position11>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="169" Column="16" TopLine="159"/>
<Caret Line="94" Column="26" TopLine="79"/>
</Position11>
<Position12>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="170" Column="16" TopLine="159"/>
<Filename Value="testunit.pas"/>
<Caret Line="58" Column="78" TopLine="45"/>
</Position12>
<Position13>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="176" Column="14" TopLine="159"/>
<Filename Value="testunit.pas"/>
<Caret Line="63" Column="37" TopLine="48"/>
</Position13>
<Position14>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="180" Column="17" TopLine="171"/>
<Filename Value="testunit.pas"/>
<Caret Line="69" Column="41" TopLine="68"/>
</Position14>
<Position15>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="181" Column="16" TopLine="171"/>
<Filename Value="testunit.pas"/>
<Caret Line="73" Column="37" TopLine="64"/>
</Position15>
<Position16>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="210" Column="16" TopLine="205"/>
<Caret Line="26" Column="40" TopLine="11"/>
</Position16>
<Position17>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="215" Column="10" TopLine="205"/>
<Caret Line="276" Column="28" TopLine="250"/>
</Position17>
<Position18>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="225" Column="19" TopLine="215"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="22" Column="5" TopLine="12"/>
</Position18>
<Position19>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="239" Column="19" TopLine="229"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="48" Column="39" TopLine="32"/>
</Position19>
<Position20>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="261" Column="17" TopLine="251"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="52" Column="50" TopLine="39"/>
</Position20>
<Position21>
<Filename Value="testunit.pas"/>
<Caret Line="68" Column="20" TopLine="53"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="9" Column="10" TopLine="1"/>
</Position21>
<Position22>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="329" Column="14" TopLine="298"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="10" Column="17" TopLine="1"/>
</Position22>
<Position23>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="10" Column="10" TopLine="1"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="11" Column="3" TopLine="1"/>
</Position23>
<Position24>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="367" Column="46" TopLine="353"/>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="12" Column="13" TopLine="1"/>
</Position24>
<Position25>
<Filename Value="Units/MMLCore/windowutil.pas"/>
<Caret Line="88" Column="1" TopLine="1"/>
</Position25>
<Position26>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="275" Column="60" TopLine="251"/>
</Position26>
<Position27>
<Filename Value="Units/MMLCore/client.pas"/>
<Caret Line="8" Column="46" TopLine="1"/>
</Position27>
<Position28>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="419" Column="3" TopLine="390"/>
</Position28>
<Position29>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="382" Column="66" TopLine="369"/>
</Position29>
<Position30>
<Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="202" Column="11" TopLine="187"/>
</Position30>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 966
Left = 1696
Height = 527
Top = 461
Top = 262
Width = 779
ActiveControl = Button1
Caption = 'Form1'

View File

@ -1,9 +1,9 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#198#3#6'Height'#3#15#2#3'Top'#3#205#1#5'W'
+'idth'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'Client'
+'Height'#3#15#2#11'ClientWidth'#3#11#3#10'LCLVersion'#6#6'0.9.29'#0#7'TButto'
+'n'#7'Button1'#4'Left'#2'E'#6'Height'#2#25#3'Top'#2' '#5'Width'#2'K'#7'Capti'
+'on'#6#7'Button1'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#0
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#160#6#6'Height'#3#15#2#3'Top'#3#6#1#5'Wid'
+'th'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientHe'
+'ight'#3#15#2#11'ClientWidth'#3#11#3#10'LCLVersion'#6#6'0.9.29'#0#7'TButton'
+#7'Button1'#4'Left'#2'E'#6'Height'#2#25#3'Top'#2' '#5'Width'#2'K'#7'Caption'
+#6#7'Button1'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#0
]);

View File

@ -44,9 +44,10 @@ type
procedure TMyThread.Execute;
Var
Client: TClient;
w,h, x, y, xx, yy:integer;
w,h, x, y, xx, yy, i:integer;
bmp: TBitmap;
ptr: PRGB32;
arr: Array Of Integer;
begin
while (not Terminated) do
@ -58,12 +59,25 @@ begin
Client.MWindow.GetDimensions(w, h);
writeln(inttostr(w) + ' , ' + inttostr(h));
Writeln('Setting target');
Client.MWindow.SetTarget(132840,w_window);
//Client.MWindow.SetTarget(132840,w_window);
SetLength(Arr, 9);
for i := 0 to high(arr) do
arr[i] := $FFFFFF;
Client.MWIndow.SetTarget(PRGB32(@Arr[0]), Point(3, 3));
Client.MWindow.ActivateClient;
Client.MWindow.GetDimensions(w, h);
Writeln('Copying BMP');
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
{$IFDEF WINDOWS}
bmp.SaveToFile('c:\test.bmp');
{$ENDIF}
{$IFDEF LINUX}
bmp.SaveToFile('/tmp/test.bmp');
{$ENDIF}
bmp.Free;
//Sleep(1000);