[cairo-commit] pycairo/cairo pycairo-surface.c, 1.35,
1.36 pycairo-private.h, 1.21, 1.22 pycairo-pattern.c, 1.18,
1.19 pycairo.h, 1.28, 1.29 pycairo-context.c, 1.47,
1.48 cairomodule.c, 1.31, 1.32 cairogtkmodule.c, 1.19,
1.20 pycairo-path.c, 1.1, 1.2
Steve Chaplin
commit at pdx.freedesktop.org
Mon May 9 17:55:41 PDT 2005
- Previous message: [cairo-commit] pycairo ChangeLog, 1.106, 1.107 configure.ac, 1.20,
1.21
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
FontExtents.java, 1.3, 1.4 CurrentPath.java, 1.2,
NONE Context.java, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv27117/cairo
Modified Files:
pycairo-surface.c pycairo-private.h pycairo-pattern.c
pycairo.h pycairo-context.c cairomodule.c cairogtkmodule.c
pycairo-path.c
Log Message:
SC
Index: pycairo-surface.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-surface.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- pycairo-surface.c 9 May 2005 09:12:31 -0000 1.35
+++ pycairo-surface.c 10 May 2005 00:55:39 -0000 1.36
@@ -125,7 +125,7 @@
cairo_status_t status = cairo_surface_finish(s->surface);
Py_CLEAR(s->base);
- if (pycairo_check_status(status))
+ if (Pycairo_check_status(status))
return NULL;
Py_RETURN_NONE;
}
@@ -154,7 +154,7 @@
return NULL;
status = cairo_surface_write_to_png(s->surface, filename);
- if (pycairo_check_status(status))
+ if (Pycairo_check_status(status))
return NULL;
Py_RETURN_NONE;
}
Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- pycairo-private.h 9 May 2005 09:12:31 -0000 1.21
+++ pycairo-private.h 10 May 2005 00:55:39 -0000 1.22
@@ -50,13 +50,16 @@
extern PyTypeObject PycairoImageSurface_Type;
extern PyTypeObject PycairoPDFSurface_Type;
-int pycairo_check_status(cairo_status_t status);
-
PyObject *PycairoContext_FromContext(cairo_t *ctx, PyObject *base);
PyObject *PycairoFontFace_FromFontFace(cairo_font_face_t *font_face);
PyObject *PycairoMatrix_FromMatrix(const cairo_matrix_t *matrix);
PyObject *PycairoPath_FromPath(cairo_path_t *path);
PyObject *PycairoPattern_FromPattern(cairo_pattern_t *pattern);
+
PyObject *PycairoSurface_FromSurface(cairo_surface_t *surface, PyObject *base);
+PyObject *PycairoImageSurface_FromImageSurface(cairo_surface_t *surface, PyObject *base);
+PyObject *PycairoPDFSurface_FromPDFSurface(cairo_surface_t *surface, PyObject *base);
+
+int Pycairo_check_status(cairo_status_t status);
#endif /* _PYCAIRO_PRIVATE_H_ */
Index: pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- pycairo-pattern.c 9 May 2005 09:12:31 -0000 1.18
+++ pycairo-pattern.c 10 May 2005 00:55:39 -0000 1.19
@@ -148,7 +148,7 @@
status = cairo_pattern_add_color_stop_rgb (p->pattern, offset, red, green,
blue);
- if (pycairo_check_status(status))
+ if (Pycairo_check_status(status))
return NULL;
Py_RETURN_NONE;
}
@@ -165,7 +165,7 @@
status = cairo_pattern_add_color_stop_rgba (p->pattern, offset, red,
green, blue, alpha);
- if (pycairo_check_status(status))
+ if (Pycairo_check_status(status))
return NULL;
Py_RETURN_NONE;
}
@@ -233,6 +233,10 @@
static PyMethodDef pattern_methods[] = {
+ /* methods never exposed in a language binding:
+ * cairo_pattern_destroy()
+ * cairo_pattern_reference()
+ */
{ "add_color_stop_rgb",(PyCFunction)pattern_add_color_stop_rgb,
METH_VARARGS },
{ "add_color_stop_rgba",(PyCFunction)pattern_add_color_stop_rgba,
@@ -243,11 +247,9 @@
METH_VARARGS | METH_CLASS },
{ "create_radial", (PyCFunction)pattern_create_radial,
METH_VARARGS | METH_CLASS },
- /* cairo_pattern_destroy() - never exposed in a language binding */
{ "set_extend", (PyCFunction)pattern_set_extend, METH_VARARGS },
{ "set_filter", (PyCFunction)pattern_set_filter, METH_VARARGS },
{ "set_matrix", (PyCFunction)pattern_set_matrix, METH_VARARGS },
- /* cairo_pattern_reference() - never exposed in a language binding */
{ NULL, NULL, 0 }
};
Index: pycairo.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- pycairo.h 9 May 2005 09:12:31 -0000 1.28
+++ pycairo.h 10 May 2005 00:55:39 -0000 1.29
@@ -87,7 +87,10 @@
PyTypeObject *Matrix_Type;
PyTypeObject *Path_Type;
PyTypeObject *Pattern_Type;
+
PyTypeObject *Surface_Type;
+ PyTypeObject *ImageSurface_Type;
+ PyTypeObject *PDFSurface_Type;
/* constructors */
PyObject *(*Context_FromContext)(cairo_t *ctx, PyObject *base);
@@ -95,7 +98,10 @@
PyObject *(*Matrix_FromMatrix)(const cairo_matrix_t *matrix);
PyObject *(*Path_FromPath)(cairo_path_t *path);
PyObject *(*Pattern_FromPattern)(cairo_pattern_t *pattern);
+
PyObject *(*Surface_FromSurface)(cairo_surface_t *surface, PyObject *base);
+ PyObject *(*ImageSurface_FromImageSurface)(cairo_surface_t *surface, PyObject *base);
+ PyObject *(*PDFSurface_FromPDFSurface)(cairo_surface_t *surface, PyObject *base);
/* misc functions */
int (* check_status)(cairo_status_t status);
@@ -109,15 +115,21 @@
#define PycairoFontFace_Type *(Pycairo_CAPI->Fontface_Type)
#define PycairoMatrix_Type *(Pycairo_CAPI->Matrix_Type)
#define PycairoPattern_Type *(Pycairo_CAPI->Pattern_Type)
+
#define PycairoSurface_Type *(Pycairo_CAPI->Surface_Type)
+#define PycairoImageSurface_Type *(Pycairo_CAPI->ImageSurface_Type)
+#define PycairoPDFSurface_Type *(Pycairo_CAPI->PDFSurface_Type)
#define PycairoContext_FromContext (Pycairo_CAPI->Context_FromContext)
#define PycairoFontFace_FromFontFace (Pycairo_CAPI->Fontface_FromFontFace)
#define PycairoMatrix_FromMatrix (Pycairo_CAPI->Matrix_FromMatrix)
#define PycairoPattern_FromPattern (Pycairo_CAPI->Pattern_FromPattern)
+
#define PycairoSurface_FromSurface (Pycairo_CAPI->Surface_FromSurface)
+#define PycairoImageSurface_FromImageSurface (Pycairo_CAPI->ImageSurface_FromImageSurface)
+#define PycairoPDFSurface_FromPDFSurface (Pycairo_CAPI->PDFSurface_FromPDFSurface)
-#define pycairo_check_status (Pycairo_CAPI->check_status)
+#define Pycairo_check_status (Pycairo_CAPI->check_status)
/* Define global variable for the C API and a macro for setting it. */
static Pycairo_CAPI_t *Pycairo_CAPI;
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- pycairo-context.c 9 May 2005 09:12:31 -0000 1.47
+++ pycairo-context.c 10 May 2005 00:55:39 -0000 1.48
@@ -93,7 +93,7 @@
Py_DECREF(c);
return -1;
}
- if (pycairo_check_status(cairo_status(c->ctx))) {
+ if (Pycairo_check_status(cairo_status(c->ctx))) {
Py_DECREF(c);
return -1;
}
@@ -101,6 +101,22 @@
}
static PyObject *
+pycairo_append_path(PycairoContext *c, PyObject *args)
+{
+ PycairoPath *p;
+
+ if (!PyArg_ParseTuple(args, "O!:Context.append_path",
+ &PycairoPath_Type, &p))
+ return NULL;
+
+ cairo_append_path (c->ctx, p->path);
+
+ if (Pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_arc(PycairoContext *c, PyObject *args)
{
double xc, yc, radius, angle1, angle2;
@@ -110,7 +126,7 @@
return NULL;
cairo_arc(c->ctx, xc, yc, radius, angle1, angle2);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -125,7 +141,7 @@
return NULL;
cairo_arc_negative(c->ctx, xc, yc, radius, angle1, angle2);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -134,7 +150,7 @@
pycairo_clip(PycairoContext *c)
{
cairo_clip(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -143,7 +159,7 @@
pycairo_clip_preserve(PycairoContext *c)
{
cairo_clip_preserve(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -152,7 +168,7 @@
pycairo_close_path(PycairoContext *c)
{
cairo_close_path(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -161,7 +177,7 @@
pycairo_copy_page(PycairoContext *c)
{
cairo_copy_page(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -171,7 +187,21 @@
{
PyObject *p;
cairo_path_t *path = cairo_copy_path(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+
+ p = PycairoPath_FromPath(path);
+ if (!p)
+ cairo_path_destroy(path);
+ return p;
+}
+
+static PyObject *
+pycairo_copy_path_flat(PycairoContext *c)
+{
+ PyObject *p;
+ cairo_path_t *path = cairo_copy_path_flat(c->ctx);
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
p = PycairoPath_FromPath(path);
@@ -190,7 +220,7 @@
return NULL;
cairo_curve_to(c->ctx, x1, y1, x2, y2, x3, y3);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -204,7 +234,7 @@
return NULL;
cairo_device_to_user(c->ctx, &x, &y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dd)", x, y);
}
@@ -219,7 +249,7 @@
return NULL;
cairo_device_to_user_distance(c->ctx, &dx, &dy);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dd)", dx, dy);
}
@@ -228,7 +258,7 @@
pycairo_fill(PycairoContext *c)
{
cairo_fill(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -237,7 +267,7 @@
pycairo_fill_preserve(PycairoContext *c)
{
cairo_fill_preserve(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -247,7 +277,7 @@
{
double x1, y1, x2, y2;
cairo_fill_extents(c->ctx, &x1, &y1, &x2, &y2);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dddd)", x1, y1, x2, y2);
}
@@ -258,7 +288,7 @@
cairo_font_extents_t extents;
cairo_font_extents(c->ctx, &extents);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(ddddd)", extents.ascent, extents.descent,
extents.height, extents.max_x_advance,
@@ -288,7 +318,7 @@
font_face = cairo_get_font_face(c->ctx);
if (!font_face){
- pycairo_check_status(cairo_status(c->ctx));
+ Pycairo_check_status(cairo_status(c->ctx));
return NULL;
}
f = PycairoFontFace_FromFontFace(font_face);
@@ -365,7 +395,7 @@
PyObject *s;
cairo_surface_t *surface = cairo_get_target(c->ctx);
if (!surface) {
- pycairo_check_status(cairo_status(c->ctx));
+ Pycairo_check_status(cairo_status(c->ctx));
return NULL;
}
@@ -385,7 +415,7 @@
pycairo_identity_matrix(PycairoContext *c)
{
cairo_identity_matrix(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -400,7 +430,7 @@
return NULL;
result = cairo_in_fill(c->ctx, x, y) ? Py_True : Py_False;
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_INCREF(result);
return result;
@@ -416,7 +446,7 @@
return NULL;
result = cairo_in_stroke(c->ctx, x, y) ? Py_True : Py_False;
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_INCREF(result);
return result;
@@ -431,7 +461,7 @@
return NULL;
cairo_line_to(c->ctx, x, y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -445,7 +475,7 @@
return NULL;
cairo_mask(c->ctx, p->pattern);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -461,7 +491,7 @@
return NULL;
cairo_mask_surface(c->ctx, s->surface, surface_x, surface_y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -475,7 +505,7 @@
return NULL;
cairo_move_to(c->ctx, x, y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -484,7 +514,7 @@
pycairo_new_path(PycairoContext *c)
{
cairo_new_path(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -493,7 +523,7 @@
pycairo_paint(PycairoContext *c)
{
cairo_paint(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -507,7 +537,7 @@
return NULL;
cairo_paint_with_alpha(c->ctx, alpha);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -522,7 +552,7 @@
return NULL;
cairo_rectangle(c->ctx, x, y, width, height);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -537,7 +567,7 @@
return NULL;
cairo_rel_curve_to(c->ctx, dx1, dy1, dx2, dy2, dx3, dy3);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -551,7 +581,7 @@
return NULL;
cairo_rel_line_to(c->ctx, dx, dy);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -565,7 +595,7 @@
return NULL;
cairo_rel_move_to(c->ctx, dx, dy);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -574,7 +604,7 @@
pycairo_reset_clip(PycairoContext *c)
{
cairo_reset_clip(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -583,7 +613,7 @@
pycairo_restore(PycairoContext *c)
{
cairo_restore(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -597,7 +627,7 @@
return NULL;
cairo_rotate(c->ctx, angle);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -606,7 +636,7 @@
pycairo_save(PycairoContext *c)
{
cairo_save(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -620,7 +650,7 @@
return NULL;
cairo_scale(c->ctx, sx, sy);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -637,7 +667,7 @@
return NULL;
cairo_select_font_face(c->ctx, family, slant, weight);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -670,7 +700,7 @@
cairo_set_dash(c->ctx, dashes, ndash, offset);
free(dashes);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -684,7 +714,7 @@
return NULL;
cairo_set_fill_rule(c->ctx, fill_rule);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -699,7 +729,7 @@
return NULL;
cairo_set_font_matrix(c->ctx, &matrix->matrix);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -713,7 +743,7 @@
return NULL;
cairo_set_font_size(c->ctx, size);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -729,7 +759,7 @@
return NULL;
cairo_set_font_face(c->ctx, ff->font_face);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -743,7 +773,7 @@
return NULL;
cairo_set_line_cap(c->ctx, line_cap);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -757,7 +787,7 @@
return NULL;
cairo_set_line_join(c->ctx, line_join);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -771,7 +801,7 @@
return NULL;
cairo_set_line_width(c->ctx, width);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -786,7 +816,7 @@
return NULL;
cairo_set_matrix(c->ctx, &matrix->matrix);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -800,7 +830,7 @@
return NULL;
cairo_set_miter_limit(c->ctx, limit);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -814,7 +844,7 @@
return NULL;
cairo_set_operator(c->ctx, op);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -829,7 +859,7 @@
return NULL;
cairo_set_source(c->ctx, p->pattern);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -844,7 +874,7 @@
return NULL;
cairo_set_source_rgb(c->ctx, red, green, blue);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -859,7 +889,7 @@
return NULL;
cairo_set_source_rgba(c->ctx, red, green, blue, alpha);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -875,7 +905,7 @@
return NULL;
cairo_set_source_surface(c->ctx, surface->surface, x, y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -889,7 +919,7 @@
return NULL;
cairo_set_tolerance(c->ctx, tolerance);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -898,7 +928,7 @@
pycairo_show_page(PycairoContext *c)
{
cairo_show_page(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -912,7 +942,7 @@
return NULL;
cairo_show_text(c->ctx, utf8);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -921,7 +951,7 @@
pycairo_stroke(PycairoContext *c)
{
cairo_stroke(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -931,7 +961,7 @@
{
double x1, y1, x2, y2;
cairo_stroke_extents(c->ctx, &x1, &y1, &x2, &y2);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dddd)", x1, y1, x2, y2);
}
@@ -940,7 +970,7 @@
pycairo_stroke_preserve(PycairoContext *c)
{
cairo_stroke_preserve(c->ctx);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -955,7 +985,7 @@
return NULL;
cairo_text_extents(c->ctx, utf8, &extents);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dddddd)", extents.x_bearing, extents.y_bearing,
extents.width, extents.height, extents.x_advance,
@@ -971,7 +1001,7 @@
return NULL;
cairo_text_path(c->ctx, utf8);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -985,7 +1015,7 @@
return NULL;
cairo_translate(c->ctx, tx, ty);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -1000,7 +1030,7 @@
return NULL;
cairo_transform(c->ctx, &matrix->matrix);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
@@ -1014,7 +1044,7 @@
return NULL;
cairo_user_to_device(c->ctx, &x, &y);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dd)", x, y);
}
@@ -1029,7 +1059,7 @@
return NULL;
cairo_user_to_device_distance(c->ctx, &dx, &dy);
- if (pycairo_check_status(cairo_status(c->ctx)))
+ if (Pycairo_check_status(cairo_status(c->ctx)))
return NULL;
return Py_BuildValue("(dd)", dx, dy);
}
@@ -1040,6 +1070,7 @@
* cairo_destroy()
* cairo_reference()
*/
+ { "append_path", (PyCFunction)pycairo_append_path, METH_VARARGS },
{ "arc", (PyCFunction)pycairo_arc, METH_VARARGS },
{ "arc_negative", (PyCFunction)pycairo_arc_negative, METH_VARARGS },
{ "clip", (PyCFunction)pycairo_clip, METH_NOARGS },
@@ -1047,6 +1078,7 @@
{ "close_path", (PyCFunction)pycairo_close_path, METH_NOARGS },
{ "copy_page", (PyCFunction)pycairo_copy_page, METH_NOARGS },
{ "copy_path", (PyCFunction)pycairo_copy_path, METH_NOARGS },
+ { "copy_path_flat",(PyCFunction)pycairo_copy_path_flat,METH_NOARGS },
{ "curve_to", (PyCFunction)pycairo_curve_to, METH_VARARGS },
{ "device_to_user",(PyCFunction)pycairo_device_to_user,METH_VARARGS },
{ "device_to_user_distance",
Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- cairomodule.c 9 May 2005 09:12:31 -0000 1.31
+++ cairomodule.c 10 May 2005 00:55:39 -0000 1.32
@@ -34,7 +34,7 @@
#include "pycairo-private.h"
int
-pycairo_check_status(cairo_status_t status)
+Pycairo_check_status(cairo_status_t status)
{
/* copy strings from cairo.c cairo_status_string() */
switch (status) {
@@ -104,16 +104,22 @@
&PycairoMatrix_Type,
&PycairoPath_Type,
&PycairoPattern_Type,
+
&PycairoSurface_Type,
+ &PycairoImageSurface_Type,
+ &PycairoPDFSurface_Type,
PycairoContext_FromContext,
PycairoFontFace_FromFontFace,
PycairoMatrix_FromMatrix,
PycairoPath_FromPath,
PycairoPattern_FromPattern,
+
PycairoSurface_FromSurface,
+ PycairoImageSurface_FromImageSurface,
+ PycairoPDFSurface_FromPDFSurface,
- pycairo_check_status,
+ Pycairo_check_status,
};
DL_EXPORT(void)
@@ -128,7 +134,7 @@
if (PyType_Ready(&PycairoMatrix_Type) < 0)
return;
if (PyType_Ready(&PycairoPath_Type) < 0)
- return;
+ return;
if (PyType_Ready(&PycairoPattern_Type) < 0)
return;
@@ -148,7 +154,9 @@
Py_INCREF(&PycairoMatrix_Type);
PyModule_AddObject(m, "Matrix", (PyObject *)&PycairoMatrix_Type);
Py_INCREF(&PycairoPath_Type);
- PyModule_AddObject(m, "Path", (PyObject *)&PycairoPath_Type);
+ /* Don't add Path object since it is not accessed directly as 'cairo.Path'
+ * PyModule_AddObject(m, "Path", (PyObject *)&PycairoPath_Type);
+ */
Py_INCREF(&PycairoPattern_Type);
PyModule_AddObject(m, "Pattern", (PyObject *)&PycairoPattern_Type);
Index: cairogtkmodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairogtkmodule.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cairogtkmodule.c 9 May 2005 09:12:31 -0000 1.19
+++ cairogtkmodule.c 10 May 2005 00:55:39 -0000 1.20
@@ -76,7 +76,8 @@
if (!surface)
return PyErr_NoMemory();
- py_surface = PycairoSurface_FromSurface(surface, (PyObject *)py_pixbuf);
+ py_surface = PycairoImageSurface_FromImageSurface(surface,
+ (PyObject *)py_pixbuf);
if (!py_surface)
cairo_surface_destroy(surface);
return py_surface;
Index: pycairo-path.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-path.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pycairo-path.c 9 May 2005 09:12:31 -0000 1.1
+++ pycairo-path.c 10 May 2005 00:55:39 -0000 1.2
@@ -84,6 +84,88 @@
return -1;
}
+static PyObject *
+path_str(PycairoPath *p)
+{
+ PyObject *s, *pieces = NULL, *result = NULL;
+ int i;
+ int ret;
+ cairo_path_t *path;
+ cairo_path_data_t *data;
+ char buf[80];
+
+ pieces = PyList_New(0);
+ if (pieces == NULL)
+ goto Done;
+
+ /* loop reading elements */
+ path = p->path;
+
+ for (i=0; i < path->num_data; i += path->data[i].header.length) {
+ data = &path->data[i];
+ switch (data->header.type) {
+
+ case CAIRO_PATH_MOVE_TO:
+ PyOS_snprintf(buf, sizeof(buf), "move_to %f %f",
+ data[1].point.x, data[1].point.y);
+ s = PyString_FromString(buf);
+ if (!s)
+ goto Done;
+ ret = PyList_Append(pieces, s);
+ Py_DECREF(s);
+ if (ret < 0)
+ goto Done;
+ break;
+
+ case CAIRO_PATH_LINE_TO:
+ PyOS_snprintf(buf, sizeof(buf), "line_to %f %f",
+ data[1].point.x, data[1].point.y);
+ s = PyString_FromString(buf);
+ if (!s)
+ goto Done;
+ ret = PyList_Append(pieces, s);
+ Py_DECREF(s);
+ if (ret < 0)
+ goto Done;
+ break;
+
+ case CAIRO_PATH_CURVE_TO:
+ PyOS_snprintf(buf, sizeof(buf), "curve_to %f %f %f %f %f %f",
+ data[1].point.x, data[1].point.y,
+ data[2].point.x, data[2].point.y,
+ data[3].point.x, data[3].point.y);
+ s = PyString_FromString(buf);
+ if (!s)
+ goto Done;
+ ret = PyList_Append(pieces, s);
+ Py_DECREF(s);
+ if (ret < 0)
+ goto Done;
+ break;
+
+ case CAIRO_PATH_CLOSE_PATH:
+ s = PyString_FromString("close path");
+ if (!s)
+ goto Done;
+ ret = PyList_Append(pieces, s);
+ Py_DECREF(s);
+ if (ret < 0)
+ goto Done;
+ break;
+ }
+ }
+ /* result = "\n".join(pieces) */
+ s = PyString_FromString("\n");
+ if (s == NULL)
+ goto Done;
+ result = _PyString_Join(s, pieces);
+ Py_DECREF(s);
+
+Done:
+ Py_XDECREF(pieces);
+ return result;
+}
+
static PyObject * path_iter(PyObject *seq); /* forward declaration */
@@ -104,7 +186,7 @@
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
- 0, /* tp_str */
+ (reprfunc)path_str, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
- Previous message: [cairo-commit] pycairo ChangeLog, 1.106, 1.107 configure.ac, 1.20,
1.21
- Next message: [cairo-commit] cairo-java/src/java/org/freedesktop/cairo
FontExtents.java, 1.3, 1.4 CurrentPath.java, 1.2,
NONE Context.java, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list