[cairo-commit] pycairo/cairo cairogtkmodule.c,1.32,1.33

Steve Chaplin commit at pdx.freedesktop.org
Wed Aug 10 08:40:02 PDT 2005


Committed by: stevech1097

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

Modified Files:
	cairogtkmodule.c 
Log Message:
'SC'

Index: cairogtkmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairogtkmodule.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cairogtkmodule.c	9 Aug 2005 14:37:55 -0000	1.32
+++ cairogtkmodule.c	10 Aug 2005 15:40:00 -0000	1.33
@@ -49,42 +49,6 @@
 
 static PyTypeObject *_PyGdkDrawable_Type;
 #define PyGdkDrawable_Type (*_PyGdkDrawable_Type)
-static PyTypeObject *_PyGdkPixbuf_Type;
-#define PyGdkPixbuf_Type (*_PyGdkPixbuf_Type)
-
-static PyObject *
-surface_create_for_pixbuf(PyObject *self, PyObject *args)
-{
-    PyGObject *py_pixbuf;
-    GdkPixbuf *gdk_pixbuf;
-    cairo_surface_t *surface;
-
-    if (!PyArg_ParseTuple(args, "O!:surface_create_for_pixbuf",
-			  &PyGdkPixbuf_Type, &py_pixbuf))
-	return NULL;
-
-    gdk_pixbuf = GDK_PIXBUF(py_pixbuf->obj);
-
-    /* this is the only format that matches cairo's image format.
-     * GdkPixbuf uses RGBA, while Cairo uses ARGB, so we can't handle
-     * pixbufs with alpha. */
-    if (gdk_pixbuf_get_colorspace(gdk_pixbuf) != GDK_COLORSPACE_RGB ||
-	gdk_pixbuf_get_bits_per_sample(gdk_pixbuf) != 8 ||
-	gdk_pixbuf_get_n_channels(gdk_pixbuf) != 4) {
-	PyErr_SetString(PyExc_ValueError,
-			"can only create a surface from a 24-bit RGB pixbuf "
-			"(ie. no alpha)");
-	return NULL;
-    }
-    surface = cairo_image_surface_create_for_data
-	(gdk_pixbuf_get_pixels(gdk_pixbuf),
-	 CAIRO_FORMAT_RGB24,
-	 gdk_pixbuf_get_width(gdk_pixbuf),
-	 gdk_pixbuf_get_height(gdk_pixbuf),
-	 gdk_pixbuf_get_rowstride(gdk_pixbuf));
-    return PycairoSurface_FromSurface (surface, &PycairoImageSurface_Type,
-				       (PyObject *)py_pixbuf);
-}
 
 #ifndef HAVE_GTK28
 /* copied from gtk+/gdk/gdkcairo.c and gtk+/gdk/x11/gdkdrawable-x11.c
@@ -153,8 +117,6 @@
 
 static PyMethodDef cairogtk_functions[] = {
     { "gdk_cairo_create", (PyCFunction)pygdk_cairo_create,     METH_VARARGS },
-    { "surface_create_for_pixbuf",
-      (PyCFunction)surface_create_for_pixbuf,                  METH_VARARGS },
     { NULL, NULL, 0 }
 };
 
@@ -174,6 +136,4 @@
 	return;
     _PyGdkDrawable_Type = (PyTypeObject *)PyObject_GetAttrString(mod,
 								 "Drawable");
-    _PyGdkPixbuf_Type   = (PyTypeObject *)PyObject_GetAttrString(mod,
-								 "Pixbuf");
 }




More information about the cairo-commit mailing list