summaryrefslogtreecommitdiff
path: root/src/surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/surface.c')
-rw-r--r--src/surface.c74
1 files changed, 71 insertions, 3 deletions
diff --git a/src/surface.c b/src/surface.c
index fa11413..3c1b11d 100644
--- a/src/surface.c
+++ b/src/surface.c
@@ -43,8 +43,11 @@
* PycairoPDFSurface,
* PycairoPSSurface,
* PycairoSVGSurface,
- * PycairoWin32Surface, or
- * PycairoXlibSurface from a cairo_surface_t.
+ * PycairoWin32Surface,
+ * PycairoWin32PrintingSurface,
+ * PycairoXCBSurface, or
+ * PycairoXlibSurface
+ * from a cairo_surface_t.
* surface - a cairo_surface_t to 'wrap' into a Python object.
* It is unreferenced if the PycairoSurface creation fails, or if the
* cairo_surface_t has an error status.
@@ -89,6 +92,9 @@ PycairoSurface_FromSurface (cairo_surface_t *surface, PyObject *base) {
case CAIRO_SURFACE_TYPE_WIN32:
type = &PycairoWin32Surface_Type;
break;
+ case CAIRO_SURFACE_TYPE_WIN32_PRINTING:
+ type = &PycairoWin32PrintingSurface_Type;
+ break;
#endif
#if CAIRO_HAS_XCB_SURFACE
case CAIRO_SURFACE_TYPE_XCB:
@@ -1075,10 +1081,10 @@ PyTypeObject PycairoSVGSurface_Type = {
#endif /* CAIRO_HAS_SVG_SURFACE */
-/* Class Win32Surface(Surface) -------------------------------------------- */
#if CAIRO_HAS_WIN32_SURFACE
#include <cairo-win32.h>
+/* Class Win32Surface(Surface) -------------------------------------------- */
static PyObject *
win32_surface_new (PyTypeObject *type, PyObject *args, PyObject *kwds) {
int hdc;
@@ -1137,6 +1143,68 @@ PyTypeObject PycairoWin32Surface_Type = {
0, /* tp_is_gc */
0, /* tp_bases */
};
+
+
+/* Class Win32PrintingSurface(Surface) ------------------------------------ */
+static PyObject *
+win32_printing_surface_new (PyTypeObject *type, PyObject *args,
+ PyObject *kwds) {
+ int hdc;
+
+ if (!PyArg_ParseTuple(args, "i:Win32PrintingSurface.__new__", &hdc))
+ return NULL;
+ return PycairoSurface_FromSurface (
+ cairo_win32_printing_surface_create ((HDC)hdc), NULL);
+}
+
+static PyMethodDef win32_printing_surface_methods[] = {
+ {NULL, NULL, 0, NULL},
+};
+
+PyTypeObject PycairoWin32PrintingSurface_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "cairo.Win32PrintingSurface", /* tp_name */
+ sizeof(PycairoWin32PrintingSurface), /* 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 */
+ 0, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ win32_printing_surface_methods, /* 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 */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ (newfunc)win32_printing_surface_new,/* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+};
#endif /* CAIRO_HAS_WIN32_SURFACE */