-
Notifications
You must be signed in to change notification settings - Fork 11
/
README
132 lines (84 loc) · 2.83 KB
/
README
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
pyemf3 is an updated version of pyemf with support for Python 3.3+
Original author: Rob McMullen
Updater to Python 3: Jeremy Sanders
ABSTRACT
========
pyemf3 is a pure python module that provides bindings for an ECMA-234
compliant vector graphics library. ECMA-234 is the published
interface for the Windows GDI used in the Microsoft windows
environment and, more importantly, natively supported by the
OpenOffice suite of tools.
http://www.ecma-international.org/publications/standards/Ecma-234.htm
PREREQUISITES
=============
python3 (tested with python 3.10)
QUICK INSTALL
=============
python3 setup.py install
FEATURES
========
Most of the drawing methods of ECMA-234 are supported by pyemf3.
Supported
---------
Drawing parameters:
GetStockObject, SelectObject, DeleteObject, CreatePen,
CreateSolidBrush, CreateHatchBrush, SetBkColor, SetBkMode,
SetPolyFillMode
Drawing primitives:
SetPixel, Polyline, Polygon, Rectangle, RoundRect, Ellipse, Arc,
Chord, Pie, PolyBezier
Path primitives:
BeginPath, EndPath, MoveTo, LineTo, PolylineTo, ArcTo,
PolyBezierTo, CloseFigure, FillPath, StrokePath, StrokeAndFillPath
Clipping:
SelectClipPath
Text:
CreateFont, SetTextAlign, SetTextColor, TextOut
Coordinate system transformation:
SaveDC, RestoreDC, SetWorldTransform, ModifyWorldTransform
Experimental
------------
Window/Viewport commands:
SetMapMode, SetViewportOrgEx, GetViewportOrgEx, SetViewportExtEx,
ScaleViewportExtEx, GetViewportExtEx, SetWindowOrgEx,
GetWindowOrgEx, SetWindowExtEx, ScaleWindowExtEx, GetWindowExtEx
Unsupported
-----------
Palettes
Bitmaps
Text metrics
DOCUMENTATION
=============
The most current documentation is always available on the web at
$url/api/index.html
Or, in the source distribution, the directory website/api/ contains a
copy of the api documentation for version $version. Simply point your
web browser at the index.html within that directory.
EXAMPLES
========
Creating an EMF
---------------
Here's a simple program (available as test-1.py in the distribution)
that connects opposite corners of an 8in by 6in rectangle with lines:
#!/usr/bin/env python3
import pyemf3
width=8
height=6
dpi=300
emf=pyemf3.EMF(width,height,dpi)
thin=emf.CreatePen(pyemf.PS_SOLID,1,(0x01,0x02,0x03))
emf.SelectObject(thin)
emf.Polyline([(0,0),(width*dpi,height*dpi)])
emf.Polyline([(0,height*dpi),(width*dpi,0)])
emf.save("test-1.emf")
Other tests
-----------
There are many other tests included in the examples/ directory in the
source distribution. After installing the pyemf3 library, you should
be able to run them like this:
$ cd examples
$ python test-drawing1.py
and examine the output file 'test-drawing1.emf' by loading it in
OpenOffice Impress.
Also included in the examples directory is the program
'test--run-all.py' that will run all the tests.