@@ -34,34 +34,30 @@ convert_polygon_vector(std::vector<Polygon> &polygons)
34
34
35
35
static bool
36
36
Py_point_in_path (double x, double y, double r, py::object path_obj,
37
- py::object trans_obj )
37
+ agg::trans_affine trans )
38
38
{
39
39
mpl::PathIterator path;
40
- agg::trans_affine trans;
41
40
42
41
if (!convert_path (path_obj.ptr (), &path)) {
43
42
throw py::error_already_set ();
44
43
}
45
- convert_trans_affine (trans_obj, trans);
46
44
47
45
return point_in_path (x, y, r, path, trans);
48
46
}
49
47
50
48
static py::array_t <double >
51
49
Py_points_in_path (py::array_t <double > points_obj, double r, py::object path_obj,
52
- py::object trans_obj )
50
+ agg::trans_affine trans )
53
51
{
54
52
numpy::array_view<double , 2 > points;
55
53
mpl::PathIterator path;
56
- agg::trans_affine trans;
57
54
58
55
if (!convert_points (points_obj.ptr (), &points)) {
59
56
throw py::error_already_set ();
60
57
}
61
58
if (!convert_path (path_obj.ptr (), &path)) {
62
59
throw py::error_already_set ();
63
60
}
64
- convert_trans_affine (trans_obj, trans);
65
61
66
62
if (!check_trailing_shape (points, " points" , 2 )) {
67
63
throw py::error_already_set ();
@@ -77,17 +73,15 @@ Py_points_in_path(py::array_t<double> points_obj, double r, py::object path_obj,
77
73
}
78
74
79
75
static py::tuple
80
- Py_update_path_extents (py::object path_obj, py::object trans_obj , agg::rect_d rect,
76
+ Py_update_path_extents (py::object path_obj, agg::trans_affine trans , agg::rect_d rect,
81
77
py::array_t <double > minpos, bool ignore)
82
78
{
83
79
mpl::PathIterator path;
84
- agg::trans_affine trans;
85
80
bool changed;
86
81
87
82
if (!convert_path (path_obj.ptr (), &path)) {
88
83
throw py::error_already_set ();
89
84
}
90
- convert_trans_affine (trans_obj, trans);
91
85
92
86
if (minpos.ndim () != 1 ) {
93
87
throw py::value_error (
@@ -142,18 +136,15 @@ Py_update_path_extents(py::object path_obj, py::object trans_obj, agg::rect_d re
142
136
}
143
137
144
138
static py::tuple
145
- Py_get_path_collection_extents (py::object master_transform_obj, py::object paths_obj ,
146
- py::object transforms_obj , py::object offsets_obj ,
147
- py::object offset_trans_obj )
139
+ Py_get_path_collection_extents (agg::trans_affine master_transform ,
140
+ py::object paths_obj , py::object transforms_obj ,
141
+ py::object offsets_obj, agg::trans_affine offset_trans )
148
142
{
149
- agg::trans_affine master_transform;
150
143
mpl::PathGenerator paths;
151
144
numpy::array_view<const double , 3 > transforms;
152
145
numpy::array_view<const double , 2 > offsets;
153
- agg::trans_affine offset_trans;
154
146
extent_limits e;
155
147
156
- convert_trans_affine (master_transform_obj, master_transform);
157
148
if (!convert_pathgen (paths_obj.ptr (), &paths)) {
158
149
throw py::error_already_set ();
159
150
}
@@ -163,7 +154,6 @@ Py_get_path_collection_extents(py::object master_transform_obj, py::object paths
163
154
if (!convert_points (offsets_obj.ptr (), &offsets)) {
164
155
throw py::error_already_set ();
165
156
}
166
- convert_trans_affine (offset_trans_obj, offset_trans);
167
157
168
158
get_path_collection_extents (
169
159
master_transform, paths, transforms, offsets, offset_trans, e);
@@ -185,18 +175,15 @@ Py_get_path_collection_extents(py::object master_transform_obj, py::object paths
185
175
186
176
static py::object
187
177
Py_point_in_path_collection (double x, double y, double radius,
188
- py::object master_transform_obj , py::object paths_obj,
178
+ agg::trans_affine master_transform , py::object paths_obj,
189
179
py::object transforms_obj, py::object offsets_obj,
190
- py::object offset_trans_obj , bool filled)
180
+ agg::trans_affine offset_trans , bool filled)
191
181
{
192
- agg::trans_affine master_transform;
193
182
mpl::PathGenerator paths;
194
183
numpy::array_view<const double , 3 > transforms;
195
184
numpy::array_view<const double , 2 > offsets;
196
- agg::trans_affine offset_trans;
197
185
std::vector<int > result;
198
186
199
- convert_trans_affine (master_transform_obj, master_transform);
200
187
if (!convert_pathgen (paths_obj.ptr (), &paths)) {
201
188
throw py::error_already_set ();
202
189
}
@@ -206,7 +193,6 @@ Py_point_in_path_collection(double x, double y, double radius,
206
193
if (!convert_points (offsets_obj.ptr (), &offsets)) {
207
194
throw py::error_already_set ();
208
195
}
209
- convert_trans_affine (offset_trans_obj, offset_trans);
210
196
211
197
point_in_path_collection (x, y, radius, master_transform, paths, transforms, offsets,
212
198
offset_trans, filled, result);
@@ -216,22 +202,18 @@ Py_point_in_path_collection(double x, double y, double radius,
216
202
}
217
203
218
204
static bool
219
- Py_path_in_path (py::object a_obj, py::object atrans_obj ,
220
- py::object b_obj, py::object btrans_obj )
205
+ Py_path_in_path (py::object a_obj, agg::trans_affine atrans ,
206
+ py::object b_obj, agg::trans_affine btrans )
221
207
{
222
208
mpl::PathIterator a;
223
- agg::trans_affine atrans;
224
209
mpl::PathIterator b;
225
- agg::trans_affine btrans;
226
210
227
211
if (!convert_path (a_obj.ptr (), &a)) {
228
212
throw py::error_already_set ();
229
213
}
230
- convert_trans_affine (atrans_obj, atrans);
231
214
if (!convert_path (b_obj.ptr (), &b)) {
232
215
throw py::error_already_set ();
233
216
}
234
- convert_trans_affine (btrans_obj, btrans);
235
217
236
218
return path_in_path (a, atrans, b, btrans);
237
219
}
@@ -253,12 +235,8 @@ Py_clip_path_to_rect(py::object path_obj, agg::rect_d rect, bool inside)
253
235
254
236
static py::object
255
237
Py_affine_transform (py::array_t <double , py::array::c_style | py::array::forcecast> vertices_arr,
256
- py::object trans_obj )
238
+ agg::trans_affine trans )
257
239
{
258
- agg::trans_affine trans;
259
-
260
- convert_trans_affine (trans_obj, trans);
261
-
262
240
if (vertices_arr.ndim () == 2 ) {
263
241
auto vertices = vertices_arr.unchecked <2 >();
264
242
@@ -342,37 +320,33 @@ Py_path_intersects_rectangle(py::object path_obj, double rect_x1, double rect_y1
342
320
}
343
321
344
322
static py::list
345
- Py_convert_path_to_polygons (py::object path_obj, py::object trans_obj ,
323
+ Py_convert_path_to_polygons (py::object path_obj, agg::trans_affine trans ,
346
324
double width, double height, bool closed_only)
347
325
{
348
326
mpl::PathIterator path;
349
- agg::trans_affine trans;
350
327
std::vector<Polygon> result;
351
328
352
329
if (!convert_path (path_obj.ptr (), &path)) {
353
330
throw py::error_already_set ();
354
331
}
355
- convert_trans_affine (trans_obj, trans);
356
332
357
333
convert_path_to_polygons (path, trans, width, height, closed_only, result);
358
334
359
335
return convert_polygon_vector (result);
360
336
}
361
337
362
338
static py::tuple
363
- Py_cleanup_path (py::object path_obj, py::object trans_obj , bool remove_nans,
339
+ Py_cleanup_path (py::object path_obj, agg::trans_affine trans , bool remove_nans,
364
340
agg::rect_d clip_rect, py::object snap_mode_obj, double stroke_width,
365
341
std::optional<bool > simplify, bool return_curves, py::object sketch_obj)
366
342
{
367
343
mpl::PathIterator path;
368
- agg::trans_affine trans;
369
344
e_snap_mode snap_mode;
370
345
SketchParams sketch;
371
346
372
347
if (!convert_path (path_obj.ptr (), &path)) {
373
348
throw py::error_already_set ();
374
349
}
375
- convert_trans_affine (trans_obj, trans);
376
350
if (!convert_snap (snap_mode_obj.ptr (), &snap_mode)) {
377
351
throw py::error_already_set ();
378
352
}
@@ -432,12 +406,11 @@ postfix : bool
432
406
)""" ;
433
407
434
408
static py::object
435
- Py_convert_to_string (py::object path_obj, py::object trans_obj , agg::rect_d cliprect,
409
+ Py_convert_to_string (py::object path_obj, agg::trans_affine trans , agg::rect_d cliprect,
436
410
std::optional<bool > simplify, py::object sketch_obj, int precision,
437
411
std::array<std::string, 5 > codes_obj, bool postfix)
438
412
{
439
413
mpl::PathIterator path;
440
- agg::trans_affine trans;
441
414
SketchParams sketch;
442
415
char *codes[5 ];
443
416
std::string buffer;
@@ -446,7 +419,6 @@ Py_convert_to_string(py::object path_obj, py::object trans_obj, agg::rect_d clip
446
419
if (!convert_path (path_obj.ptr (), &path)) {
447
420
throw py::error_already_set ();
448
421
}
449
- convert_trans_affine (trans_obj, trans);
450
422
if (!convert_sketch_params (sketch_obj.ptr (), &sketch)) {
451
423
throw py::error_already_set ();
452
424
}
0 commit comments