当前位置: 首页>>代码示例>>C++>>正文


C++ CALL_CPP函数代码示例

本文整理汇总了C++中CALL_CPP函数的典型用法代码示例。如果您正苦于以下问题:C++ CALL_CPP函数的具体用法?C++ CALL_CPP怎么用?C++ CALL_CPP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CALL_CPP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CALL_CPP

static 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,代码来源:_image_wrapper.cpp

示例2: vertices

static 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,代码来源:_path_wrapper.cpp

示例3: CALL_CPP

static 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,
                          &regobj,
                          &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,代码来源:_backend_agg_wrapper.cpp

示例4: CALL_CPP

static 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,代码来源:_path_wrapper.cpp

示例5: results

static 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,代码来源:_path_wrapper.cpp

示例6: PyRendererAgg_draw_gouraud_triangles

static 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,代码来源:_backend_agg_wrapper.cpp

示例7: mpl_round

static 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,代码来源:_backend_agg_wrapper.cpp

示例8: paths

static 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,代码来源:_path_wrapper.cpp

示例9: Image

static 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,代码来源:_image_wrapper.cpp

示例10: PyRendererAgg_get_content_extents

static 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,代码来源:_backend_agg_wrapper.cpp

示例11: PyTriContourGenerator_create_contour

static 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,代码来源:_tri_wrapper.cpp

示例12: PyTriangulation_get_neighbors

static 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,代码来源:_tri_wrapper.cpp

示例13: CALL_CPP

static 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,代码来源:_backend_agg_wrapper.cpp

示例14: PyQuadContourGenerator_create_filled_contour

static 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,代码来源:_contour_wrapper.cpp

示例15: PyTriangulation_set_mask

static 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,代码来源:_tri_wrapper.cpp


注:本文中的CALL_CPP函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。