2
FPVectorial example application for writing vectorial images
3
generated in code to disk. This program will generate the following
6
single_line_1 One line from (0, 20) to (30, 30)
7
single_line_2 One line from (20, 30) to (30, 20)
8
polyline_1 One line from (0, 0) to (10, 10) to (20, 30) to (30, 20)
9
polyline_2 One line from (10, 10) to (20, 30) to (30, 20) to (40, 40)
10
bezier_1 One path starting in (0, 0) lining to (10, 10) then bezier to (20, 10) and then line to (30, 0)
11
bezier_2 One curve from (10, 10) to (20, 20)
12
text_ascii One text written at (10, 10)
13
text_europen One text testing european languages at (20, 20)
14
text_asian One text testing asian languages at (30, 30)
16
Author: Felipe Monteiro de Carvalho
18
License: Public Domain
25
fpvectorial, svgvectorialwriter, fpvutils, fpvectorialpkg;
31
Vec: TvVectorialDocument;
32
Page: TvVectorialPage;
34
Vec := TvVectorialDocument.Create;
36
// All documents are 10cm x 10cm
39
Page := Vec.AddPage();
41
// single_line_1 One line from (0, 20) to (30, 30)
42
Page.StartPath(0, 20);
43
Page.AddLineToPath(30, 30);
45
Vec.WriteToFile('single_line_1' + cExtension, cFormat);
47
// single_line_2 One line from (20, 30) to (30, 20)
49
Page.StartPath(20, 30);
50
Page.AddLineToPath(30, 20);
52
Vec.WriteToFile('single_line_2' + cExtension, cFormat);
54
// single_line_3 One line from (0, 20) to (30, 30) + frame
56
Page.StartPath(0, 20);
57
Page.AddLineToPath(30, 30);
60
Page.AddLineToPath(100, 0);
61
Page.AddLineToPath(100, 100);
62
Page.AddLineToPath(0, 100);
63
Page.AddLineToPath(0, 0);
65
Vec.WriteToFile('single_line_3' + cExtension, cFormat);
67
// polyline_1 One line from (0, 0) to (10, 10) to (20, 30) to (30, 20)
70
Page.AddLineToPath(10, 10);
71
Page.AddLineToPath(20, 30);
72
Page.AddLineToPath(30, 20);
74
Vec.WriteToFile('polyline_1' + cExtension, cFormat);
76
// polyline_2 One line from (10, 10) to (20, 30) to (30, 20) to (40, 40)
78
Page.StartPath(10, 10);
79
Page.AddLineToPath(20, 30);
80
Page.AddLineToPath(30, 20);
81
Page.AddLineToPath(40, 40);
83
Vec.WriteToFile('polyline_2' + cExtension, cFormat);
85
// bezier_1 One path starting in (0, 0) lining to (10, 10) then bezier to (20, 10) and then line to (30, 0)
88
Page.AddLineToPath(10, 10);
89
Page.AddBezierToPath(10, 20, 20, 20, 20, 10);
90
Page.AddLineToPath(30, 0);
92
Vec.WriteToFile('bezier_1' + cExtension, cFormat);
94
// bezier_2 One curve from (10, 10) to (20, 20)
96
Page.StartPath(10, 10);
97
Page.AddBezierToPath(10, 15, 15, 20, 20, 10);
99
Vec.WriteToFile('bezier_2' + cExtension, cFormat);
101
// text_ascii One text written at (10, 10)
103
Page.AddText(10, 10, 0, '10,10 Some text in english.');
104
Vec.WriteToFile('text_ascii' + cExtension, cFormat);
106
// text_europen One text testing european languages at (20, 20)
108
Page.AddText(20, 20, 0, '20, 20 Mówić, cześć, Włosku, Parabéns, Assunção, Correções.');
109
Vec.WriteToFile('text_europen' + cExtension, cFormat);
111
// text_asian One text testing asian languages at (30, 30)
113
Page.AddText(30, 30, 0, '30, 30 森林,是一个高密度树木的区域');
114
Vec.WriteToFile('text_asian' + cExtension, cFormat);
116
// multi_test_1 Combines various elements
118
Page.StartPath(0, 20);
119
Page.AddLineToPath(30, 30);
121
Page.StartPath(0, 0);
122
Page.AddLineToPath(100, 0);
123
Page.AddLineToPath(100, 100);
124
Page.AddLineToPath(0, 100);
125
Page.AddLineToPath(0, 0);
127
Page.StartPath(0, 0);
128
Page.AddLineToPath(10, 10);
129
Page.AddBezierToPath(10, 20, 20, 20, 20, 10);
130
Page.AddLineToPath(30, 0);
132
Page.AddText(10, 10, 0, '10,10 Some text in english.');
133
Page.AddText(20, 20, 0, '20, 20 Mówić, cześć, Włosku, Parabéns.');
134
Page.AddText(30, 30, 0, '30, 30 森林,是一个高密');
135
Vec.WriteToFile('multi_test_1' + cExtension, cFormat);
137
// pen_test_1 Tests the properties of the Pen
139
Page.StartPath(0, 20);
140
Page.AddLineToPath(30, 30);
141
Page.SetPenWidth(10);
143
Page.StartPath(0, 0);
144
Page.AddLineToPath(100, 0);
145
Page.AddLineToPath(100, 100);
146
Page.AddLineToPath(0, 100);
147
Page.AddLineToPath(0, 0);
148
Page.SetPenWidth(10);
150
Page.StartPath(0, 0);
151
Page.AddLineToPath(10, 10);
152
Page.AddBezierToPath(10, 20, 20, 20, 20, 10);
153
Page.AddLineToPath(30, 0);
154
Page.SetPenWidth(10);
156
Vec.WriteToFile('pen_test_1' + cExtension, cFormat);
158
// pen_test_2 Tests the properties of the Pen
160
Page.StartPath(0, 20);
161
Page.AddLineToPath(30, 30);
162
Page.SetPenWidth(10);
163
Page.SetPenColor(RGBToFPColor(255, 0, 0));
165
Page.StartPath(0, 0);
166
Page.AddLineToPath(100, 0);
167
Page.AddLineToPath(100, 100);
168
Page.AddLineToPath(0, 100);
169
Page.AddLineToPath(0, 0);
170
Page.SetPenWidth(10);
171
Page.SetPenColor(RGBToFPColor(0, 255, 0));
173
Page.StartPath(0, 0);
174
Page.AddLineToPath(10, 10);
175
Page.AddBezierToPath(10, 20, 20, 20, 20, 10);
176
Page.AddLineToPath(30, 0);
177
Page.SetPenWidth(10);
178
Page.SetPenColor(RGBToFPColor(0, 0, 255));
180
Vec.WriteToFile('pen_test_2' + cExtension, cFormat);