[cairo-commit] pycairo/cairo cairomodule.c, 1.13, 1.14 cairogtkmodule.c, 1.11, 1.12 pycairo-surface.c, 1.9, 1.10

Steve Chaplin commit at pdx.freedesktop.org
Fri Mar 18 04:04:37 PST 2005


Committed by: stevech1097

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

Modified Files:
	cairomodule.c cairogtkmodule.c pycairo-surface.c 
Log Message:
SC 2005/03/18

Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cairomodule.c	11 Mar 2005 17:03:05 -0000	1.13
+++ cairomodule.c	18 Mar 2005 12:04:35 -0000	1.14
@@ -159,6 +159,7 @@
 }
 #endif /* CAIRO_HAS_PS_SURFACE */
 
+#if 0
 #ifdef CAIRO_HAS_PDF_SURFACE
 static PyObject *
 pycairo_pdf_surface_create(PyObject *self, PyObject *args)
@@ -193,6 +194,7 @@
     return pycairo_surface_wrap(surface);
 }
 #endif /* CAIRO_HAS_PDF_SURFACE */
+#endif
 
 #ifdef CAIRO_HAS_PNG_SURFACE
 static PyObject *
@@ -227,9 +229,11 @@
 
 static PyMethodDef cairo_functions[] = {
     { "image_surface_create_for_data", (PyCFunction)pycairo_image_surface_create_for_data, METH_VARARGS, "" },
+#if 0
 #ifdef CAIRO_HAS_PDF_SURFACE
     { "pdf_surface_create", (PyCFunction)pycairo_pdf_surface_create, METH_VARARGS, "" },
 #endif
+#endif
 #ifdef CAIRO_HAS_PNG_SURFACE
     { "png_surface_create", (PyCFunction)pycairo_png_surface_create, METH_VARARGS, "" },
 #endif

Index: cairogtkmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairogtkmodule.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairogtkmodule.c	18 Mar 2005 09:55:52 -0000	1.11
+++ cairogtkmodule.c	18 Mar 2005 12:04:35 -0000	1.12
@@ -75,6 +75,7 @@
     PyGObject   *py_drawable;
     GdkDrawable *gdk_drawable;
     gint x_offset, y_offset;
+    cairo_surface_t *surface;
 
     if (!PyArg_ParseTuple(args, "O!O!:set_target_drawable",
 			  &PyCairoContext_Type, &py_ctx,
@@ -95,7 +96,9 @@
 			      GDK_DRAWABLE_XID(gdk_drawable));
     if (pycairo_check_status(cairo_status(py_ctx->ctx)))
 	return NULL;
-    cairo_translate(py_ctx->ctx, -x_offset, -y_offset);
+
+    surface = cairo_get_target_surface(py_ctx->ctx);
+    cairo_surface_set_device_offset (surface, x_offset, y_offset);
     if (pycairo_check_status(cairo_status(py_ctx->ctx)))
 	return NULL;
 

Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pycairo-surface.c	10 Dec 2004 15:16:40 -0000	1.9
+++ pycairo-surface.c	18 Mar 2005 12:04:35 -0000	1.10
@@ -86,31 +86,9 @@
 }
 
 static PyObject *
-pycairo_surface_set_repeat(PyCairoSurface *self, PyObject *args)
-{
-    int repeat;
-    cairo_status_t status;
-
-    if (!PyArg_ParseTuple(args, "i:Surface.set_repeat", &repeat))
-	return NULL;
-
-    status = cairo_surface_set_repeat(self->surface, repeat);
-    if (pycairo_check_status(status))
-	return NULL;
-    Py_RETURN_NONE;
-}
-
-static PyObject *
-pycairo_surface_set_matrix(PyCairoSurface *self, PyObject *args)
+pycairo_surface_get_filter(PyCairoSurface *self)
 {
-    PyCairoMatrix *matrix;
-
-    if (!PyArg_ParseTuple(args, "O!:Surface.set_matrix",
-			  &PyCairoMatrix_Type, &matrix))
-	return NULL;
-
-    cairo_surface_set_matrix(self->surface, matrix->matrix);
-    Py_RETURN_NONE;
+    return PyInt_FromLong(cairo_surface_get_filter(self->surface));
 }
 
 static PyObject *
@@ -132,11 +110,17 @@
 }
 
 static PyObject *
-pycairo_surface_get_filter(PyCairoSurface *self)
+pycairo_surface_set_device_offset(PyCairoSurface *self, PyObject *args)
 {
-    return PyInt_FromLong(cairo_surface_get_filter(self->surface));
-}
+    double x_offset, y_offset;
 
+    if (!PyArg_ParseTuple(args, "dd:Surface.set_device_offset", 
+			  &x_offset, &y_offset))
+	return NULL;
+
+    cairo_surface_set_device_offset (self->surface, x_offset, y_offset);
+    Py_RETURN_NONE;
+}
 
 static PyObject *
 pycairo_surface_set_filter(PyCairoSurface *self, PyObject *args)
@@ -153,9 +137,39 @@
     Py_RETURN_NONE;
 }
 
+static PyObject *
+pycairo_surface_set_matrix(PyCairoSurface *self, PyObject *args)
+{
+    PyCairoMatrix *matrix;
+
+    if (!PyArg_ParseTuple(args, "O!:Surface.set_matrix",
+			  &PyCairoMatrix_Type, &matrix))
+	return NULL;
+
+    cairo_surface_set_matrix(self->surface, matrix->matrix);
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+pycairo_surface_set_repeat(PyCairoSurface *self, PyObject *args)
+{
+    int repeat;
+    cairo_status_t status;
+
+    if (!PyArg_ParseTuple(args, "i:Surface.set_repeat", &repeat))
+	return NULL;
+
+    status = cairo_surface_set_repeat(self->surface, repeat);
+    if (pycairo_check_status(status))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
 static PyMethodDef pycairo_surface_methods[] = {
     { "create_similar", (PyCFunction)pycairo_surface_create_similar,
       METH_VARARGS },
+    { "set_device_offset", (PyCFunction)pycairo_surface_set_device_offset, 
+      METH_VARARGS },
     { "set_filter", (PyCFunction)pycairo_surface_set_filter, METH_VARARGS },
     { "set_matrix", (PyCFunction)pycairo_surface_set_matrix, METH_VARARGS },
     { "set_repeat", (PyCFunction)pycairo_surface_set_repeat, METH_VARARGS },
@@ -163,7 +177,6 @@
 };
 
 static PyGetSetDef pycairo_surface_getsets[] = {
-    /* for some reason, there is no cairo_surface_get_repeat */
     { "filter", (getter)pycairo_surface_get_filter, (setter)0 },
     { "matrix", (getter)pycairo_surface_get_matrix, (setter)0 },
     { NULL, }




More information about the cairo-commit mailing list