[cairo-commit] pycairo/cairo cairomodule.c, 1.28,
1.29 cairogtkmodule.c, 1.16, 1.17 pycairo-context.c, 1.44,
1.45 pycairo-surface.c, 1.32, 1.33
Steve Chaplin
commit at pdx.freedesktop.org
Fri May 6 21:28:09 PDT 2005
- Previous message: [cairo-commit] pycairo/examples context-subclass.py, 1.5,
1.6 gradient.py, 1.6, 1.7 hering.py, 1.6, 1.7 spiral.py, 1.4,
1.5 warpedtext.py, 1.9, 1.10
- Next message: [cairo-commit] cairo ChangeLog,1.553,1.554 configure.in,1.98,1.99
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv9073/cairo
Modified Files:
cairomodule.c cairogtkmodule.c pycairo-context.c
pycairo-surface.c
Log Message:
SC
Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- cairomodule.c 6 May 2005 13:46:13 -0000 1.28
+++ cairomodule.c 7 May 2005 04:28:06 -0000 1.29
@@ -171,16 +171,19 @@
CONSTANT(FORMAT_A1);
CONSTANT(OPERATOR_CLEAR);
- CONSTANT(OPERATOR_SRC);
- CONSTANT(OPERATOR_DST);
+
+ CONSTANT(OPERATOR_SOURCE);
CONSTANT(OPERATOR_OVER);
- CONSTANT(OPERATOR_OVER_REVERSE);
CONSTANT(OPERATOR_IN);
- CONSTANT(OPERATOR_IN_REVERSE);
CONSTANT(OPERATOR_OUT);
- CONSTANT(OPERATOR_OUT_REVERSE);
CONSTANT(OPERATOR_ATOP);
- CONSTANT(OPERATOR_ATOP_REVERSE);
+
+ CONSTANT(OPERATOR_DEST);
+ CONSTANT(OPERATOR_DEST_OVER);
+ CONSTANT(OPERATOR_DEST_IN);
+ CONSTANT(OPERATOR_DEST_OUT);
+ CONSTANT(OPERATOR_DEST_ATOP);
+
CONSTANT(OPERATOR_XOR);
CONSTANT(OPERATOR_ADD);
CONSTANT(OPERATOR_SATURATE);
Index: cairogtkmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairogtkmodule.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cairogtkmodule.c 6 May 2005 13:46:13 -0000 1.16
+++ cairogtkmodule.c 7 May 2005 04:28:06 -0000 1.17
@@ -68,43 +68,6 @@
}
static PyObject *
-set_target_drawable(PyObject *self, PyObject *args)
-{
- PyCairoContext *py_ctx;
- 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,
- &PyGdkDrawable_Type, &py_drawable))
- return NULL;
-
- if (GDK_IS_WINDOW(py_drawable->obj)) { /* GdkWindow */
- gdk_window_get_internal_paint_info(GDK_WINDOW(py_drawable->obj),
- &gdk_drawable,
- &x_offset, &y_offset);
- } else { /* GdkPixmap */
- gdk_drawable = GDK_DRAWABLE(py_drawable->obj);
- x_offset = y_offset = 0;
- }
-
- cairo_set_target_drawable(py_ctx->ctx,
- GDK_DRAWABLE_XDISPLAY(gdk_drawable),
- GDK_DRAWABLE_XID(gdk_drawable));
- if (pycairo_check_status(cairo_status(py_ctx->ctx)))
- return NULL;
-
- 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;
-
- Py_RETURN_NONE;
-}
-
-static PyObject *
surface_create_for_drawable(PyObject *self, PyObject *args)
{
PyObject *py_surface;
@@ -276,7 +239,6 @@
}
static PyMethodDef cairogtk_functions[] = {
- { "set_target_drawable", (PyCFunction)set_target_drawable, METH_VARARGS },
{ "surface_create_for_drawable", /* deprecated */
(PyCFunction)surface_create_for_drawable, METH_VARARGS },
{ "surface_create_for_pixbuf",
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- pycairo-context.c 6 May 2005 13:46:13 -0000 1.44
+++ pycairo-context.c 7 May 2005 04:28:06 -0000 1.45
@@ -77,7 +77,13 @@
static int
pycairo_init(PyCairoContext *c, PyObject *args, PyObject *kwds)
{
- c->ctx = cairo_create();
+ PyCairoSurface *s;
+
+ if (!PyArg_ParseTuple(args, "O!:Context.__init__",
+ &PyCairoSurface_Type, &s))
+ return -1;
+
+ c->ctx = cairo_create(s->surface);
if (!c->ctx) {
PyErr_SetString(PyExc_RuntimeError, "could not create context");
Py_DECREF(c);
@@ -139,20 +145,6 @@
}
static PyObject *
-pycairo_copy(PyCairoContext *c, PyObject *args)
-{
- PyCairoContext *src;
-
- if (!PyArg_ParseTuple(args, "O!:Context.copy", &PyCairoContext_Type, &src))
- return NULL;
-
- cairo_copy(c->ctx, src->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
pycairo_device_to_user(PyCairoContext *c, PyObject *args)
{
double x, y;
@@ -300,130 +292,6 @@
return PyInt_FromLong(cairo_get_operator(c->ctx));
}
-/* cairo_get_path() struct and wrappers */
-typedef struct {
- PyObject* move_to;
- PyObject* line_to;
- PyObject* curve_to;
- PyObject* close_path;
-} py_path_callbacks;
-
-static void
-py_wrapper_move_to(void *closure, double x, double y)
-{
- if(!PyErr_Occurred()) {
- py_path_callbacks *callbacks = (py_path_callbacks *)closure;
- PyObject *arglist, *result = NULL;
- arglist = Py_BuildValue("(dd)", x, y);
- result = PyEval_CallObject(callbacks->move_to, arglist);
- Py_DECREF(arglist);
- Py_XDECREF(result);
- }
-}
-
-static void
-py_wrapper_line_to(void *closure, double x, double y)
-{
- if(!PyErr_Occurred()) {
- py_path_callbacks *callbacks = (py_path_callbacks *)closure;
- PyObject *arglist, *result = NULL;
- arglist = Py_BuildValue("(dd)", x, y);
- result = PyEval_CallObject(callbacks->line_to, arglist);
- Py_DECREF(arglist);
- Py_XDECREF(result);
- }
-}
-
-static void
-py_wrapper_curve_to(void *closure, double x1, double y1, double x2, double y2, double x3, double y3)
-{
- if(!PyErr_Occurred()) {
- py_path_callbacks *callbacks = (py_path_callbacks *)closure;
- PyObject *arglist, *result = NULL;
- arglist = Py_BuildValue("(dddddd)", x1, y1, x2, y2, x3, y3);
- result = PyEval_CallObject(callbacks->curve_to, arglist);
- Py_DECREF(arglist);
- Py_XDECREF(result);
- }
-}
-
-static void
-py_wrapper_close_path(void *closure)
-{
- if(!PyErr_Occurred()) {
- py_path_callbacks *callbacks = (py_path_callbacks *)closure;
- PyObject *arglist, *result = NULL;
- arglist = Py_BuildValue("()");
- result = PyEval_CallObject(callbacks->close_path, arglist);
- Py_DECREF(arglist);
- Py_XDECREF(result);
- }
-}
-
-static PyObject *
-pycairo_get_path(PyCairoContext *c, PyObject *args)
-{
- py_path_callbacks callbacks;
-
- if(!PyArg_ParseTuple(args, "OOOO:Context.get_path",
- &callbacks.move_to, &callbacks.line_to,
- &callbacks.curve_to, &callbacks.close_path))
- return NULL;
-
- if(!PyCallable_Check(callbacks.move_to)) {
- PyErr_SetString(PyExc_TypeError, "move_to must be callable");
- return NULL;
- }
- if(!PyCallable_Check(callbacks.line_to)) {
- PyErr_SetString(PyExc_TypeError, "line_to must be callable");
- return NULL;
- }
- if(!PyCallable_Check(callbacks.curve_to)) {
- PyErr_SetString(PyExc_TypeError, "curve_to must be callable");
- return NULL;
- }
- if(!PyCallable_Check(callbacks.close_path)) {
- PyErr_SetString(PyExc_TypeError, "close_path must be callable");
- return NULL;
- }
-
- cairo_get_path(c->ctx, py_wrapper_move_to, py_wrapper_line_to,
- py_wrapper_curve_to, py_wrapper_close_path, &callbacks);
- if(PyErr_Occurred() || pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
-pycairo_get_path_flat(PyCairoContext *c, PyObject *args)
-{
- py_path_callbacks callbacks;
-
- if(!PyArg_ParseTuple(args, "OOO:Context.get_path_flat",
- &callbacks.move_to, &callbacks.line_to,
- &callbacks.close_path))
- return NULL;
-
- if(!PyCallable_Check(callbacks.move_to)) {
- PyErr_SetString(PyExc_TypeError, "move_to must be callable");
- return NULL;
- }
- if(!PyCallable_Check(callbacks.line_to)) {
- PyErr_SetString(PyExc_TypeError, "line_to must be callable");
- return NULL;
- }
- if(!PyCallable_Check(callbacks.close_path)) {
- PyErr_SetString(PyExc_TypeError, "close_path must be callable");
- return NULL;
- }
-
- cairo_get_path_flat(c->ctx, py_wrapper_move_to, py_wrapper_line_to,
- py_wrapper_close_path, &callbacks);
- if(PyErr_Occurred() || pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
static PyObject *
pycairo_get_rgb_color(PyCairoContext *c)
{
@@ -450,23 +318,6 @@
}
static PyObject *
-pycairo_get_target_surface(PyCairoContext *c)
-{
- PyObject *py_surface;
- /* This function is scheduled to be removed as part of the upcoming API
- Shakeup.*/
- cairo_surface_t *surface = cairo_get_target_surface(c->ctx);
- if (!surface)
- return PyErr_NoMemory();
-
- /* should be ImageSurface or PDFSurface etc */
- py_surface = PyCairoSurface_FromSurface(surface, NULL);
- if (py_surface)
- cairo_surface_reference(surface);
- return py_surface;
-}
-
-static PyObject *
pycairo_get_tolerance(PyCairoContext *c)
{
return PyFloat_FromDouble(cairo_get_tolerance(c->ctx));
@@ -576,6 +427,20 @@
}
static PyObject *
+pycairo_paint_with_alpha(PyCairoContext *c, PyObject *args)
+{
+ double alpha;
+
+ if (!PyArg_ParseTuple(args, "d:Context.paint_with_alpha", &alpha))
+ return NULL;
+
+ cairo_paint_with_alpha(c->ctx, alpha);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_reset_clip(PyCairoContext *c)
{
cairo_reset_clip(c->ctx);
@@ -823,49 +688,6 @@
Py_RETURN_NONE;
}
-#if 0
-#ifdef CAIRO_HAS_PDF_SURFACE
-static PyObject *
-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_pdf",
- &PyFile_Type, &file_object,
- &width_inches, &height_inches,
- &x_pixels_per_inch, &y_pixels_per_inch))
- return NULL;
-
- 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_PDF_SURFACE */
-#endif
-
-static PyObject *
-pycairo_set_target_surface(PyCairoContext *c, PyObject *args)
-{
- PyCairoSurface *surface;
-
- if (!PyArg_ParseTuple(args, "O!:Context.set_target_surface",
- &PyCairoSurface_Type, &surface))
- return NULL;
-
- cairo_set_target_surface(c->ctx, surface->surface);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
static PyObject *
pycairo_set_tolerance(PyCairoContext *c, PyObject *args)
{
@@ -1195,7 +1017,6 @@
{ "clip", (PyCFunction)pycairo_clip, METH_NOARGS },
{ "clip_preserve", (PyCFunction)pycairo_clip_preserve, METH_NOARGS },
{ "close_path", (PyCFunction)pycairo_close_path, METH_NOARGS },
- { "copy", (PyCFunction)pycairo_copy, METH_VARARGS },
{ "copy_page", (PyCFunction)pycairo_copy_page, METH_NOARGS },
/* copy_path_data */
/* copy_path_data_flat */
@@ -1205,8 +1026,6 @@
(PyCFunction)pycairo_device_to_user_distance, METH_VARARGS },
{ "fill", (PyCFunction)pycairo_fill, METH_NOARGS },
{ "fill_preserve", (PyCFunction)pycairo_fill_preserve, METH_NOARGS },
- { "get_path", (PyCFunction)pycairo_get_path, METH_VARARGS },
- { "get_path_flat", (PyCFunction)pycairo_get_path_flat, METH_VARARGS },
/* glyph_extents */
/* glyph_path */
{ "identity_matrix",(PyCFunction)pycairo_identity_matrix,METH_NOARGS },
@@ -1218,6 +1037,8 @@
{ "move_to", (PyCFunction)pycairo_move_to, METH_VARARGS },
{ "new_path", (PyCFunction)pycairo_new_path, METH_NOARGS },
{ "paint", (PyCFunction)pycairo_paint, METH_NOARGS },
+ { "paint_with_alpha",(PyCFunction)pycairo_paint_with_alpha,
+ METH_VARARGS },
{ "rectangle", (PyCFunction)pycairo_rectangle, METH_VARARGS },
{ "rel_curve_to", (PyCFunction)pycairo_rel_curve_to, METH_VARARGS },
{ "rel_line_to", (PyCFunction)pycairo_rel_line_to, METH_VARARGS },
@@ -1245,13 +1066,6 @@
{ "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
- { "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 },
@@ -1284,7 +1098,6 @@
{ "rgb_color", (getter)pycairo_get_rgb_color, (setter)0 },
{ "source", (getter)pycairo_get_source, (setter)0 },
{ "stroke_extents", (getter)pycairo_stroke_extents, (setter)0 },
- { "target_surface", (getter)pycairo_get_target_surface,(setter)0 },
{ "tolerance", (getter)pycairo_get_tolerance, (setter)0 },
{ NULL, (getter)0, (setter)0 }
};
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- pycairo-surface.c 6 May 2005 13:46:13 -0000 1.32
+++ pycairo-surface.c 7 May 2005 04:28:06 -0000 1.33
@@ -135,24 +135,6 @@
}
static PyObject *
-surface_get_filter(PyCairoSurface *s)
-{
- return PyInt_FromLong(cairo_surface_get_filter(s->surface));
-}
-
-static PyObject *
-surface_get_matrix(PyCairoSurface *s)
-{
- cairo_matrix_t matrix;
- cairo_status_t status;
-
- status = cairo_surface_get_matrix(s->surface, &matrix);
- if (pycairo_check_status(status))
- return NULL;
- return PyCairoMatrix_FromMatrix(&matrix);
-}
-
-static PyObject *
surface_set_device_offset(PyCairoSurface *s, PyObject *args)
{
double x_offset, y_offset;
@@ -165,49 +147,6 @@
Py_RETURN_NONE;
}
-static PyObject *
-surface_set_filter(PyCairoSurface *s, PyObject *args)
-{
- cairo_filter_t filter;
- cairo_status_t status;
-
- if (!PyArg_ParseTuple(args, "i:Surface.set_filter", &filter))
- return NULL;
-
- status = cairo_surface_set_filter(s->surface, filter);
- if (pycairo_check_status(status))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
-surface_set_matrix(PyCairoSurface *s, PyObject *args)
-{
- PyCairoMatrix *matrix;
-
- if (!PyArg_ParseTuple(args, "O!:Surface.set_matrix",
- &PyCairoMatrix_Type, &matrix))
- return NULL;
-
- cairo_surface_set_matrix(s->surface, &matrix->matrix);
- Py_RETURN_NONE;
-}
-
-static PyObject *
-surface_set_repeat(PyCairoSurface *s, PyObject *args)
-{
- int repeat;
- cairo_status_t status;
-
- if (!PyArg_ParseTuple(args, "i:Surface.set_repeat", &repeat))
- return NULL;
-
- status = cairo_surface_set_repeat(s->surface, repeat);
- if (pycairo_check_status(status))
- return NULL;
- Py_RETURN_NONE;
-}
-
#ifdef CAIRO_HAS_PNG_FUNCTIONS
static PyObject *
surface_write_to_png(PyCairoSurface *s, PyObject *args)
@@ -231,9 +170,6 @@
{ "finish", (PyCFunction)surface_finish, METH_NOARGS },
{ "set_device_offset",(PyCFunction)surface_set_device_offset,
METH_VARARGS },
- { "set_filter", (PyCFunction)surface_set_filter, METH_VARARGS },
- { "set_matrix", (PyCFunction)surface_set_matrix, METH_VARARGS },
- { "set_repeat", (PyCFunction)surface_set_repeat, METH_VARARGS },
#ifdef CAIRO_HAS_PNG_FUNCTIONS
{ "write_to_png", (PyCFunction)surface_write_to_png, METH_VARARGS },
/* write_to_png_stream */
@@ -242,8 +178,6 @@
};
static PyGetSetDef surface_getsets[] = {
- { "filter", (getter)surface_get_filter, (setter)0 },
- { "matrix", (getter)surface_get_matrix, (setter)0 },
{ NULL, }
};
- Previous message: [cairo-commit] pycairo/examples context-subclass.py, 1.5,
1.6 gradient.py, 1.6, 1.7 hering.py, 1.6, 1.7 spiral.py, 1.4,
1.5 warpedtext.py, 1.9, 1.10
- Next message: [cairo-commit] cairo ChangeLog,1.553,1.554 configure.in,1.98,1.99
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list