@@ -44,34 +44,30 @@ convert_polygon_vector(std::vector<Polygon> &polygons)
44
44
45
45
static bool
46
46
Py_point_in_path (double x, double y, double r, py::object path_obj,
47
- py::object trans_obj )
47
+ agg::trans_affine trans )
48
48
{
49
49
mpl::PathIterator path;
50
- agg::trans_affine trans;
51
50
52
51
if (!convert_path (path_obj.ptr (), &path)) {
53
52
throw py::error_already_set ();
54
53
}
55
- convert_trans_affine (trans_obj, trans);
56
54
57
55
return point_in_path (x, y, r, path, trans);
58
56
}
59
57
60
58
static py::array_t <double >
61
59
Py_points_in_path (py::array_t <double > points_obj, double r, py::object path_obj,
62
- py::object trans_obj )
60
+ agg::trans_affine trans )
63
61
{
64
62
numpy::array_view<double , 2 > points;
65
63
mpl::PathIterator path;
66
- agg::trans_affine trans;
67
64
68
65
if (!convert_points (points_obj.ptr (), &points)) {
69
66
throw py::error_already_set ();
70
67
}
71
68
if (!convert_path (path_obj.ptr (), &path)) {
72
69
throw py::error_already_set ();
73
70
}
74
- convert_trans_affine (trans_obj, trans);
75
71
76
72
if (!check_trailing_shape (points, " points" , 2 )) {
77
73
throw py::error_already_set ();
@@ -87,17 +83,15 @@ Py_points_in_path(py::array_t<double> points_obj, double r, py::object path_obj,
87
83
}
88
84
89
85
static py::tuple
90
- Py_update_path_extents (py::object path_obj, py::object trans_obj , agg::rect_d rect,
86
+ Py_update_path_extents (py::object path_obj, agg::trans_affine trans , agg::rect_d rect,
91
87
py::array_t <double > minpos, bool ignore)
92
88
{
93
89
mpl::PathIterator path;
94
- agg::trans_affine trans;
95
90
bool changed;
96
91
97
92
if (!convert_path (path_obj.ptr (), &path)) {
98
93
throw py::error_already_set ();
99
94
}
100
- convert_trans_affine (trans_obj, trans);
101
95
102
96
if (minpos.ndim () != 1 ) {
103
97
throw py::value_error (
@@ -152,18 +146,15 @@ Py_update_path_extents(py::object path_obj, py::object trans_obj, agg::rect_d re
152
146
}
153
147
154
148
static py::tuple
155
- Py_get_path_collection_extents (py::object master_transform_obj, py::object paths_obj ,
156
- py::object transforms_obj , py::object offsets_obj ,
157
- py::object offset_trans_obj )
149
+ Py_get_path_collection_extents (agg::trans_affine master_transform ,
150
+ py::object paths_obj , py::object transforms_obj ,
151
+ py::object offsets_obj, agg::trans_affine offset_trans )
158
152
{
159
- agg::trans_affine master_transform;
160
153
mpl::PathGenerator paths;
161
154
numpy::array_view<const double , 3 > transforms;
162
155
numpy::array_view<const double , 2 > offsets;
163
- agg::trans_affine offset_trans;
164
156
extent_limits e;
165
157
166
- convert_trans_affine (master_transform_obj, master_transform);
167
158
if (!convert_pathgen (paths_obj.ptr (), &paths)) {
168
159
throw py::error_already_set ();
169
160
}
@@ -173,7 +164,6 @@ Py_get_path_collection_extents(py::object master_transform_obj, py::object paths
173
164
if (!convert_points (offsets_obj.ptr (), &offsets)) {
174
165
throw py::error_already_set ();
175
166
}
176
- convert_trans_affine (offset_trans_obj, offset_trans);
177
167
178
168
get_path_collection_extents (
179
169
master_transform, paths, transforms, offsets, offset_trans, e);
@@ -195,18 +185,15 @@ Py_get_path_collection_extents(py::object master_transform_obj, py::object paths
195
185
196
186
static py::object
197
187
Py_point_in_path_collection (double x, double y, double radius,
198
- py::object master_transform_obj , py::object paths_obj,
188
+ agg::trans_affine master_transform , py::object paths_obj,
199
189
py::object transforms_obj, py::object offsets_obj,
200
- py::object offset_trans_obj , bool filled)
190
+ agg::trans_affine offset_trans , bool filled)
201
191
{
202
- agg::trans_affine master_transform;
203
192
mpl::PathGenerator paths;
204
193
numpy::array_view<const double , 3 > transforms;
205
194
numpy::array_view<const double , 2 > offsets;
206
- agg::trans_affine offset_trans;
207
195
std::vector<int > result;
208
196
209
- convert_trans_affine (master_transform_obj, master_transform);
210
197
if (!convert_pathgen (paths_obj.ptr (), &paths)) {
211
198
throw py::error_already_set ();
212
199
}
@@ -216,7 +203,6 @@ Py_point_in_path_collection(double x, double y, double radius,
216
203
if (!convert_points (offsets_obj.ptr (), &offsets)) {
217
204
throw py::error_already_set ();
218
205
}
219
- convert_trans_affine (offset_trans_obj, offset_trans);
220
206
221
207
point_in_path_collection (x, y, radius, master_transform, paths, transforms, offsets,
222
208
offset_trans, filled, result);
@@ -230,22 +216,18 @@ Py_point_in_path_collection(double x, double y, double radius,
230
216
}
231
217
232
218
static bool
233
- Py_path_in_path (py::object a_obj, py::object atrans_obj ,
234
- py::object b_obj, py::object btrans_obj )
219
+ Py_path_in_path (py::object a_obj, agg::trans_affine atrans ,
220
+ py::object b_obj, agg::trans_affine btrans )
235
221
{
236
222
mpl::PathIterator a;
237
- agg::trans_affine atrans;
238
223
mpl::PathIterator b;
239
- agg::trans_affine btrans;
240
224
241
225
if (!convert_path (a_obj.ptr (), &a)) {
242
226
throw py::error_already_set ();
243
227
}
244
- convert_trans_affine (atrans_obj, atrans);
245
228
if (!convert_path (b_obj.ptr (), &b)) {
246
229
throw py::error_already_set ();
247
230
}
248
- convert_trans_affine (btrans_obj, btrans);
249
231
250
232
return path_in_path (a, atrans, b, btrans);
251
233
}
@@ -267,12 +249,8 @@ Py_clip_path_to_rect(py::object path_obj, agg::rect_d rect, bool inside)
267
249
268
250
static py::object
269
251
Py_affine_transform (py::array_t <double , py::array::c_style | py::array::forcecast> vertices_arr,
270
- py::object trans_obj )
252
+ agg::trans_affine trans )
271
253
{
272
- agg::trans_affine trans;
273
-
274
- convert_trans_affine (trans_obj, trans);
275
-
276
254
if (vertices_arr.ndim () == 2 ) {
277
255
auto vertices = vertices_arr.unchecked <2 >();
278
256
@@ -356,37 +334,33 @@ Py_path_intersects_rectangle(py::object path_obj, double rect_x1, double rect_y1
356
334
}
357
335
358
336
static py::object
359
- Py_convert_path_to_polygons (py::object path_obj, py::object trans_obj ,
337
+ Py_convert_path_to_polygons (py::object path_obj, agg::trans_affine trans ,
360
338
double width, double height, bool closed_only)
361
339
{
362
340
mpl::PathIterator path;
363
- agg::trans_affine trans;
364
341
std::vector<Polygon> result;
365
342
366
343
if (!convert_path (path_obj.ptr (), &path)) {
367
344
throw py::error_already_set ();
368
345
}
369
- convert_trans_affine (trans_obj, trans);
370
346
371
347
convert_path_to_polygons (path, trans, width, height, closed_only, result);
372
348
373
349
return convert_polygon_vector (result);
374
350
}
375
351
376
- static pybind11 ::tuple
377
- Py_cleanup_path (py::object path_obj, py::object trans_obj , bool remove_nans,
352
+ static py ::tuple
353
+ Py_cleanup_path (py::object path_obj, agg::trans_affine trans , bool remove_nans,
378
354
agg::rect_d clip_rect, py::object snap_mode_obj, double stroke_width,
379
355
std::optional<bool > simplify, bool return_curves, py::object sketch_obj)
380
356
{
381
357
mpl::PathIterator path;
382
- agg::trans_affine trans;
383
358
e_snap_mode snap_mode;
384
359
SketchParams sketch;
385
360
386
361
if (!convert_path (path_obj.ptr (), &path)) {
387
362
throw py::error_already_set ();
388
363
}
389
- convert_trans_affine (trans_obj, trans);
390
364
if (!convert_snap (snap_mode_obj.ptr (), &snap_mode)) {
391
365
throw py::error_already_set ();
392
366
}
@@ -449,12 +423,11 @@ postfix : bool
449
423
)""" ;
450
424
451
425
static py::object
452
- Py_convert_to_string (py::object path_obj, py::object trans_obj , agg::rect_d cliprect,
426
+ Py_convert_to_string (py::object path_obj, agg::trans_affine trans , agg::rect_d cliprect,
453
427
std::optional<bool > simplify, py::object sketch_obj, int precision,
454
428
std::array<std::string, 5 > codes_obj, bool postfix)
455
429
{
456
430
mpl::PathIterator path;
457
- agg::trans_affine trans;
458
431
SketchParams sketch;
459
432
char *codes[5 ];
460
433
std::string buffer;
@@ -463,7 +436,6 @@ Py_convert_to_string(py::object path_obj, py::object trans_obj, agg::rect_d clip
463
436
if (!convert_path (path_obj.ptr (), &path)) {
464
437
throw py::error_already_set ();
465
438
}
466
- convert_trans_affine (trans_obj, trans);
467
439
if (!convert_sketch_params (sketch_obj.ptr (), &sketch)) {
468
440
throw py::error_already_set ();
469
441
}
0 commit comments