forked from hkociemba/CubeExplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebCam.pas
102 lines (78 loc) · 2.45 KB
/
WebCam.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
unit WebCam;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DSPack, CubeDefs, Menus;
type
TCaptureForm = class(TForm)
VideoWindow: TVideoWindow;
PopupMenu1: TPopupMenu;
red1: TMenuItem;
orange1: TMenuItem;
procedure FormPaint(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure redClick(Sender: TObject);
procedure orangeClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
CaptureForm: TCaptureForm;
faceValue,scanValue,faceHue,scanHue,faceSaturation,scanSaturation,
faceBlueRel,scanBlueRel:array[U1..B9] of Integer;
fRed,fGreen,fBlue:Real;
implementation
uses RubikMain;
{$R *.dfm}
procedure TCaptureForm.FormPaint(Sender: TObject);
begin
Canvas.Draw(0,0,bmap);
end;
procedure TCaptureForm.FormCreate(Sender: TObject);
begin
doublebuffered:=true
end;
procedure TCaptureForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
Form1.FilterGraph.Stop;
Form1.FilterGraph.Active := false;
Form1.CapDevs.ItemIndex:=-1;
Form1.CapFormat.Enabled:=false;
Form1.CapConfig.Enabled:=false;
Form1.BScan.Enabled:=false;
Form1.RbU.Enabled:=false;Form1.RbR.Enabled:=false;Form1.RbF.Enabled:=false;
Form1.RbD.Enabled:=false;Form1.RbL.Enabled:=false;Form1.RbB.Enabled:=false;
end;
procedure TCaptureForm.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=88) then
if not (ssCtrl in Shift) then inc(xDist) else dec(Xdist)
else if (Key=89) then
if not (ssCtrl in Shift) then inc(yDist) else dec(yDist);
if xDist<-9 then xDist:=-9 else if xDist>9 then xDist:=9;
if yDist<-7 then yDist:=-7 else if yDist>7 then yDist:=7;
end;
procedure TCaptureForm.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button=mbRight then
begin capXPos:=x; capYPos:=y; end;
end;
procedure TCaptureForm.redClick(Sender: TObject);
begin
redRequest:=true;
end;
procedure TCaptureForm.orangeClick(Sender: TObject);
begin
orangeRequest:=true;
end;
end.