-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.template
332 lines (254 loc) · 7.2 KB
/
README.template
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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
[Русская версия](README-ru.md)
# AutoCAD slide library and command line utilities
Features:
* Parse slide file format (.sld) [version 2.0](https://web.archive.org/web/20191223211310/http://www.autodesk.com/techpubs/autocad/acadr14/dxf/slide_file_format_al_u05_b.htm)
and [version 1.0](https://web.archive.org/web/20191223211321/https://www.autodesk.com/techpubs/autocad/acadr14/dxf/old_slide_header_al_u05_b.htm)
* Parse slide library file format (.slb) [version 1.0](https://web.archive.org/web/20191229052120/http://www.autodesk.com/techpubs/autocad/acadr14/dxf/slide_library_file_format_al_u05_b.htm)
* Create slide library from slides | [Example](#create-slide-library-from-slides)
* Import slides to slide library | [Example](#import-slides-to-slide-library)
* Export slides from slide library | [Example](#export-slides-from-slide-library)
* Delete slides from slide library | [Example](#delete-slides-from-slide-library)
* Convert slide to PNG and SVG | [Example](#convert-slide-to-png-and-svg)
* Create slide from text records | [Example](#create-slide-from-text-records)
* Print various info about slide | [Example](#print-various-info-about-slide)
* Print various info about slide library | [Example](#print-various-info-about-slide-library)
* Draw slide on [Cairo](https://www.cairographics.org/) surface | [Example](#draw-slide-on-cairo-surface)
* Draw slide on [Cairo](https://www.cairographics.org/) surface via [GObject Introspection](https://gi.readthedocs.io/en/latest/) | [Example](#draw-slide-on-cairo-surface-via-gobject-introspection)
* Backend for the `slide_image` function in [VeLisp](https://github.com/ten0s/velisp)
* Windows, MacOS and Linux support
## Install
### Windows
You can find the latest release [here](https://github.com/ten0s/slide/releases).
#### Install via automatic setup
1. Download https://github.com/ten0s/slide/releases/download/{{version}}/slide-{{version}}-win-x64-setup.zip
2. Open Downloads folder
3. Double-click on slide-{{version}}-win-x64-setup.zip to open the archive
4. Run slide-{{version}}-win-x64-setup.exe
5. Follow the installation wizard. Default options are ok for most users
#### Install via binary archive
##### Download and unarchive
1. Download https://github.com/ten0s/slide/releases/download/{{version}}/slide-{{version}}-win-x64.zip
2. Open Downloads folder
3. Select slide-{{version}}-win-x64.zip
4. Press the right mouse button
5. Click 'Extract All...'
6. Enter 'C:\'
7. Click 'Extract'
##### Add the folder to PATH
1. Press 'Windows + Break' to open the System Info
2. Click 'Advanced system settings'
3. Click 'Environment Variables...'
4. Select 'Path' inside the User variables block
5. Click 'Edit...'
6. Click 'New...'
7. Enter 'C:\slide-{{version}}-win-x64\bin'
8. Click 'OK'
9. Click 'OK'
### MacOS
#### Homebrew
You should have [Homebrew](https://brew.sh/) installed.
```
% brew tap ten0s/velisp
% brew install slide
```
### Linux
```
$ make
$ make install [PREFIX=$PWD/install]
```
## Examples
### Create slide from text records
```
$ cat test/square.txt
(COLOR 1) ; red
(SOLID_FILL_POLYGON 10 10 10 190 190 190 190 10)
(COLOR 2) ; yellow
(SOLID_FILL_POLYGON 20 20 20 180 180 180 180 20)
(COLOR 3) ; green
(SOLID_FILL_POLYGON 30 30 30 170 170 170 170 30)
(COLOR 5) ; blue
(SOLID_FILL_POLYGON 40 40 40 160 160 160 160 40)
(COLOR 255) ; white
(SOLID_FILL_POLYGON 50 50 50 150 150 150 150 50)
```
```
$ slide-create --width 200 --height 200 square.sld test/square.txt
```
```
$ cat test/triangle.txt
(COLOR 1) ; red
(VECTOR 10 10 100 190)
(VECTOR 100 190 190 10)
(VECTOR 190 10 10 10)
(VECTOR 20 20 100 180)
(VECTOR 100 180 180 20)
(VECTOR 180 20 20 20)
(VECTOR 40 40 100 160)
(VECTOR 100 160 160 40)
(VECTOR 160 40 40 40)
(VECTOR 80 80 100 120)
(VECTOR 100 120 120 80)
(VECTOR 120 80 80 80)
```
```
$ slide-create --width 200 --height 200 triangle.sld test/triangle.txt
```
### Create slide library from slides
#### Create empty slide library
```
$ slidelib-create mylib.slb
```
#### Create slide library from slide file
```
$ slidelib-create mylib.slb square.sld
```
#### Create slide library from multiple slide files
```
$ slidelib-create mylib.slb *.sld
```
### Print various slide info
#### Print info about slide file
```
$ slide-info square.sld
Type : AutoCAD Slide 2.0
Name : square
Size : 223
Width : 200
Height : 200
Ratio : 1
Endian : Little
```
#### Print info about slide in library
```
$ slide-info --what=records mylib.slb square
(COLOR 1)
(SOLID_FILL_POLYGON 10 10 10 190 190 190 190 10)
(COLOR 2)
(SOLID_FILL_POLYGON 20 20 20 180 180 180 180 20)
(COLOR 3)
(SOLID_FILL_POLYGON 30 30 30 170 170 170 170 30)
(COLOR 5)
(SOLID_FILL_POLYGON 40 40 40 160 160 160 160 40)
(COLOR 255)
(SOLID_FILL_POLYGON 50 50 50 150 150 150 150 50)
(END_OF_FILE)
```
#### Print info about slide in library by its index
```
$ slide-info --what=all mylib.slb 0
Info:
Type : AutoCAD Slide 2.0
Name : SQUARE
Size : 223
Width : 200
Height : 200
Ratio : 1
Endian : Little
Records:
(COLOR 1)
(SOLID_FILL_POLYGON 10 10 10 190 190 190 190 10)
(COLOR 2)
(SOLID_FILL_POLYGON 20 20 20 180 180 180 180 20)
(COLOR 3)
(SOLID_FILL_POLYGON 30 30 30 170 170 170 170 30)
(COLOR 5)
(SOLID_FILL_POLYGON 40 40 40 160 160 160 160 40)
(COLOR 255)
(SOLID_FILL_POLYGON 50 50 50 150 150 150 150 50)
(END_OF_FILE)
```
### Print various slide library info
```
$ slide-info mylib.slb
Type : AutoCAD Slide Library 1.0
Name : mylib
Size : 327
Slides : 1
```
```
$ slide-info --what=names mylib.slb
SQUARE
```
```
$ slide-info --what=all mylib.slb
Info:
Type : AutoCAD Slide Library 1.0
Name : mylib
Size : 327
Slides : 1
Names:
SQUARE
```
### Import slides to slide library
#### Import one slide file to library
```
$ slidelib-import mylib.slb triangle.sld
```
```
$ slide-info --what=all mylib.slb
Info:
Type : AutoCAD Slide Library 1.0
Name : mylib
Size : 494
Slides : 2
Names:
SQUARE
TRIANGLE
```
#### Import multiple slide files to library
```
$ slidelib-import mylib.slb *.sld
```
### Export slides from slide library
#### Export one slide from library
```
$ slidelib-export mylib.slb square
```
#### Export all slides from library
```
$ slidelib-export --all mylib.slb
```
### Delete slides from slide library
```
$ slidelib-delete mylib.slb triangle
```
```
$ slide-info --what=all mylib.slb
Info:
Type : AutoCAD Slide Library 1.0
Name : mylib
Size : 327
Slides : 1
Names:
SQUARE
```
### Convert slide to PNG and SVG
```
$ slide-convert --to=png square.sld
```
```
$ slide-convert --to=svg mylib.slb square
```
### Draw slide on [Cairo](https://www.cairographics.org/) surface
```
$ slide-view square.sld
```
```
$ slide-view mylib.slb square
```
```
$ slile-view mylib.slb 0
```
### Draw slide on [Cairo](https://www.cairographics.org/) surface via [GObject Introspection](https://gi.readthedocs.io/en/latest/)
```
$ export LD_LIBRARY_PATH=$PWD/install/lib GI_TYPELIB_PATH=$PWD/install/lib/girepository-1.0
$ python3 -m venv env
$ source env/bin/activate
$ pip3 install -r test/requirements.txt
$ python3 test/gtk-cairo-test.py
```
## License
The project is licensed under the GNU General Public License v3.0 or later.
See [LICENSE](LICENSE) or
https://spdx.org/licenses/GPL-3.0-or-later.html
for full license information.