mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2025-09-21 22:53:51 +02:00
Project tree simplified
This commit is contained in:
58
Examples/GetPixel/GetPixel.dpr
Normal file
58
Examples/GetPixel/GetPixel.dpr
Normal file
@@ -0,0 +1,58 @@
|
||||
program GetPixelApp;
|
||||
|
||||
uses
|
||||
KolibriOS;
|
||||
|
||||
var
|
||||
Window, Rectangle: TRect;
|
||||
Point: TPoint;
|
||||
begin
|
||||
with Window, GetScreenSize do
|
||||
begin
|
||||
Right := Width div 4;
|
||||
Bottom := Height div 4;
|
||||
Left := (Width - Right) div 2;
|
||||
Top := (Height - Bottom) div 2;
|
||||
end;
|
||||
|
||||
with Rectangle do
|
||||
begin
|
||||
Left := 10;
|
||||
Top := 10;
|
||||
Right := Window.Right - 20;
|
||||
Bottom := Window.Bottom - 40;
|
||||
end;
|
||||
|
||||
SetEventMask(EM_REDRAW + EM_BUTTON + EM_MOUSE);
|
||||
|
||||
while True do
|
||||
case WaitEvent of
|
||||
REDRAW_EVENT:
|
||||
begin
|
||||
BeginDraw;
|
||||
|
||||
with Window do
|
||||
DrawWindow(Left, Top, Right, Bottom, 'Get Pixel', $00FFFFFF,
|
||||
WS_SKINNED_FIXED + WS_COORD_CLIENT + WS_CAPTION, CAPTION_MOVABLE);
|
||||
|
||||
with Rectangle do
|
||||
begin
|
||||
DrawLine(Left, Top, Left, Bottom, 0);
|
||||
DrawLine(Right, Top, Right, Bottom, 0);
|
||||
DrawLine(Left, Top, Right, Top, 0);
|
||||
DrawLine(Left, Bottom, Right, Bottom, 0);
|
||||
end;
|
||||
|
||||
EndDraw;
|
||||
end;
|
||||
MOUSE_EVENT:
|
||||
begin
|
||||
Point := GetMousePos;
|
||||
with Rectangle, Point do
|
||||
DrawRectangle(Left + 1, Top + 1, Right - Left - 1, Bottom - Top - 1, GetPixel(X, Y));
|
||||
end;
|
||||
BUTTON_EVENT:
|
||||
if GetButton.ID = 1 then
|
||||
TerminateThread;
|
||||
end;
|
||||
end.
|
1
Examples/GetPixel/build.bat
Normal file
1
Examples/GetPixel/build.bat
Normal file
@@ -0,0 +1 @@
|
||||
@call "%~dp0..\..\Lib\build.bat" "%~dp0GetPixel"
|
Reference in New Issue
Block a user