@@ -112,43 +112,24 @@ PyRendererAgg_draw_path_collection(RendererAgg *self,
112
112
GCAgg &gc,
113
113
agg::trans_affine master_transform,
114
114
mpl::PathGenerator paths,
115
- py::object transforms_obj,
116
- py::object offsets_obj,
115
+ py::array_t < double > transforms_obj,
116
+ py::array_t < double > offsets_obj,
117
117
agg::trans_affine offset_trans,
118
- py::object facecolors_obj,
119
- py::object edgecolors_obj,
120
- py::object linewidths_obj,
118
+ py::array_t < double > facecolors_obj,
119
+ py::array_t < double > edgecolors_obj,
120
+ py::array_t < double > linewidths_obj,
121
121
DashesVector dashes,
122
- py::object antialiaseds_obj,
122
+ py::array_t < uint8_t > antialiaseds_obj,
123
123
py::object Py_UNUSED (ignored_obj),
124
124
// offset position is no longer used
125
125
py::object Py_UNUSED(offset_position_obj))
126
126
{
127
- numpy::array_view<const double , 3 > transforms;
128
- numpy::array_view<const double , 2 > offsets;
129
- numpy::array_view<const double , 2 > facecolors;
130
- numpy::array_view<const double , 2 > edgecolors;
131
- numpy::array_view<const double , 1 > linewidths;
132
- numpy::array_view<const uint8_t , 1 > antialiaseds;
133
-
134
- if (!convert_transforms (transforms_obj.ptr (), &transforms)) {
135
- throw py::error_already_set ();
136
- }
137
- if (!convert_points (offsets_obj.ptr (), &offsets)) {
138
- throw py::error_already_set ();
139
- }
140
- if (!convert_colors (facecolors_obj.ptr (), &facecolors)) {
141
- throw py::error_already_set ();
142
- }
143
- if (!convert_colors (edgecolors_obj.ptr (), &edgecolors)) {
144
- throw py::error_already_set ();
145
- }
146
- if (!linewidths.converter (linewidths_obj.ptr (), &linewidths)) {
147
- throw py::error_already_set ();
148
- }
149
- if (!antialiaseds.converter (antialiaseds_obj.ptr (), &antialiaseds)) {
150
- throw py::error_already_set ();
151
- }
127
+ auto transforms = convert_transforms (transforms_obj);
128
+ auto offsets = convert_points (offsets_obj);
129
+ auto facecolors = convert_colors (facecolors_obj);
130
+ auto edgecolors = convert_colors (edgecolors_obj);
131
+ auto linewidths = linewidths_obj.unchecked <1 >();
132
+ auto antialiaseds = antialiaseds_obj.unchecked <1 >();
152
133
153
134
self->draw_path_collection (gc,
154
135
master_transform,
@@ -170,26 +151,16 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
170
151
unsigned int mesh_width,
171
152
unsigned int mesh_height,
172
153
py::array_t <double , py::array::c_style | py::array::forcecast> coordinates_obj,
173
- py::object offsets_obj,
154
+ py::array_t < double > offsets_obj,
174
155
agg::trans_affine offset_trans,
175
- py::object facecolors_obj,
156
+ py::array_t < double > facecolors_obj,
176
157
bool antialiased,
177
- py::object edgecolors_obj)
158
+ py::array_t < double > edgecolors_obj)
178
159
{
179
- numpy::array_view<const double , 2 > offsets;
180
- numpy::array_view<const double , 2 > facecolors;
181
- numpy::array_view<const double , 2 > edgecolors;
182
-
183
160
auto coordinates = coordinates_obj.mutable_unchecked <3 >();
184
- if (!convert_points (offsets_obj.ptr (), &offsets)) {
185
- throw py::error_already_set ();
186
- }
187
- if (!convert_colors (facecolors_obj.ptr (), &facecolors)) {
188
- throw py::error_already_set ();
189
- }
190
- if (!convert_colors (edgecolors_obj.ptr (), &edgecolors)) {
191
- throw py::error_already_set ();
192
- }
161
+ auto offsets = convert_points (offsets_obj);
162
+ auto facecolors = convert_colors (facecolors_obj);
163
+ auto edgecolors = convert_colors (edgecolors_obj);
193
164
194
165
self->draw_quad_mesh (gc,
195
166
master_transform,
0 commit comments