-
Notifications
You must be signed in to change notification settings - Fork 33
/
intensityfilterform.pas
63 lines (49 loc) · 1.24 KB
/
intensityfilterform.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
unit intensityFilterForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, StdCtrls,
ExtCtrls;
type
{ TIntensityFilterForm }
TIntensityFilterForm = class(TForm)
ActionDrop: TComboBox;
CancelBtn: TButton;
Panel1: TPanel;
RampAbove: TTrackBar;
RampBelow: TTrackBar;
OKBtn: TButton;
BackShape: TShape;
FrontShape: TShape;
procedure RampAboveChange(Sender: TObject);
private
procedure CreateGraph();
public
end;
var
IntensityFilterForm: TIntensityFilterForm;
implementation
{$R *.lfm}
{ TIntensityFilterForm }
procedure TIntensityFilterForm.CreateGraph();
var
Lo,Hi, R, Wid: single;
begin
Lo := min(RampAbove.Position, RampBelow.Position);
Hi := max(RampAbove.Position, RampBelow.Position);
Wid := ShapeBack.Width;
if (RampAbove.Position > RampBelow.Position) then begin
FrontShape.Color:=clRed;
BackShape.Color:=clBlack;
end else begin
FrontShape.Color:=clBlack;
BackShape.Color:=clRed;
end;
FrontShape.Left := round((Lo/RampAbove.Max) * Wid)+1;
FrontShape.Width := round(((Hi-Lo)/RampAbove.Max) * Wid)+1;
end;
procedure TIntensityFilterForm.RampAboveChange(Sender: TObject);
begin
CreateGraph();
end;
end.