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
|
Vector Nodes
============
.. automodule:: libavg.avg
:no-members:
.. inheritance-diagram:: CircleNode CurveNode FilledVectorNode LineNode MeshNode Node PolygonNode PolyLineNode RectNode VectorNode libavg.geom.Arc libavg.geom.PieSlice libavg.geom.RoundedRect
:parts: 1
.. autoclass:: CircleNode([r=1, texcoord1=0, texcoord2=1])
A circle. The reference point for a circle is its center.
.. py:attribute:: r
The radius of the circle in pixels.
.. py:attribute:: texcoord1
.. py:attribute:: texcoord2
.. autoclass:: CurveNode([pos1, pos2, pos3, pos4, texcoord1, texcoord2])
A cubic bezier curve (`<http://en.wikipedia.org/wiki/Bezier_curve>`_).
:py:attr:`pos1` and :py:attr:`pos4` are the two endpoints of the curve.
:py:attr:`pos2` and :py:attr:`pos3` are control points.
.. py:method:: getPtOnCurve(t) -> pos
Returns a point on the curve. Which point is determined by the value of t.
If :samp:`t=0`, returns :py:attr:`pos1`. :samp:`t=1` returns :py:attr:`pos4`,
and values in between return the points in between.
.. py:attribute:: length
Returns an approximation of the length of the curve (ro).
.. py:attribute:: pos1
.. py:attribute:: pos2
.. py:attribute:: pos3
.. py:attribute:: pos4
.. py:attribute:: texcoord1
.. py:attribute:: texcoord2
.. autoclass:: FilledVectorNode([filltexhref, fillopacity=0, fillcolor="FFFFFF", filltexcoord1=Point2D(0,0), filltexcoord2=Point2D(1,1)])
Base class for vector nodes which have a filled area and a border. The area can
be filled either with a solid color (:py:attr:`fillcolor`) or with a texture
loaded from a file (:py:attr:`filltexhref`) or taken from a bitmap object
(:py:meth:`setFillBitmap`).
.. py:attribute:: fillcolor
.. py:attribute:: fillopacity
.. py:attribute:: filltexcoord1
.. py:attribute:: filltexcoord2
.. py:attribute:: filltexhref
An image file to use as a texture for the area of the node.
.. py:method:: setFillBitmap(bitmap)
Sets a bitmap to use as a fill texture. Sets :attr:`filltexhref` to an empty
string.
.. autoclass:: LineNode([pos1, pos2, texcoord1, texcoord2])
A line. :py:attr:`pos1` and :py:attr:`pos2` are the two endpoints of the line.
.. py:attribute:: pos1
.. py:attribute:: pos2
.. py:attribute:: texcoord1
.. py:attribute:: texcoord2
.. autoclass:: MeshNode([vertexcoords, texcoords, triangles])
This is a generalized mesh of textured triangles. See
https://www.libavg.de/wiki/ProgrammersGuide/MeshNode for an example.
.. py:attribute:: texcoords
.. py:attribute:: triangles
.. py:attribute:: vertexcoords
.. autoclass:: PolygonNode([linejoin="bevel", pos, texcoords])
A closed figure bounded by a number of line segments, optionally filled. Filled
polygons may not be self-intersecting.
.. py:attribute:: linejoin
The method by which line segments are joined together. Valid values are
:py:const:`bevel` and :py:const:`miter`.
.. py:attribute:: pos
A sequence (:py:class:`list` or :py:class:`tuple`) of pixel positions.
.. py:attribute:: texcoords
A sequence of float texture coordinates corresponding to the border positions.
.. autoclass:: PolyLineNode([linejoin="bevel", pos, texcoords])
A figure similar to a :py:class:`PolygonNode`, but not closed and never filled.
.. py:attribute:: linejoin
The method by which line segments are joined together. Valid values are
:py:const:`bevel` and :py:const:`miter`.
.. py:attribute:: pos
A sequence (:py:class:`list` or :py:class:`tuple`) of pixel positions.
.. py:attribute:: texcoords
A sequence of float texture coordinates corresponding to the border positions.
.. autoclass:: RectNode([pos, size, angle])
A rectangle that can be filled.
.. py:attribute:: angle
The angle that the rectangle is rotated to in radians. 0 is
unchanged, 3.14 is upside-down. The rectangle is rotated around its
center.
.. py:attribute:: pos
The position of the top left corner of the rectangle.
.. py:attribute:: size
.. py:attribute:: texcoords
.. autoclass:: VectorNode([color="FFFFFF", strokewidth=1, texhref, blendmode="blend"])
Base class for all nodes that draw geometrical primitives. All vector nodes
support configurable stroke width. Strokes can be filled either with a solid
color (:py:attr:`color`) or with a texture loaded from a file
(:py:attr:`texhref`) or taken from a bitmap object (:py:meth:`setBitmap`).
.. py:attribute:: blendmode
The method of compositing the node with the nodes under
it. Valid values are :py:const:`blend`, :py:const:`add`, :py:const:`min`
and :py:const:`max`. For :py:const:`min` and :py:const:`max`
blend modes, opacity is ignored.
.. py:attribute:: color
The color of the strokes in standard html color notation:
:samp:`"FF0000"` is red, :samp:`"00FF00"` green, etc.
.. py:attribute:: strokewidth
The width of the strokes in the vector. For lines, this is the line
width. For rectangles, it is the width of the outline, etc.
.. py:attribute:: texhref
An image file to use as a texture for the node.
.. py:method:: setBitmap(bitmap)
Sets a bitmap to use as a texture. Sets :attr:`texhref` to an empty
string.
.. automodule:: libavg.geom
:no-members:
.. autoclass:: Arc(radius, startangle, endangle[, pos=(0,0)])
An unfilled arc (incomplete circle) from :py:attr:`startangle` to
:py:attr:`endangle`. :py:attr:`pos` is the center of the circle.
.. py:attribute:: endangle
.. py:attribute:: pos
.. py:attribute:: radius
.. py:attribute:: startangle
.. autoclass:: PieSlice(radius, startangle, endangle[, pos=(0,0)])
An arc (incomplete circle) from :py:attr:`startangle` to
:py:attr:`endangle` connected to the center of the circle. :py:attr:`pos` is the
center of the circle. A :py:class:`PieSlice` can be filled.
.. py:attribute:: endangle
.. py:attribute:: pos
.. py:attribute:: radius
.. py:attribute:: startangle
.. autoclass:: RoundedRect(size, radius, pos)
A rectangle with rounded corners. :py:attr:`radius` is the corner radius.
.. py:attribute:: pos
.. py:attribute:: radius
.. py:attribute:: size
|