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


C++ Pycairo_Check_Status函数代码示例

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


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

示例1: matrix_invert

static PyObject *
matrix_invert (PycairoMatrix *o)
{
    if (Pycairo_Check_Status (cairo_matrix_invert (&o->matrix)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:7,代码来源:pycairo-matrix.c

示例2: pycairo_set_dash

static PyObject *
pycairo_set_dash (PycairoContext *o, PyObject *args)
{
    double *dashes, offset = 0;
    int ndash, i;
    PyObject *py_dashes;

    if (!PyArg_ParseTuple (args, "O|d:Context.set_dash", &py_dashes, &offset))
	return NULL;

    py_dashes = PySequence_Fast (py_dashes,
				 "first argument must be a sequence");
    if (!py_dashes)
	return NULL;

    ndash = PySequence_Fast_GET_SIZE(py_dashes);
    dashes = malloc (ndash * sizeof(double));
    for (i = 0; i < ndash; i++) {
	PyObject *item = PySequence_Fast_GET_ITEM(py_dashes, i);

	dashes[i] = PyFloat_AsDouble(item);
	if (PyErr_Occurred()) {
	    free (dashes);
	    Py_DECREF(py_dashes);
	    return NULL;
	}
    }
    Py_DECREF(py_dashes);

    cairo_set_dash (o->ctx, dashes, ndash, offset);
    free (dashes);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:35,代码来源:pycairo-context.c

示例3: pycairo_copy_clip_rectangle_list

static PyObject *
pycairo_copy_clip_rectangle_list (PycairoContext *o) {
  int i;
  PyObject *rv = NULL;
  cairo_rectangle_t *r;
  cairo_rectangle_list_t *rlist = cairo_copy_clip_rectangle_list (o->ctx);
  if (rlist->status != CAIRO_STATUS_SUCCESS) {
    Pycairo_Check_Status (rlist->status);
    goto exit;
  }

  rv = PyTuple_New(rlist->num_rectangles);
  if (rv == NULL)
    goto exit;

  for (i = 0, r = rlist->rectangles; i < rlist->num_rectangles; i++, r++) {
    PyObject *py_rect = Py_BuildValue("(dddd)", r->x, r->y,
				      r->width, r->height);
    if (py_rect == NULL) {
      Py_CLEAR(rv);
      goto exit;
    }
    PyTuple_SET_ITEM (rv, i, py_rect);
  }
 exit:
  cairo_rectangle_list_destroy(rlist);
  return rv;
}
开发者ID:Distrotech,项目名称:pycairo,代码行数:28,代码来源:context.c

示例4: surface_write_to_png

/* METH_O */
static PyObject *
surface_write_to_png (PycairoSurface *o, PyObject *file)
{
    FILE *fp;
    cairo_status_t status;

    if (PyObject_TypeCheck (file, &PyBaseString_Type)) {
	fp = fopen (PyString_AsString(file), "wb");
	if (fp == NULL) {
	    PyErr_SetString(PyExc_IOError, "unable to open file for writing");
	    return NULL;
	}
    } else if (PyObject_TypeCheck (file, &PyFile_Type)) {
	fp = PyFile_AsFile(file);

    } else {
	PyErr_SetString(PyExc_TypeError,
			"Surface.write_to_png takes one argument "
			"which must be a filename (str) or file object");
	return NULL;
    }
    status = cairo_surface_write_to_png_stream (o->surface, _write_func, fp);
    if (PyObject_TypeCheck (file, &PyBaseString_Type))
    	fclose (fp);

    if (Pycairo_Check_Status (status))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:curaloucura,项目名称:enso,代码行数:30,代码来源:pycairo-surface.c

示例5: scaled_font_new

static PyObject *
scaled_font_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
{
    PycairoFontFace *ff;
    PycairoFontOptions *fo;
    PycairoMatrix *mx1, *mx2;

    if (!PyArg_ParseTuple(args, "O!O!O!O!:ScaledFont.__new__",
			  &PycairoFontFace_Type, &ff,
			  &PycairoMatrix_Type, &mx1,
			  &PycairoMatrix_Type, &mx2,
			  &PycairoFontOptions_Type, &fo))
	return NULL;

    PyObject *o = type->tp_alloc(type, 0);
    if (o != NULL) {
	cairo_scaled_font_t *scaled_font = cairo_scaled_font_create
	    (ff->font_face, &mx1->matrix, &mx2->matrix, fo->font_options);

	if (Pycairo_Check_Status (cairo_scaled_font_status (scaled_font))) {
	    cairo_scaled_font_destroy (scaled_font);
	    Py_DECREF(o);
	    return NULL;
	}
	((PycairoScaledFont *)o)->scaled_font = scaled_font;
    }
    return o;
}
开发者ID:atizo,项目名称:pycairo,代码行数:28,代码来源:pycairo-font.c

示例6: PycairoFontFace_FromFontFace

/* PycairoFontFace_FromFontFace
 * Create a new PycairoFontFace from a cairo_font_face_t
 * font_face - a cairo_font_face_t to 'wrap' into a Python object.
 *             it is unreferenced if the PycairoFontFace creation fails
 * Return value: New reference or NULL on failure
 */
PyObject *
PycairoFontFace_FromFontFace (cairo_font_face_t *font_face)
{
    PyTypeObject *type = NULL;
    PyObject *o;

    assert (font_face != NULL);

    if (Pycairo_Check_Status (cairo_font_face_status (font_face))) {
	cairo_font_face_destroy (font_face);
	return NULL;
    }

    switch (cairo_font_face_get_type (font_face)) {
    case CAIRO_FONT_TYPE_TOY:
        type = &PycairoToyFontFace_Type;
        break;
    default:
        type = &PycairoFontFace_Type;
        break;
    }
    o = type->tp_alloc (type, 0);
    if (o == NULL)
	cairo_font_face_destroy (font_face);
    else
	((PycairoFontFace *)o)->font_face = font_face;
    return o;
}
开发者ID:dalembertian,项目名称:pycairo,代码行数:34,代码来源:pycairo-font.c

示例7: ps_surface_new

static PyObject *
ps_surface_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
{
    const char *filename;
    double width_in_points, height_in_points;
    cairo_surface_t *surface;
    PyObject *o;

    if (!PyArg_ParseTuple(args, "sdd:PSSurface.__new__",
			  &filename, &width_in_points, &height_in_points))
	return NULL;

    o = type->tp_alloc(type, 0);
    if (o) {
	surface = cairo_ps_surface_create (filename, width_in_points,
					   height_in_points);
	if (Pycairo_Check_Status (cairo_surface_status (surface))) {
	    cairo_surface_destroy (surface);
	    Py_DECREF(o);
	    return NULL;
	}
	((PycairoPSSurface *)o)->surface = surface;
    }
    return o;
}
开发者ID:curaloucura,项目名称:enso,代码行数:25,代码来源:pycairo-surface.c

示例8: PycairoSurface_FromSurface

/* PycairoSurface_FromSurface
 * Create a new PycairoSurface from a cairo_surface_t
 * surface - a cairo_surface_t to 'wrap' into a Python object.
 *           it is unreferenced if the PycairoSurface creation fails, or if
             the cairo_surface_t has an error status
 * type - the type of the object to instantiate; it can be NULL,
 *        meaning a base enso_win32.cairo.Surface type, or it can be a subclass of
 *        enso_win32.cairo.Surface.
 * base - the base object used to create the context, or NULL.
 *        it is referenced to keep it alive while the cairo_surface_t is
 *        being used
 * Return value: New reference or NULL on failure
 */
PyObject *
PycairoSurface_FromSurface (cairo_surface_t *surface, PyTypeObject *type,
			    PyObject *base)
{
    PyObject *o;

    assert (surface != NULL);

    if (Pycairo_Check_Status (cairo_surface_status (surface))) {
	cairo_surface_destroy (surface);
	return NULL;
    }

    if (type == NULL)
        type = &PycairoSurface_Type;
    o = PycairoSurface_Type.tp_alloc (type, 0);
    if (o) {
	((PycairoSurface *)o)->surface = surface;
	Py_XINCREF(base);
	((PycairoSurface *)o)->base = base;
    } else {
	cairo_surface_destroy (surface);
    }
    return o;
}
开发者ID:curaloucura,项目名称:enso,代码行数:38,代码来源:pycairo-surface.c

示例9: pycairo_stroke_preserve

static PyObject *
pycairo_stroke_preserve (PycairoContext *o)
{
    cairo_stroke_preserve (o->ctx);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:8,代码来源:pycairo-context.c

示例10: pycairo_reset_clip

static PyObject *
pycairo_reset_clip (PycairoContext *o)
{
    cairo_reset_clip (o->ctx);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:8,代码来源:pycairo-context.c

示例11: pycairo_new_path

static PyObject *
pycairo_new_path (PycairoContext *o)
{
    cairo_new_path (o->ctx);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:8,代码来源:pycairo-context.c

示例12: pycairo_identity_matrix

static PyObject *
pycairo_identity_matrix (PycairoContext *o)
{
    cairo_identity_matrix (o->ctx);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:8,代码来源:pycairo-context.c

示例13: PycairoSurface_FromSurface

/* PycairoSurface_FromSurface
 * Create a new
 *   PycairoImageSurface,
 *   PycairoPDFSurface,
 *   PycairoPSSurface,
 *   PycairoSVGSurface,
 *   PycairoWin32Surface, or
 *   PycairoXlibSurface from a cairo_surface_t.
 * surface - a cairo_surface_t to 'wrap' into a Python object.
 *   It is unreferenced if the PycairoSurface creation fails, or if the
 *   cairo_surface_t has an error status.
 * base - the base object used to create the surface, or NULL.
 *   It is referenced to keep it alive while the cairo_surface_t is being used.
 * Return value: New reference or NULL on failure
 */
PyObject *
PycairoSurface_FromSurface (cairo_surface_t *surface, PyObject *base)
{
    PyTypeObject *type = NULL;
    PyObject *o;

    assert (surface != NULL);

    if (Pycairo_Check_Status (cairo_surface_status (surface))) {
	cairo_surface_destroy (surface);
	return NULL;
    }

    switch (cairo_surface_get_type (surface)) {
#if CAIRO_HAS_IMAGE_SURFACE
    case CAIRO_SURFACE_TYPE_IMAGE:
	type = &PycairoImageSurface_Type;
	break;
#endif
#if CAIRO_HAS_PDF_SURFACE
    case CAIRO_SURFACE_TYPE_PDF:
	type = &PycairoPDFSurface_Type;
	break;
#endif
#if CAIRO_HAS_PS_SURFACE
    case CAIRO_SURFACE_TYPE_PS:
	type = &PycairoPSSurface_Type;
	break;
#endif
#if CAIRO_HAS_SVG_SURFACE
    case CAIRO_SURFACE_TYPE_SVG:
	type = &PycairoSVGSurface_Type;
	break;
#endif
#if CAIRO_HAS_WIN32_SURFACE
    case CAIRO_SURFACE_TYPE_WIN32:
	type = &PycairoWin32Surface_Type;
	break;
#endif
#if CAIRO_HAS_XLIB_SURFACE
    case CAIRO_SURFACE_TYPE_XLIB:
	type = &PycairoXlibSurface_Type;
	break;
#endif
    default:
	type = &PycairoSurface_Type;
	break;
    }
    o = type->tp_alloc (type, 0);
    if (o == NULL) {
	cairo_surface_destroy (surface);
    } else {
	((PycairoSurface *)o)->surface = surface;
	Py_XINCREF(base);
	((PycairoSurface *)o)->base = base;
    }
    return o;
}
开发者ID:bdon,项目名称:pycairo,代码行数:73,代码来源:pycairo-surface.c

示例14: pycairo_stroke_extents

static PyObject *
pycairo_stroke_extents (PycairoContext *o)
{
    double x1, y1, x2, y2;
    cairo_stroke_extents (o->ctx, &x1, &y1, &x2, &y2);
    if (Pycairo_Check_Status (cairo_status (o->ctx)))
	return NULL;
    return Py_BuildValue("(dddd)", x1, y1, x2, y2);
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:9,代码来源:pycairo-context.c

示例15: surface_flush

static PyObject *
surface_flush (PycairoSurface *o)
{
    cairo_surface_flush (o->surface);

    if (Pycairo_Check_Status (cairo_surface_status(o->surface)))
	return NULL;
    Py_RETURN_NONE;
}
开发者ID:curaloucura,项目名称:enso,代码行数:9,代码来源:pycairo-surface.c


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