[cairo-commit] pycairo/cairo pycairo-surface.c,1.25,1.26
Steve Chaplin
commit at pdx.freedesktop.org
Fri Apr 15 22:02:21 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv4359/cairo
Modified Files:
pycairo-surface.c
Log Message:
SC 2005/04/16
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- pycairo-surface.c 14 Apr 2005 15:47:20 -0000 1.25
+++ pycairo-surface.c 16 Apr 2005 05:02:19 -0000 1.26
@@ -548,6 +548,109 @@
};
+#if 0 /* awaiting fix to bug #3044 */
+/* Class PDFSurface ------------------------------------------------------ */
+
+PyObject *
+PyCairoPDFSurface_FromPDFSurface(cairo_surface_t *surface, PyObject *base)
+{
+ PyCairoPDFSurface *s = (PyCairoPDFSurface *)PyCairoPDFSurface_Type.tp_new
+ (&PyCairoPDFSurface_Type, NULL, NULL);
+ if (s) {
+ s->surface = surface;
+ s->base = base;
+ Py_XINCREF(base);
+ }
+ return (PyObject *) s;
+}
+
+static int
+pdf_surface_init(PyCairoSurface *s, PyObject *args, PyObject *kwds)
+{
+ 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 -1;
+ if (width_inches <= 0) {
+ PyErr_SetString(PyExc_ValueError, "width_inches must be positive");
+ return -1;
+ }
+ if (height_inches <= 0) {
+ PyErr_SetString(PyExc_ValueError, "height_inches must be positive");
+ return -1;
+ }
+ if (x_pixels_per_inch <= 0) {
+ PyErr_SetString(PyExc_ValueError, "x_pixels_per_inch must be positive");
+ return -1;
+ }
+ if (y_pixels_per_inch <= 0) {
+ PyErr_SetString(PyExc_ValueError, "y_pixels_per_inch must be positive");
+ return -1;
+ }
+ s->surface = cairo_pdf_surface_create(PyFile_AsFile(file_object),
+ width_inches, height_inches, x_pixels_per_inch, y_pixels_per_inch);
+ if (!s->surface) {
+ Py_DECREF(s);
+ PyErr_NoMemory();
+ return -1;
+ }
+ s->base = file_object;
+ Py_INCREF(file_object);
+ return 0;
+}
+
+PyTypeObject PyCairoPDFSurface_Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, /* ob_size */
+ "cairo.PDFSurface", /* tp_name */
+ sizeof(PyCairoPDFSurface), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ 0, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ NULL, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ &PyCairoSurface_Type, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)pdf_surface_init, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+};
+#endif /* awaiting fix to bug #3044 */
+
+
/* Numeric routines -------------------------------------------------------- */
#ifdef HAVE_NUMPY
More information about the cairo-commit
mailing list