[cairo-commit]
pycairo/cairo pycairo.h, 1.23, 1.24 pycairo-private.h,
1.17, 1.18 pycairo-surface.c, 1.28, 1.29 cairomodule.c, 1.24,
1.25 pycairo-context.c, 1.38, 1.39
Steve Chaplin
commit at pdx.freedesktop.org
Wed Apr 27 00:34:52 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv20093/cairo
Modified Files:
pycairo.h pycairo-private.h pycairo-surface.c cairomodule.c
pycairo-context.c
Log Message:
SC
Index: pycairo.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- pycairo.h 25 Apr 2005 04:12:31 -0000 1.23
+++ pycairo.h 27 Apr 2005 07:34:50 -0000 1.24
@@ -72,6 +72,7 @@
} PyCairoSurface;
#define PyCairoImageSurface PyCairoSurface
+#define PyCairoPDFSurface PyCairoSurface
struct _PyCairo_FunctionStruct {
int (* check_status)(cairo_status_t status);
Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- pycairo-private.h 14 Apr 2005 12:05:26 -0000 1.17
+++ pycairo-private.h 27 Apr 2005 07:34:50 -0000 1.18
@@ -49,6 +49,7 @@
extern PyTypeObject PyCairoSurface_Type;
extern PyTypeObject PyCairoImageSurface_Type;
+extern PyTypeObject PyCairoPDFSurface_Type;
int pycairo_check_status(cairo_status_t status);
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- pycairo-surface.c 27 Apr 2005 03:54:02 -0000 1.28
+++ pycairo-surface.c 27 Apr 2005 07:34:50 -0000 1.29
@@ -555,7 +555,6 @@
};
-#if 0 /* awaiting fix to bug #3044 */
/* Class PDFSurface ------------------------------------------------------ */
PyObject *
@@ -655,7 +654,6 @@
0, /* tp_is_gc */
0, /* tp_bases */
};
-#endif /* awaiting fix to bug #3044 */
/* Numeric routines -------------------------------------------------------- */
Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cairomodule.c 14 Apr 2005 12:05:26 -0000 1.24
+++ cairomodule.c 27 Apr 2005 07:34:50 -0000 1.25
@@ -86,47 +86,6 @@
}
}
-#if 0
-#ifdef CAIRO_HAS_PDF_SURFACE
-static PyObject *
-pycairo_pdf_surface_create(PyObject *self, PyObject *args)
-{
- PyObject *py_surface;
- PyObject *file_object;
- int width_inches, height_inches, x_pixels_per_inch, y_pixels_per_inch;
- cairo_surface_t *surface;
-
- if (!PyArg_ParseTuple(args, "O!iiii:pdf_surface_create",
- &PyFile_Type, &file_object, &width_inches, &height_inches, &x_pixels_per_inch, &y_pixels_per_inch))
- return NULL;
- if (width_inches <= 0) {
- PyErr_SetString(PyExc_ValueError, "width_inches must be positive");
- return NULL;
- }
- if (height_inches <= 0) {
- PyErr_SetString(PyExc_ValueError, "height_inches must be positive");
- return NULL;
- }
- if (x_pixels_per_inch <= 0) {
- PyErr_SetString(PyExc_ValueError, "x_pixels_per_inch must be positive");
- return NULL;
- }
- if (y_pixels_per_inch <= 0) {
- PyErr_SetString(PyExc_ValueError, "y_pixels_per_inch must be positive");
- return NULL;
- }
- surface = cairo_pdf_surface_create(PyFile_AsFile(file_object), width_inches, height_inches, x_pixels_per_inch, y_pixels_per_inch);
- if (!surface)
- return PyErr_NoMemory();
-
- py_surface = PyCairoSurface_FromSurface(surface, file_object);
- if (!py_surface)
- cairo_surface_destroy(surface);
- return py_surface;
-}
-#endif /* CAIRO_HAS_PDF_SURFACE */
-#endif
-
#ifdef CAIRO_HAS_PS_SURFACE
static PyObject *
pycairo_ps_surface_create(PyObject *self, PyObject *args)
@@ -171,11 +130,6 @@
#endif /* CAIRO_HAS_PS_SURFACE */
static PyMethodDef cairo_functions[] = {
-#if 0
-#ifdef CAIRO_HAS_PDF_SURFACE
- { "pdf_surface_create", (PyCFunction)pycairo_pdf_surface_create, METH_VARARGS, "" },
-#endif
-#endif
#ifdef CAIRO_HAS_PS_SURFACE
{ "ps_surface_create", (PyCFunction)pycairo_ps_surface_create, METH_VARARGS, "" },
#endif
@@ -196,27 +150,21 @@
{
PyObject *mod;
-/* tp_alloc and tp_new lines not required in Python 2.3+ ?
-#define INIT_TYPE(tp) \
- if (!tp.ob_type) tp.ob_type = &PyType_Type; \
- if (!tp.tp_alloc) tp.tp_alloc = PyType_GenericAlloc; \
- if (!tp.tp_new) tp.tp_new = PyType_GenericNew; \
- if (PyType_Ready(&tp) < 0) \
+ if (PyType_Ready(&PyCairoContext_Type) < 0)
return;
-*/
-#define INIT_TYPE(tp) \
- if (PyType_Ready(&tp) < 0) \
+ if (PyType_Ready(&PyCairoFontFace_Type) < 0)
+ return;
+ if (PyType_Ready(&PyCairoMatrix_Type) < 0)
+ return;
+ if (PyType_Ready(&PyCairoPattern_Type) < 0)
return;
- INIT_TYPE(PyCairoContext_Type);
- INIT_TYPE(PyCairoFontFace_Type);
- INIT_TYPE(PyCairoMatrix_Type);
- INIT_TYPE(PyCairoPattern_Type);
-
- INIT_TYPE(PyCairoSurface_Type);
- INIT_TYPE(PyCairoImageSurface_Type);
-
-#undef INIT_TYPE
+ if (PyType_Ready(&PyCairoSurface_Type) < 0)
+ return;
+ if (PyType_Ready(&PyCairoImageSurface_Type) < 0)
+ return;
+ if (PyType_Ready(&PyCairoPDFSurface_Type) < 0)
+ return;
mod = Py_InitModule("cairo._cairo", cairo_functions);
@@ -227,6 +175,7 @@
PyModule_AddObject(mod, "Surface", (PyObject *)&PyCairoSurface_Type);
PyModule_AddObject(mod, "ImageSurface", (PyObject *)&PyCairoImageSurface_Type);
+ PyModule_AddObject(mod, "PDFSurface", (PyObject *)&PyCairoPDFSurface_Type);
PyModule_AddObject(mod, "_PyCairo_API",
PyCObject_FromVoidPtr(&api, NULL));
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- pycairo-context.c 20 Apr 2005 01:23:24 -0000 1.38
+++ pycairo-context.c 27 Apr 2005 07:34:50 -0000 1.39
@@ -92,6 +92,24 @@
}
static PyObject *
+pycairo_clip(PyCairoContext *c)
+{
+ cairo_clip(c->ctx);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_clip_preserve(PyCairoContext *c)
+{
+ cairo_clip_preserve(c->ctx);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_copy(PyCairoContext *c, PyObject *args)
{
PyCairoContext *src;
@@ -136,6 +154,24 @@
}
static PyObject *
+pycairo_fill(PyCairoContext *c)
+{
+ cairo_fill(c->ctx);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_fill_preserve(PyCairoContext *c)
+{
+ cairo_fill_preserve(c->ctx);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_fill_extents(PyCairoContext *c)
{
double x1, y1, x2, y2;
@@ -436,6 +472,29 @@
}
static PyObject *
+pycairo_move_to(PyCairoContext *c, PyObject *args)
+{
+ double x, y;
+
+ if (!PyArg_ParseTuple(args, "dd:Context.move_to", &x, &y))
+ return NULL;
+
+ cairo_move_to(c->ctx, x, y);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_new_path(PyCairoContext *c)
+{
+ cairo_new_path(c->ctx);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_paint(PyCairoContext *c)
{
cairo_paint(c->ctx);
@@ -472,6 +531,20 @@
}
static PyObject *
+pycairo_scale(PyCairoContext *c, PyObject *args)
+{
+ double sx, sy;
+
+ if (!PyArg_ParseTuple(args, "dd:Context.scale", &sx, &sy))
+ return NULL;
+
+ cairo_scale(c->ctx, sx, sy);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_set_dash(PyCairoContext *c, PyObject *args)
{
double *dashes, offset = 0;
@@ -576,6 +649,20 @@
}
static PyObject *
+pycairo_set_miter_limit(PyCairoContext *c, PyObject *args)
+{
+ double limit;
+
+ if (!PyArg_ParseTuple(args, "d:Context.set_miter_limit", &limit))
+ return NULL;
+
+ cairo_set_miter_limit(c->ctx, limit);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_set_operator(PyCairoContext *c, PyObject *args)
{
cairo_operator_t op;
@@ -736,20 +823,6 @@
}
static PyObject *
-pycairo_set_miter_limit(PyCairoContext *c, PyObject *args)
-{
- double limit;
-
- if (!PyArg_ParseTuple(args, "d:Context.set_miter_limit", &limit))
- return NULL;
-
- cairo_set_miter_limit(c->ctx, limit);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
pycairo_translate(PyCairoContext *c, PyObject *args)
{
double tx, ty;
@@ -764,20 +837,6 @@
}
static PyObject *
-pycairo_scale(PyCairoContext *c, PyObject *args)
-{
- double sx, sy;
-
- if (!PyArg_ParseTuple(args, "dd:Context.scale", &sx, &sy))
- return NULL;
-
- cairo_scale(c->ctx, sx, sy);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
pycairo_rotate(PyCairoContext *c, PyObject *args)
{
double angle;
@@ -836,29 +895,6 @@
}
static PyObject *
-pycairo_new_path(PyCairoContext *c)
-{
- cairo_new_path(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
-pycairo_move_to(PyCairoContext *c, PyObject *args)
-{
- double x, y;
-
- if (!PyArg_ParseTuple(args, "dd:Context.move_to", &x, &y))
- return NULL;
-
- cairo_move_to(c->ctx, x, y);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
pycairo_line_to(PyCairoContext *c, PyObject *args)
{
double x, y;
@@ -994,9 +1030,9 @@
}
static PyObject *
-pycairo_fill(PyCairoContext *c)
+pycairo_stroke_preserve(PyCairoContext *c)
{
- cairo_fill(c->ctx);
+ cairo_stroke_preserve(c->ctx);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
@@ -1021,15 +1057,6 @@
}
static PyObject *
-pycairo_clip(PyCairoContext *c)
-{
- cairo_clip(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
pycairo_select_font_face(PyCairoContext *c, PyObject *args)
{
const char *family;
@@ -1218,6 +1245,7 @@
{ "show_surface", (PyCFunction)pycairo_show_surface, METH_VARARGS },
{ "show_text", (PyCFunction)pycairo_show_text, METH_VARARGS },
{ "stroke", (PyCFunction)pycairo_stroke, METH_NOARGS },
+ { "stroke_preserve",(PyCFunction)pycairo_stroke, METH_NOARGS },
{ "text_extents", (PyCFunction)pycairo_text_extents, METH_VARARGS },
{ "text_path", (PyCFunction)pycairo_text_path, METH_VARARGS },
{ "transform", (PyCFunction)pycairo_transform, METH_VARARGS },
More information about the cairo-commit
mailing list