这篇教程C++ CALL_CPP函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CALL_CPP函数的典型用法代码示例。如果您正苦于以下问题:C++ CALL_CPP函数的具体用法?C++ CALL_CPP怎么用?C++ CALL_CPP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CALL_CPP函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CALL_CPPstatic PyObject *image_fromarray(PyObject *self, PyObject *args, PyObject *kwds){ PyObject *array; int isoutput; const char *names[] = { "array", "isoutput", NULL }; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O|i:fromarray", (char **)names, &array, &isoutput)) { return NULL; } numpy::array_view<const double, 3> color_array; numpy::array_view<const double, 2> grey_array; Image *result = NULL; if (color_array.converter(array, &color_array)) { CALL_CPP("fromarray", result = from_color_array(color_array, isoutput)); } else if (grey_array.converter(array, &grey_array)) { CALL_CPP("fromarray", result = from_grey_array(grey_array, isoutput)); } else { PyErr_SetString(PyExc_ValueError, "invalid array"); return NULL; } return PyImage_cnew(result);}
开发者ID:allensh929,项目名称:matplotlib,代码行数:26,
示例2: verticesstatic PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *kwds){ PyObject *vertices_obj; agg::trans_affine trans; if (!PyArg_ParseTuple(args, "OO&:affine_transform", &vertices_obj, &convert_trans_affine, &trans)) { return NULL; } try { numpy::array_view<double, 2> vertices(vertices_obj); npy_intp dims[] = { (npy_intp)vertices.size(), 2 }; numpy::array_view<double, 2> result(dims); CALL_CPP("affine_transform", (affine_transform_2d(vertices, trans, result))); return result.pyobj(); } catch (py::exception &) { PyErr_Clear(); try { numpy::array_view<double, 1> vertices(vertices_obj); npy_intp dims[] = { (npy_intp)vertices.size() }; numpy::array_view<double, 1> result(dims); CALL_CPP("affine_transform", (affine_transform_1d(vertices, trans, result))); return result.pyobj(); } catch (py::exception &) { return NULL; } }}
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:32,
示例3: CALL_CPPstatic PyObject *PyRendererAgg_restore_region(PyRendererAgg *self, PyObject *args, PyObject *kwds){ PyBufferRegion *regobj; int xx1 = 0, yy1 = 0, xx2 = 0, yy2 = 0, x = 0, y = 0; if (!PyArg_ParseTuple(args, "O!|iiiiii:restore_region", &PyBufferRegionType, ®obj, &xx1, &yy1, &xx2, &yy2, &x, &y)) { return 0; } if (PySequence_Size(args) == 1) { CALL_CPP("restore_region", (self->x->restore_region(*(regobj->x)))); } else { CALL_CPP("restore_region", self->x->restore_region(*(regobj->x), xx1, yy1, xx2, yy2, x, y)); } Py_RETURN_NONE;}
开发者ID:agardelein,项目名称:matplotlib,代码行数:26,
示例4: CALL_CPPstatic PyObject *Py_convert_path_to_polygons(PyObject *self, PyObject *args, PyObject *kwds){ py::PathIterator path; agg::trans_affine trans; double width = 0.0, height = 0.0; int closed_only = 1; std::vector<Polygon> result; const char *names[] = { "path", "transform", "width", "height", "closed_only", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&O&|ddi:convert_path_to_polygons", (char **)names, &convert_path, &path, &convert_trans_affine, &trans, &width, &height, &closed_only)) { return NULL; } CALL_CPP("convert_path_to_polygons", (convert_path_to_polygons(path, trans, width, height, closed_only, result))); return convert_polygon_vector(result);}
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:28,
示例5: resultsstatic PyObject *Py_points_in_path(PyObject *self, PyObject *args, PyObject *kwds){ numpy::array_view<const double, 2> points; double r; py::PathIterator path; agg::trans_affine trans; if (!PyArg_ParseTuple(args, "O&dO&O&:points_in_path", &convert_points, &points, &r, &convert_path, &path, &convert_trans_affine, &trans)) { return NULL; } npy_intp dims[] = { (npy_intp)points.size() }; numpy::array_view<uint8_t, 1> results(dims); CALL_CPP("points_in_path", (points_in_path(points, r, path, trans, results))); return results.pyobj();}
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:26,
示例6: PyRendererAgg_draw_gouraud_trianglesstatic PyObject *PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObject *kwds){ GCAgg gc; numpy::array_view<const double, 3> points; numpy::array_view<const double, 3> colors; agg::trans_affine trans; if (!PyArg_ParseTuple(args, "O&O&O&O&|O:draw_gouraud_triangles", &convert_gcagg, &gc, &points.converter, &points, &colors.converter, &colors, &convert_trans_affine, &trans)) { return NULL; } CALL_CPP("draw_gouraud_triangles", self->x->draw_gouraud_triangles(gc, points, colors, trans)); Py_RETURN_NONE;}
开发者ID:agardelein,项目名称:matplotlib,代码行数:25,
示例7: mpl_roundstatic PyObject *PyRendererAgg_draw_image(PyRendererAgg *self, PyObject *args, PyObject *kwds){ GCAgg gc; double x; double y; numpy::array_view<agg::int8u, 3> image; if (!PyArg_ParseTuple(args, "O&ddO&:draw_image", &convert_gcagg, &gc, &x, &y, &image.converter_contiguous, &image)) { return NULL; } x = mpl_round(x); y = mpl_round(y); gc.alpha = 1.0; CALL_CPP("draw_image", (self->x->draw_image(gc, x, y, image))); Py_RETURN_NONE;}
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:26,
示例8: pathsstatic PyObject *Py_point_in_path_collection(PyObject *self, PyObject *args, PyObject *kwds){ double x, y, radius; agg::trans_affine master_transform; PyObject *pathsobj; numpy::array_view<const double, 3> transforms; numpy::array_view<const double, 2> offsets; agg::trans_affine offset_trans; int filled; e_offset_position offset_position; std::vector<size_t> result; if (!PyArg_ParseTuple(args, "dddO&OO&O&O&iO&:point_in_path_collection", &x, &y, &radius, &convert_trans_affine, &master_transform, &pathsobj, &transforms.converter, &transforms, &offsets.converter, &offsets, &convert_trans_affine, &offset_trans, &filled, &convert_offset_position, &offset_position)) { return NULL; } try { py::PathGenerator paths(pathsobj); CALL_CPP("point_in_path_collection", (point_in_path_collection(x, y, radius, master_transform, paths, transforms, offsets, offset_trans, filled, offset_position, result))); } catch (py::exception &e) { return NULL; } npy_intp dims[] = {(npy_intp)result.size() }; numpy::array_view<size_t, 1> pyresult(dims); memcpy(pyresult.data(), &result[0], result.size() * sizeof(size_t)); return pyresult.pyobj();}
开发者ID:Matt-Li,项目名称:matplotlib,代码行数:59,
示例9: Imagestatic PyObject *image_from_images(PyObject *self, PyObject *args, PyObject *kwds){ unsigned int numrows; unsigned int numcols; PyObject *images; size_t numimages; if (!PyArg_ParseTuple(args, "IIO:from_images", &numrows, &numcols, &images)) { return NULL; } if (!PySequence_Check(images)) { return NULL; } Image *im = new Image(numrows, numcols, true); im->clear(); numimages = PySequence_Size(images); for (size_t i = 0; i < numimages; ++i) { PyObject *entry = PySequence_GetItem(images, i); if (entry == NULL) { delete im; return NULL; } PyObject *subimage; unsigned int x; unsigned int y; PyObject *alphaobj = NULL; double alpha = 0.0; if (!PyArg_ParseTuple(entry, "O!II|O", &PyImageType, &subimage, &x, &y, &alphaobj)) { Py_DECREF(entry); delete im; return NULL; } bool has_alpha = false; if (alphaobj != NULL && alphaobj != Py_None) { has_alpha = true; alpha = PyFloat_AsDouble(alphaobj); if (PyErr_Occurred()) { Py_DECREF(entry); delete im; return NULL; } } CALL_CPP("from_images", (im->blend_image(*((PyImage *)subimage)->x, x, y, has_alpha, alpha))); Py_DECREF(entry); } return PyImage_cnew(im);}
开发者ID:allensh929,项目名称:matplotlib,代码行数:58,
示例10: PyRendererAgg_get_content_extentsstatic PyObject *PyRendererAgg_get_content_extents(PyRendererAgg *self, PyObject *args, PyObject *kwds){ agg::rect_i extents; CALL_CPP("get_content_extents", (extents = self->x->get_content_extents())); return Py_BuildValue( "iiii", extents.x1, extents.y1, extents.x2 - extents.x1, extents.y2 - extents.y1);}
开发者ID:agardelein,项目名称:matplotlib,代码行数:10,
示例11: PyTriContourGenerator_create_contourstatic PyObject* PyTriContourGenerator_create_contour(PyTriContourGenerator* self, PyObject* args, PyObject* kwds){ double level; if (!PyArg_ParseTuple(args, "d:create_contour", &level)) { return NULL; } PyObject* result; CALL_CPP("create_contour", (result = self->ptr->create_contour(level))); return result;}
开发者ID:7924102,项目名称:matplotlib,代码行数:11,
示例12: PyTriangulation_get_neighborsstatic PyObject* PyTriangulation_get_neighbors(PyTriangulation* self, PyObject* args, PyObject* kwds){ Triangulation::NeighborArray* result; CALL_CPP("get_neighbors", (result = &self->ptr->get_neighbors())); if (result->empty()) { Py_RETURN_NONE; } else return result->pyobj();}
开发者ID:7924102,项目名称:matplotlib,代码行数:11,
示例13: CALL_CPPstatic PyObject *PyRendererAgg_draw_quad_mesh(PyRendererAgg *self, PyObject *args, PyObject *kwds){ GCAgg gc; agg::trans_affine master_transform; unsigned int mesh_width; unsigned int mesh_height; numpy::array_view<const double, 3> coordinates; numpy::array_view<const double, 2> offsets; agg::trans_affine offset_trans; numpy::array_view<const double, 2> facecolors; bool antialiased; numpy::array_view<const double, 2> edgecolors; if (!PyArg_ParseTuple(args, "O&O&IIO&O&O&O&O&O&:draw_quad_mesh", &convert_gcagg, &gc, &convert_trans_affine, &master_transform, &mesh_width, &mesh_height, &coordinates.converter, &coordinates, &convert_points, &offsets, &convert_trans_affine, &offset_trans, &convert_colors, &facecolors, &convert_bool, &antialiased, &convert_colors, &edgecolors)) { return NULL; } CALL_CPP("draw_quad_mesh", (self->x->draw_quad_mesh(gc, master_transform, mesh_width, mesh_height, coordinates, offsets, offset_trans, facecolors, antialiased, edgecolors))); Py_RETURN_NONE;}
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:50,
示例14: PyQuadContourGenerator_create_filled_contourstatic PyObject* PyQuadContourGenerator_create_filled_contour(PyQuadContourGenerator* self, PyObject* args, PyObject* kwds){ double lower_level, upper_level; if (!PyArg_ParseTuple(args, "dd:create_filled_contour", &lower_level, &upper_level)) { return NULL; } PyObject* result; CALL_CPP("create_filled_contour", (result = self->ptr->create_filled_contour(lower_level, upper_level))); return result;}
开发者ID:HolgerPeters,项目名称:matplotlib,代码行数:14,
示例15: PyTriangulation_set_maskstatic PyObject* PyTriangulation_set_mask(PyTriangulation* self, PyObject* args, PyObject* kwds){ Triangulation::MaskArray mask; if (!PyArg_ParseTuple(args, "O&:set_mask", &mask.converter, &mask)) { return NULL; } if (!mask.empty() && mask.dim(0) != self->ptr->get_ntri()) { PyErr_SetString(PyExc_ValueError, "mask must be a 1D array with the same length as the triangles array"); } CALL_CPP("set_mask", (self->ptr->set_mask(mask))); Py_RETURN_NONE;}
开发者ID:7924102,项目名称:matplotlib,代码行数:16,
示例16: PyRendererAgg_draw_gouraud_trianglesstatic PyObject *PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObject *kwds){ GCAgg gc; numpy::array_view<const double, 3> points; numpy::array_view<const double, 3> colors; agg::trans_affine trans; if (!PyArg_ParseTuple(args, "O&O&O&O&|O:draw_gouraud_triangles", &convert_gcagg, &gc, &points.converter, &points, &colors.converter, &colors, &convert_trans_affine, &trans)) { return NULL; } if (points.size() != 0 && (points.dim(1) != 3 || points.dim(2) != 2)) { PyErr_Format(PyExc_ValueError, "points must be a Nx3x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, points.dim(0), points.dim(1), points.dim(2)); return NULL; } if (colors.size() != 0 && (colors.dim(1) != 3 || colors.dim(2) != 4)) { PyErr_Format(PyExc_ValueError, "colors must be a Nx3x4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT, colors.dim(0), colors.dim(1), colors.dim(2)); return NULL; } if (points.size() != colors.size()) { PyErr_Format(PyExc_ValueError, "points and colors arrays must be the same length, got %" NPY_INTP_FMT " and %" NPY_INTP_FMT, points.dim(0), colors.dim(0)); return NULL; } CALL_CPP("draw_gouraud_triangles", self->x->draw_gouraud_triangles(gc, points, colors, trans)); Py_RETURN_NONE;}
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:46,
示例17: pathsstatic PyObject *Py_get_path_collection_extents(PyObject *self, PyObject *args, PyObject *kwds){ agg::trans_affine master_transform; PyObject *pathsobj; numpy::array_view<const double, 3> transforms; numpy::array_view<const double, 2> offsets; agg::trans_affine offset_trans; extent_limits e; if (!PyArg_ParseTuple(args, "O&OO&O&O&:get_path_collection_extents", &convert_trans_affine, &master_transform, &pathsobj, &convert_transforms, &transforms, &convert_points, &offsets, &convert_trans_affine, &offset_trans)) { return NULL; } try { py::PathGenerator paths(pathsobj); CALL_CPP("get_path_collection_extents", (get_path_collection_extents( master_transform, paths, transforms, offsets, offset_trans, e))); } catch (const py::exception &) { return NULL; } npy_intp dims[] = { 2, 2 }; numpy::array_view<double, 2> extents(dims); extents(0, 0) = e.x0; extents(0, 1) = e.y0; extents(1, 0) = e.x1; extents(1, 1) = e.y1; return extents.pyobj();}
开发者ID:DanHickstein,项目名称:matplotlib,代码行数:45,
注:本文中的CALL_CPP函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CALL_FN_W_W函数代码示例 C++ CALLOC_STRUCT函数代码示例 |