[cairo-commit] pycairo/cairo pycairo-context.c, 1.41, 1.42 pycairo-matrix.c, 1.11, 1.12

Steve Chaplin commit at pdx.freedesktop.org
Tue May 3 21:10:02 PDT 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv18047/cairo

Modified Files:
	pycairo-context.c pycairo-matrix.c 
Log Message:
SC

Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- pycairo-context.c	28 Apr 2005 22:28:36 -0000	1.41
+++ pycairo-context.c	4 May 2005 04:10:00 -0000	1.42
@@ -92,6 +92,36 @@
 }
 
 static PyObject *
+pycairo_arc(PyCairoContext *c, PyObject *args)
+{
+    double xc, yc, radius, angle1, angle2;
+
+    if (!PyArg_ParseTuple(args, "ddddd:Context.arc",
+			  &xc, &yc, &radius, &angle1, &angle2))
+	return NULL;
+
+    cairo_arc(c->ctx, xc, yc, radius, angle1, angle2);
+    if (pycairo_check_status(cairo_status(c->ctx)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_arc_negative(PyCairoContext *c, PyObject *args)
+{
+    double xc, yc, radius, angle1, angle2;
+
+    if (!PyArg_ParseTuple(args, "ddddd:Context.arc_negative",
+			  &xc, &yc, &radius, &angle1, &angle2))
+	return NULL;
+
+    cairo_arc_negative(c->ctx, xc, yc, radius, angle1, angle2);
+    if (pycairo_check_status(cairo_status(c->ctx)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
 pycairo_clip(PyCairoContext *c)
 {
     cairo_clip(c->ctx);
@@ -114,8 +144,7 @@
 {
     PyCairoContext *src;
 
-    if (!PyArg_ParseTuple(args, "O!:Context.copy",
-			  &PyCairoContext_Type, &src))
+    if (!PyArg_ParseTuple(args, "O!:Context.copy", &PyCairoContext_Type, &src))
 	return NULL;
 
     cairo_copy(c->ctx, src->ctx);
@@ -485,6 +514,36 @@
 }
 
 static PyObject *
+pycairo_mask(PyCairoContext *c, PyObject *args)
+{
+    PyCairoPattern *p;
+
+    if (!PyArg_ParseTuple(args, "O!:Context.mask", &PyCairoPattern_Type, &p))
+	return NULL;
+
+    cairo_mask(c->ctx, p->pattern);
+    if (pycairo_check_status(cairo_status(c->ctx)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_mask_surface(PyCairoContext *c, PyObject *args)
+{
+    PyCairoSurface *s;
+    double surface_x, surface_y;
+
+    if (!PyArg_ParseTuple(args, "O!dd:Context.mask_surface", 
+			  &PyCairoSurface_Type, &s, &surface_x, &surface_y))
+	return NULL;
+
+    cairo_mask_surface(c->ctx, s->surface, surface_x, surface_y);
+    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;
@@ -535,6 +594,20 @@
 }
 
 static PyObject *
+pycairo_rotate(PyCairoContext *c, PyObject *args)
+{
+    double angle;
+
+    if (!PyArg_ParseTuple(args, "d:Context.rotate", &angle))
+	return NULL;
+
+    cairo_rotate(c->ctx, angle);
+    if (pycairo_check_status(cairo_status(c->ctx)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
 pycairo_save(PyCairoContext *c)
 {
     cairo_save(c->ctx);
@@ -734,53 +807,49 @@
     Py_RETURN_NONE;
 }
 
-#if 0
-#ifdef CAIRO_HAS_PDF_SURFACE
 static PyObject *
-pycairo_set_target_pdf(PyCairoContext *c, PyObject *args)
+pycairo_set_source_surface(PyCairoContext *c, PyObject *args)
 {
-    PyObject *file_object;
-    double width_inches, height_inches;
-    double x_pixels_per_inch, y_pixels_per_inch;
+    PyCairoSurface *surface;
+    double x, y;
 
-    if (!PyArg_ParseTuple(args, "O!dddd:Context.set_target_pdf",
-			  &PyFile_Type, &file_object,
-			  &width_inches, &height_inches,
-			  &x_pixels_per_inch, &y_pixels_per_inch))
+    if (!PyArg_ParseTuple(args, "O!dd:Context.set_source_surface",
+			  &PyCairoSurface_Type, &surface, &x, &y))
 	return NULL;
 
-    cairo_set_target_pdf(c->ctx, PyFile_AsFile(file_object),
-			width_inches, height_inches,
-			x_pixels_per_inch, y_pixels_per_inch);
+    cairo_set_source_surface(c->ctx, surface->surface, x, y);
     if (pycairo_check_status(cairo_status(c->ctx)))
 	return NULL;
     Py_RETURN_NONE;
 }
-#endif  /* CAIRO_HAS_PDF_SURFACE */
-#endif
 
-#ifdef CAIRO_HAS_PS_SURFACE
+#if 0
+#ifdef CAIRO_HAS_PDF_SURFACE
 static PyObject *
-pycairo_set_target_ps(PyCairoContext *c, PyObject *args)
+pycairo_set_target_pdf(PyCairoContext *c, PyObject *args)
 {
     PyObject *file_object;
     double width_inches, height_inches;
     double x_pixels_per_inch, y_pixels_per_inch;
 
-    if (!PyArg_ParseTuple(args, "O!dddd:Context.set_target_ps",
+    if (!PyArg_ParseTuple(args, "O!dddd:Context.set_target_pdf",
 			  &PyFile_Type, &file_object,
 			  &width_inches, &height_inches,
 			  &x_pixels_per_inch, &y_pixels_per_inch))
 	return NULL;
 
-    cairo_set_target_ps(c->ctx, PyFile_AsFile(file_object),
+    cairo_set_target_pdf(c->ctx, PyFile_AsFile(file_object),
 			width_inches, height_inches,
 			x_pixels_per_inch, y_pixels_per_inch);
+    /* file object needs to be referenced
+     * the surface constructors are better to use - they enable referencing base objects
+     */
     if (pycairo_check_status(cairo_status(c->ctx)))
 	return NULL;
     Py_RETURN_NONE;
 }
-#endif  /* CAIRO_HAS_PS_SURFACE */
+#endif  /* CAIRO_HAS_PDF_SURFACE */
+#endif
 
 static PyObject *
 pycairo_set_target_surface(PyCairoContext *c, PyObject *args)
@@ -850,20 +919,6 @@
 }
 
 static PyObject *
-pycairo_rotate(PyCairoContext *c, PyObject *args)
-{
-    double angle;
-
-    if (!PyArg_ParseTuple(args, "d:Context.rotate", &angle))
-	return NULL;
-
-    cairo_rotate(c->ctx, angle);
-    if (pycairo_check_status(cairo_status(c->ctx)))
-	return NULL;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
 pycairo_transform(PyCairoContext *c, PyObject *args)
 {
     PyCairoMatrix *matrix;
@@ -937,36 +992,6 @@
 }
 
 static PyObject *
-pycairo_arc(PyCairoContext *c, PyObject *args)
-{
-    double xc, yc, radius, angle1, angle2;
-
-    if (!PyArg_ParseTuple(args, "ddddd:Context.arc",
-			  &xc, &yc, &radius, &angle1, &angle2))
-	return NULL;
-
-    cairo_arc(c->ctx, xc, yc, radius, angle1, angle2);
-    if (pycairo_check_status(cairo_status(c->ctx)))
-	return NULL;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
-pycairo_arc_negative(PyCairoContext *c, PyObject *args)
-{
-    double xc, yc, radius, angle1, angle2;
-
-    if (!PyArg_ParseTuple(args, "ddddd:Context.arc_negative",
-			  &xc, &yc, &radius, &angle1, &angle2))
-	return NULL;
-
-    cairo_arc_negative(c->ctx, xc, yc, radius, angle1, angle2);
-    if (pycairo_check_status(cairo_status(c->ctx)))
-	return NULL;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
 pycairo_rel_move_to(PyCairoContext *c, PyObject *args)
 {
     double dx, dy;
@@ -1132,22 +1157,6 @@
 }
 
 static PyObject *
-pycairo_show_surface(PyCairoContext *c, PyObject *args)
-{
-    PyCairoSurface *surface;
-    int width, height;
-
-    if (!PyArg_ParseTuple(args, "O!ii:Context.show_surface",
-			  &PyCairoSurface_Type, &surface, &width, &height))
-	return NULL;
-
-    cairo_show_surface(c->ctx, surface->surface, width, height);
-    if (pycairo_check_status(cairo_status(c->ctx)))
-	return NULL;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
 pycairo_show_text(PyCairoContext *c, PyObject *args)
 {
     const char *utf8;
@@ -1204,6 +1213,8 @@
     { "in_fill",       (PyCFunction)pycairo_in_fill,       METH_VARARGS },
     { "in_stroke",     (PyCFunction)pycairo_in_stroke,     METH_VARARGS },
     { "line_to",       (PyCFunction)pycairo_line_to,       METH_VARARGS },
+    { "mask",          (PyCFunction)pycairo_move_to,       METH_VARARGS },
+    { "mask_surface",  (PyCFunction)pycairo_move_to,       METH_VARARGS },
     { "move_to",       (PyCFunction)pycairo_move_to,       METH_VARARGS },
     { "new_path",      (PyCFunction)pycairo_new_path,      METH_NOARGS },
     { "paint",         (PyCFunction)pycairo_paint,         METH_NOARGS },
@@ -1231,21 +1242,19 @@
     { "set_source",    (PyCFunction)pycairo_set_source,    METH_VARARGS },
     { "set_source_rgb", (PyCFunction)pycairo_set_source_rgb,METH_VARARGS },
     { "set_source_rgba",(PyCFunction)pycairo_set_source_rgba,METH_VARARGS },
+    { "set_source_surface",(PyCFunction)pycairo_set_source_surface,  
+                                                           METH_VARARGS },
     /* "set_target_image" */
 # if 0
 #ifdef CAIRO_HAS_PDF_SURFACE
     { "set_target_pdf",(PyCFunction)pycairo_set_target_pdf,METH_VARARGS},
 #endif
 # endif
-#ifdef CAIRO_HAS_PS_SURFACE
-    { "set_target_ps", (PyCFunction)pycairo_set_target_ps, METH_VARARGS},
-#endif
     { "set_target_surface",(PyCFunction)pycairo_set_target_surface,
       METH_VARARGS },
     { "set_tolerance", (PyCFunction)pycairo_set_tolerance, METH_VARARGS },
     /* show_glyphs */
     { "show_page",     (PyCFunction)pycairo_show_page,     METH_NOARGS },
-    { "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 },

Index: pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- pycairo-matrix.c	18 Apr 2005 09:52:42 -0000	1.11
+++ pycairo-matrix.c	4 May 2005 04:10:00 -0000	1.12
@@ -50,7 +50,7 @@
     PyCairoMatrix *m = (PyCairoMatrix *)PyCairoMatrix_Type.tp_new
 	(&PyCairoMatrix_Type, NULL, NULL);
     if (m)
-	*(&m->matrix) = *matrix;
+	m->matrix = *matrix;
     return (PyObject *) m;
 }
 




More information about the cairo-commit mailing list