Tekening

Check-in [4d0f6cf5ac]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Middle button picks a random color. Bitmap is now the size of the full desktop.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1: 4d0f6cf5ac6edaaafcd774c9a7c745d58bf3a86b
User & Date: tinus 2017-03-28 18:15:05
Context
2017-03-28
18:21
Changed parse mode to Delphi, since Lazarus 1.0 doesn't support DelphiUnicode. check-in: e90bec57c7 user: tinus tags: develop
18:15
Middle button picks a random color. Bitmap is now the size of the full desktop. check-in: 4d0f6cf5ac user: tinus tags: develop
2017-03-26
16:01
Added ignore-glob. check-in: 6409f446ba user: tinus tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .fossil-settings/ignore-glob.

1
2

3

*.bak
src/lib/

src/tekening.lps



>
|
>
1
2
3
4
5
*.bak
src/lib/
src/*.lps
src/tekening
src/tekening.exe

Added .fossil-settings/ignore-glob.no-warn.

Changes to src/f_main.lfm.

11
12
13
14
15
16
17
18
19
20
  OnKeyDown = FormKeyDown
  OnMouseDown = FormMouseDown
  OnMouseMove = FormMouseMove
  OnMouseUp = FormMouseUp
  OnPaint = FormPaint
  OnUTF8KeyPress = FormUTF8KeyPress
  Position = poDesktopCenter
  LCLVersion = '1.0.10.0'
  WindowState = wsFullScreen
end







|


11
12
13
14
15
16
17
18
19
20
  OnKeyDown = FormKeyDown
  OnMouseDown = FormMouseDown
  OnMouseMove = FormMouseMove
  OnMouseUp = FormMouseUp
  OnPaint = FormPaint
  OnUTF8KeyPress = FormUTF8KeyPress
  Position = poDesktopCenter
  LCLVersion = '1.6.4.0'
  WindowState = wsFullScreen
end

Changes to src/f_main.pas.

47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
..
69
70
71
72
73
74
75





76
77
78
79
80
81
82
..
91
92
93
94
95
96
97

98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  LCLIntf;

{$R *.lfm}

{ TfrmTekening }

procedure TfrmTekening.FormCreate(Sender: TObject);
var
  XY: TPoint;
begin
  FPNG := TPortableNetworkGraphic.Create;
  FPNG.PixelFormat := pf32bit;
  FPNG.Transparent := False;
  FPNG.SetSize(ClientWidth, ClientHeight);

  FPNG.Canvas.Brush.Style := bsSolid;
  FPNG.Canvas.Brush.Color := Self.Color;
  FPNG.Canvas.FillRect(0, 0, FPNG.Width, FPNG.Height);

  FColor := clPurple;
  FPNG.Canvas.Pen.Color := FColor;
  FPNG.Canvas.Pen.Width := 10;
................................................................................

  Self.Canvas.Pen.Color := FColor;
  Self.Canvas.Pen.Width := 10;
  Self.Canvas.Font.Size := 30;

  FDrawing := dsDrawing;
  FSkip := True;





end;

procedure TfrmTekening.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
const
  cKeyColors: array[VK_F1..VK_F12] of TColor =
    ( $00000000  // F1
................................................................................
    , $00880000  // F10
    , $00888888  // F11
    , $00880088  // F12
    );
begin
  if Key in [VK_F1..VK_F12] then begin
    FColor := cKeyColors[Key];

    Key := 0;
  end;
end;

procedure TfrmTekening.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
  OnMouseDown := nil;
  OnMouseMove := nil;

  FPNG.SaveToFile(IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME')) + 'tekening-' + FormatDateTime('yyyy-MM-dd_hh.nn.ss', Now) + '.png');
  FPNG.Free;
end;

procedure TfrmTekening.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  LColor: TColor;
begin
  MoveTo(X, Y);
  if FDrawing <> dsNothing then begin
    FDrawing := dsNothing;
  end else begin
    if ssLeft in Shift then begin
      FDrawing := dsDrawing;
      LColor := FColor;
    end else begin
      FDrawing := dsErasing;
      LColor := Self.Color;
    end;
    LineTo(X, Y, LColor);



  end;
end;

procedure TfrmTekening.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  LColor: TColor;
begin
  if FSkip or (FDrawing = dsNothing) then begin
    MoveTo(X, Y);
  end else begin
    if FDrawing = dsDrawing then
      LColor := FColor
    else
      LColor := Self.Color;
    LineTo(X, Y, LColor);
  end;
  FSkip := False;
end;

procedure TfrmTekening.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

end;
................................................................................
  Self.Canvas.Draw(ClientOrigin.X, ClientOrigin.Y, FPNG);
end;

procedure TfrmTekening.FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char
  );
begin
  if (UTF8Key >= #32) then begin
    TextOut(FPNG.Canvas, UTF8String(UTF8Key));
    TextOut(Self.Canvas, UTF8String(UTF8Key));
    FSkip := True;
  end;
end;

procedure TfrmTekening.MoveTo(const X, Y: Integer);
begin
  FPNG.Canvas.MoveTo(X, Y);







<
<


|

<
>







 







>
>
>
>
>







 







>
|








|





|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>





|
|
|
|
|
|
|
|
|
|
<
<
<







 







|
|







47
48
49
50
51
52
53


54
55
56
57

58
59
60
61
62
63
64
65
..
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149



150
151
152
153
154
155
156
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
  LCLIntf;

{$R *.lfm}

{ TfrmTekening }

procedure TfrmTekening.FormCreate(Sender: TObject);


begin
  FPNG := TPortableNetworkGraphic.Create;
  FPNG.PixelFormat := pf24bit;
  FPNG.Transparent := False;

  FPNG.SetSize(Screen.DesktopWidth, Screen.DesktopHeight);
  FPNG.Canvas.Brush.Style := bsSolid;
  FPNG.Canvas.Brush.Color := Self.Color;
  FPNG.Canvas.FillRect(0, 0, FPNG.Width, FPNG.Height);

  FColor := clPurple;
  FPNG.Canvas.Pen.Color := FColor;
  FPNG.Canvas.Pen.Width := 10;
................................................................................

  Self.Canvas.Pen.Color := FColor;
  Self.Canvas.Pen.Width := 10;
  Self.Canvas.Font.Size := 30;

  FDrawing := dsDrawing;
  FSkip := True;

  Self.BorderStyle := bsNone;
  Self.SetBounds(Screen.DesktopLeft, Screen.DesktopTop, Screen.DesktopWidth, Screen.DesktopHeight);

  Randomize;
end;

procedure TfrmTekening.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
const
  cKeyColors: array[VK_F1..VK_F12] of TColor =
    ( $00000000  // F1
................................................................................
    , $00880000  // F10
    , $00888888  // F11
    , $00880088  // F12
    );
begin
  if Key in [VK_F1..VK_F12] then begin
    FColor := cKeyColors[Key];
    if Shift = [] then
      Key := 0;
  end;
end;

procedure TfrmTekening.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
  OnMouseDown := nil;
  OnMouseMove := nil;

  FPNG.SaveToFile(IncludeTrailingPathDelimiter(GetUserDir) + 'tekening-' + FormatDateTime('yyyy-MM-dd_hh.nn.ss', Now) + '.png');
  FPNG.Free;
end;

procedure TfrmTekening.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  case Button of
    mbLeft: begin
      if FDrawing <> dsDrawing then
        FDrawing := dsDrawing
      else
        FDrawing := dsNothing;
    end;
    mbMiddle: begin
      FColor := RGB(Random(255), Random(255), Random(255));
      FDrawing := dsDrawing;
    end;
    mbRight: begin
      if FDrawing <> dsErasing then
        FDrawing := dsErasing
      else
        FDrawing := dsNothing;
    end;
  end;
end;

procedure TfrmTekening.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if FSkip then begin
    MoveTo(X, Y);
    FSkip := False;
  end;
  case FDrawing of
    dsNothing: MoveTo(X, Y);
    dsDrawing: LineTo(X, Y, FColor);
    dsErasing: LineTo(X, Y, Self.Color);
  end;



end;

procedure TfrmTekening.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin

end;
................................................................................
  Self.Canvas.Draw(ClientOrigin.X, ClientOrigin.Y, FPNG);
end;

procedure TfrmTekening.FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char
  );
begin
  if (UTF8Key >= #32) then begin
    TextOut(FPNG.Canvas, UnicodeUpperCase(UTF8String(UTF8Key)));
    TextOut(Self.Canvas, UnicodeUpperCase(UTF8String(UTF8Key)));
    FSkip := True;
  end;
end;

procedure TfrmTekening.MoveTo(const X, Y: Integer);
begin
  FPNG.Canvas.MoveTo(X, Y);

Changes to src/tekening.lpi.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
..
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
<?xml version="1.0"?>
<CONFIG>
  <ProjectOptions>
    <Version Value="9"/>
    <General>
      <SessionStorage Value="InProjectDir"/>
      <MainUnit Value="0"/>
      <Title Value="tekening"/>
      <ResourceType Value="res"/>
      <UseXPManifest Value="True"/>
      <Icon Value="0"/>
    </General>
    <i18n>
      <EnableI18N LFM="False"/>
    </i18n>
    <VersionInfo>

      <StringTable ProductVersion=""/>
    </VersionInfo>
    <BuildModes Count="1">
      <Item1 Name="Default" Default="True"/>
    </BuildModes>
    <PublishOptions>
      <Version Value="2"/>
................................................................................
        <PackageName Value="LCL"/>
      </Item1>
    </RequiredPackages>
    <Units Count="2">
      <Unit0>
        <Filename Value="tekening.pas"/>
        <IsPartOfProject Value="True"/>
        <UnitName Value="tekening"/>
      </Unit0>
      <Unit1>
        <Filename Value="f_main.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="frmTekening"/>
        <HasResources Value="True"/>
        <ResourceBaseClass Value="Form"/>
        <UnitName Value="f_main"/>
      </Unit1>
    </Units>
  </ProjectOptions>
  <CompilerOptions>
    <Version Value="11"/>
    <Target>
      <Filename Value="tekening"/>
    </Target>
    <SearchPaths>
      <IncludeFiles Value="$(ProjOutDir)"/>
      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    </SearchPaths>





    <Linking>
      <Options>
        <Win32>
          <GraphicApplication Value="True"/>
        </Win32>
      </Options>
    </Linking>
    <Other>
      <CompilerMessages>
        <MsgFileName Value=""/>
      </CompilerMessages>
      <CompilerPath Value="$(CompPath)"/>
    </Other>
  </CompilerOptions>
  <Debugging>
    <Exceptions Count="3">
      <Item1>
        <Name Value="EAbort"/>
      </Item1>
      <Item2>
|


|












>







 







<







<












>
>
>
>
>







<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
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
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
  <ProjectOptions>
    <Version Value="10"/>
    <General>
      <SessionStorage Value="InProjectDir"/>
      <MainUnit Value="0"/>
      <Title Value="tekening"/>
      <ResourceType Value="res"/>
      <UseXPManifest Value="True"/>
      <Icon Value="0"/>
    </General>
    <i18n>
      <EnableI18N LFM="False"/>
    </i18n>
    <VersionInfo>
      <MajorVersionNr Value="1"/>
      <StringTable ProductVersion=""/>
    </VersionInfo>
    <BuildModes Count="1">
      <Item1 Name="Default" Default="True"/>
    </BuildModes>
    <PublishOptions>
      <Version Value="2"/>
................................................................................
        <PackageName Value="LCL"/>
      </Item1>
    </RequiredPackages>
    <Units Count="2">
      <Unit0>
        <Filename Value="tekening.pas"/>
        <IsPartOfProject Value="True"/>

      </Unit0>
      <Unit1>
        <Filename Value="f_main.pas"/>
        <IsPartOfProject Value="True"/>
        <ComponentName Value="frmTekening"/>
        <HasResources Value="True"/>
        <ResourceBaseClass Value="Form"/>

      </Unit1>
    </Units>
  </ProjectOptions>
  <CompilerOptions>
    <Version Value="11"/>
    <Target>
      <Filename Value="tekening"/>
    </Target>
    <SearchPaths>
      <IncludeFiles Value="$(ProjOutDir)"/>
      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
    </SearchPaths>
    <Parsing>
      <SyntaxOptions>
        <SyntaxMode Value="DelphiUnicode"/>
      </SyntaxOptions>
    </Parsing>
    <Linking>
      <Options>
        <Win32>
          <GraphicApplication Value="True"/>
        </Win32>
      </Options>
    </Linking>






  </CompilerOptions>
  <Debugging>
    <Exceptions Count="3">
      <Item1>
        <Name Value="EAbort"/>
      </Item1>
      <Item2>

Changes to src/tekening.res.

cannot compute difference between binary files