[cairo-commit] pycairo/cairo pycairo-context.c,1.9,1.10

Steve Chaplin commit at pdx.freedesktop.org
Mon Nov 15 05:14:12 PST 2004


Committed by: stevech1097

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

Modified Files:
	pycairo-context.c 
Log Message:
SC 15/11/2004

Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pycairo-context.c	15 Nov 2004 10:06:34 -0000	1.9
+++ pycairo-context.c	15 Nov 2004 13:14:10 -0000	1.10
@@ -211,10 +211,6 @@
 pycairo_stroke_extents(PyCairoContext *self, PyObject *args)
 {
     double x1, y1, x2, y2;
-    if (!PyArg_ParseTuple(args, "dddd:Context.stroke_extents", 
-			  &x1, &y1, &x2, &y2))
-	return NULL;
-
     cairo_stroke_extents(self->ctx, &x1, &y1, &x2, &y2);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
@@ -222,12 +218,9 @@
 }
 
 static PyObject *
-pycairo_fill_extents(PyCairoContext *self, PyObject *args)
+pycairo_fill_extents(PyCairoContext *self)
 {
     double x1, y1, x2, y2;
-    if (!PyArg_ParseTuple(args, "dddd:Context.fill_extents", 
-			  &x1, &y1, &x2, &y2))
-
     cairo_fill_extents(self->ctx, &x1, &y1, &x2, &y2);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
@@ -855,15 +848,10 @@
     cairo_show_text(self->ctx, utf8);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
-    if (pycairo_check_status(cairo_status(self->ctx)))
-	return NULL;
     Py_INCREF(Py_None);
     return Py_None;
 }
 
-/* XXXX - show_glyphs */
-/* XXXX - current_font_extents */
-
 static PyObject *
 pycairo_set_font(PyCairoContext *self, PyObject *args)
 {
@@ -896,6 +884,17 @@
 }
 
 static PyObject *
+pycairo_current_font_extents(PyCairoContext *self)
+{
+    cairo_font_extents_t extents;
+
+    cairo_current_font_extents(self->ctx, &extents);
+    if (pycairo_check_status(cairo_status(self->ctx)))
+	return NULL;
+    return Py_BuildValue("(ddddd)", extents.ascent, extents.descent, extents.height, extents.max_x_advance, extents.max_y_advance);
+}
+
+static PyObject *
 pycairo_show_surface(PyCairoContext *self, PyObject *args)
 {
     PyCairoSurface *surface;
@@ -1154,95 +1153,95 @@
 }
 
 static PyMethodDef pycairo_methods[] = {
+    { "arc", (PyCFunction)pycairo_arc, METH_VARARGS },
+    { "arc_negative", (PyCFunction)pycairo_arc_negative, METH_VARARGS },
+    { "clip", (PyCFunction)pycairo_clip, METH_NOARGS },
+    { "close_path", (PyCFunction)pycairo_close_path, METH_NOARGS },
+    { "concat_matrix", (PyCFunction)pycairo_concat_matrix, METH_VARARGS },
     { "copy", (PyCFunction)pycairo_copy, METH_VARARGS },
-    { "save", (PyCFunction)pycairo_save, METH_NOARGS },
-    { "restore", (PyCFunction)pycairo_restore, METH_NOARGS },
-    { "set_target_surface", (PyCFunction)pycairo_set_target_surface,
+    { "copy_page", (PyCFunction)pycairo_copy_page, METH_NOARGS },
+    { "current_path", (PyCFunction)pycairo_current_path, METH_VARARGS },
+    { "current_path_flat", (PyCFunction)pycairo_current_path_flat, METH_VARARGS },
+    { "curve_to", (PyCFunction)pycairo_curve_to, METH_VARARGS },
+    { "default_matrix", (PyCFunction)pycairo_default_matrix, METH_NOARGS },
+    { "fill", (PyCFunction)pycairo_fill, METH_NOARGS },
+    /* TODO: { "glyph_extents", (PyCFunction)pycairo_glyph_extents, METH_NOARGS }, */
+    /* TODO: { "glyph_path", (PyCFunction)pycairo_glyph_path, METH_VARARGS }, */
+    { "identity_matrix", (PyCFunction)pycairo_identity_matrix, METH_NOARGS },
+    { "in_fill", (PyCFunction)pycairo_in_fill, METH_VARARGS },
+    { "in_stroke", (PyCFunction)pycairo_in_stroke, METH_VARARGS },
+    { "init_clip", (PyCFunction)pycairo_init_clip, METH_NOARGS },
+    { "inverse_transform_distance",
+      (PyCFunction)pycairo_inverse_transform_distance, METH_VARARGS },
+    { "inverse_transform_point", (PyCFunction)pycairo_inverse_transform_point,
       METH_VARARGS },
+    { "line_to", (PyCFunction)pycairo_line_to, METH_VARARGS },
+    { "move_to", (PyCFunction)pycairo_move_to, METH_VARARGS },
+    { "new_path", (PyCFunction)pycairo_new_path, METH_NOARGS },
+    { "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 },
+    { "rel_move_to", (PyCFunction)pycairo_rel_move_to, METH_VARARGS },
+    { "restore", (PyCFunction)pycairo_restore, METH_NOARGS },
+    { "rotate", (PyCFunction)pycairo_rotate, METH_VARARGS },
+    { "save", (PyCFunction)pycairo_save, METH_NOARGS },
+    { "scale", (PyCFunction)pycairo_scale, METH_VARARGS },
+    { "scale_font", (PyCFunction)pycairo_scale_font, METH_VARARGS },
+    { "select_font", (PyCFunction)pycairo_select_font, METH_VARARGS },
+    { "set_alpha", (PyCFunction)pycairo_set_alpha, METH_VARARGS },
+    { "set_dash", (PyCFunction)pycairo_set_dash, METH_VARARGS },
+    { "set_fill_rule", (PyCFunction)pycairo_set_fill_rule, METH_VARARGS },
+    { "set_font", (PyCFunction)pycairo_set_font, METH_VARARGS },
+    { "set_line_cap", (PyCFunction)pycairo_set_line_cap, METH_VARARGS },
+    { "set_line_join", (PyCFunction)pycairo_set_line_join, METH_VARARGS },
+    { "set_line_width", (PyCFunction)pycairo_set_line_width, METH_VARARGS },
+    { "set_matrix", (PyCFunction)pycairo_set_matrix, METH_VARARGS },
+    { "set_miter_limit", (PyCFunction)pycairo_set_miter_limit, METH_VARARGS },
+    { "set_operator", (PyCFunction)pycairo_set_operator, METH_VARARGS },
+    { "set_pattern", (PyCFunction)pycairo_set_pattern, METH_VARARGS },
+    { "set_rgb_color", (PyCFunction)pycairo_set_rgb_color, METH_VARARGS },
 #ifdef CAIRO_HAS_PS_SURFACE
     { "set_target_ps", (PyCFunction)pycairo_set_target_ps, METH_VARARGS},
 #endif
 #ifdef CAIRO_HAS_PNG_SURFACE
     { "set_target_png", (PyCFunction)pycairo_set_target_png, METH_VARARGS },
 #endif
-    { "set_operator", (PyCFunction)pycairo_set_operator, METH_VARARGS },
-    { "set_rgb_color", (PyCFunction)pycairo_set_rgb_color, METH_VARARGS },
-    { "set_alpha", (PyCFunction)pycairo_set_alpha, METH_VARARGS },
-    { "set_pattern", (PyCFunction)pycairo_set_pattern, METH_VARARGS },
-    { "set_tolerance", (PyCFunction)pycairo_set_tolerance, METH_VARARGS },
-    { "set_fill_rule", (PyCFunction)pycairo_set_fill_rule, METH_VARARGS },
-    { "set_line_width", (PyCFunction)pycairo_set_line_width, METH_VARARGS },
-    { "set_line_cap", (PyCFunction)pycairo_set_line_cap, METH_VARARGS },
-    { "set_line_join", (PyCFunction)pycairo_set_line_join, METH_VARARGS },
-    { "set_dash", (PyCFunction)pycairo_set_dash, METH_VARARGS },
-    { "set_miter_limit", (PyCFunction)pycairo_set_miter_limit, METH_VARARGS },
-    { "translate", (PyCFunction)pycairo_translate, METH_VARARGS },
-    { "scale", (PyCFunction)pycairo_scale, METH_VARARGS },
-    { "rotate", (PyCFunction)pycairo_rotate, METH_VARARGS },
-    { "concat_matrix", (PyCFunction)pycairo_concat_matrix, METH_VARARGS },
-    { "set_matrix", (PyCFunction)pycairo_set_matrix, METH_VARARGS },
-    { "default_matrix", (PyCFunction)pycairo_default_matrix, METH_NOARGS },
-    { "identity_matrix", (PyCFunction)pycairo_identity_matrix, METH_NOARGS },
-    { "transform_point", (PyCFunction)pycairo_transform_point, METH_VARARGS },
-    { "transform_distance", (PyCFunction)pycairo_transform_distance,
-      METH_VARARGS },
-    { "inverse_transform_point", (PyCFunction)pycairo_inverse_transform_point,
+    { "set_target_surface", (PyCFunction)pycairo_set_target_surface,
       METH_VARARGS },
-    { "inverse_transform_distance",
-      (PyCFunction)pycairo_inverse_transform_distance, METH_VARARGS },
-    { "new_path", (PyCFunction)pycairo_new_path, METH_NOARGS },
-    { "move_to", (PyCFunction)pycairo_move_to, METH_VARARGS },
-    { "line_to", (PyCFunction)pycairo_line_to, METH_VARARGS },
-    { "curve_to", (PyCFunction)pycairo_curve_to, METH_VARARGS },
-    { "arc", (PyCFunction)pycairo_arc, METH_VARARGS },
-    { "arc_negative", (PyCFunction)pycairo_arc_negative, METH_VARARGS },
-    { "rel_move_to", (PyCFunction)pycairo_rel_move_to, METH_VARARGS },
-    { "rel_line_to", (PyCFunction)pycairo_rel_line_to, METH_VARARGS },
-    { "rel_curve_to", (PyCFunction)pycairo_rel_curve_to, METH_VARARGS },
-    { "rectangle", (PyCFunction)pycairo_rectangle, METH_VARARGS },
-    { "close_path", (PyCFunction)pycairo_close_path, METH_NOARGS },
-    { "stroke", (PyCFunction)pycairo_stroke, METH_NOARGS },
-    { "fill", (PyCFunction)pycairo_fill, METH_NOARGS },
-    { "copy_page", (PyCFunction)pycairo_copy_page, METH_NOARGS },
+    { "set_tolerance", (PyCFunction)pycairo_set_tolerance, METH_VARARGS },
+    /* TODO: { "show_glyphs", (PyCFunction)pycairo_show_glyphs, METH_NOARGS }, */
     { "show_page", (PyCFunction)pycairo_show_page, METH_NOARGS },
-    { "in_stroke", (PyCFunction)pycairo_in_stroke, METH_VARARGS },
-    { "in_fill", (PyCFunction)pycairo_in_fill, METH_VARARGS },
-    { "stroke_extents", (PyCFunction)pycairo_stroke_extents, METH_VARARGS },
-    { "fill_extents", (PyCFunction)pycairo_fill_extents, METH_VARARGS },
-    { "init_clip", (PyCFunction)pycairo_init_clip, METH_NOARGS },
-    { "clip", (PyCFunction)pycairo_clip, METH_NOARGS },
-    { "select_font", (PyCFunction)pycairo_select_font, METH_VARARGS },
-    { "scale_font", (PyCFunction)pycairo_scale_font, METH_VARARGS },
-    { "transform_font", (PyCFunction)pycairo_transform_font, METH_VARARGS },
+    { "show_surface", (PyCFunction)pycairo_show_surface, METH_VARARGS },
     { "show_text", (PyCFunction)pycairo_show_text, METH_VARARGS },
-    /* TODO: { "show_glyphs", (PyCFunction)pycairo_show_glyphs, METH_NOARGS }, */
-    /* TODO: { "current_font_extents", (PyCFunction)pycairo_current_font_extents, METH_NOARGS }, */
-    { "set_font", (PyCFunction)pycairo_set_font, METH_VARARGS },
+    { "stroke", (PyCFunction)pycairo_stroke, METH_NOARGS },
     { "text_extents", (PyCFunction)pycairo_text_extents, METH_VARARGS },
-    { "show_surface", (PyCFunction)pycairo_show_surface, METH_VARARGS },
-    /* TODO: { "glyph_extents", (PyCFunction)pycairo_glyph_extents, METH_NOARGS }, */
     { "text_path", (PyCFunction)pycairo_text_path, METH_VARARGS },
-    /* TODO: { "glyph_path", (PyCFunction)pycairo_glyph_path, METH_VARARGS }, */
-    { "current_path", (PyCFunction)pycairo_current_path, METH_VARARGS },
-    { "current_path_flat", (PyCFunction)pycairo_current_path_flat, METH_VARARGS },
+    { "transform_font", (PyCFunction)pycairo_transform_font, METH_VARARGS },
+    { "transform_point", (PyCFunction)pycairo_transform_point, METH_VARARGS },
+    { "transform_distance", (PyCFunction)pycairo_transform_distance,
+      METH_VARARGS },
+    { "translate", (PyCFunction)pycairo_translate, METH_VARARGS },
     { NULL, NULL, 0 }
 };
 
 static PyGetSetDef pycairo_getsets[] = {
-    { "font", (getter)pycairo_current_font, (setter)0 },
-    { "operator", (getter)pycairo_current_operator, (setter)0 },
-    { "rgb_color", (getter)pycairo_current_rgb_color, (setter)0 },
-    { "alpha", (getter)pycairo_current_alpha, (setter)0 },
-    { "tolerance", (getter)pycairo_current_tolerance, (setter)0 },
-    { "point", (getter)pycairo_current_point, (setter)0 },
-    { "fill_rule", (getter)pycairo_current_fill_rule, (setter)0 },
-    { "line_width", (getter)pycairo_current_line_width, (setter)0 },
-    { "line_cap", (getter)pycairo_current_line_cap, (setter)0 },
-    { "line_join", (getter)pycairo_current_line_join, (setter)0 },
-    { "miter_limit", (getter)pycairo_current_miter_limit, (setter)0 },
-    { "matrix", (getter)pycairo_current_matrix, (setter)0 },
+    { "alpha",        (getter)pycairo_current_alpha, (setter)0 },
+    { "fill_extents", (getter)pycairo_fill_extents, (setter)0 },
+    { "fill_rule",    (getter)pycairo_current_fill_rule, (setter)0 },
+    { "font",         (getter)pycairo_current_font, (setter)0 },
+    { "font_extents", (getter)pycairo_current_font_extents, (setter)0 },
+    { "line_cap",     (getter)pycairo_current_line_cap, (setter)0 },
+    { "line_join",    (getter)pycairo_current_line_join, (setter)0 },
+    { "line_width",   (getter)pycairo_current_line_width, (setter)0 },
+    { "matrix",       (getter)pycairo_current_matrix, (setter)0 },
+    { "miter_limit",  (getter)pycairo_current_miter_limit, (setter)0 },
+    { "operator",     (getter)pycairo_current_operator, (setter)0 },
+    { "pattern",      (getter)pycairo_current_pattern, (setter)0 },
+    { "point",        (getter)pycairo_current_point, (setter)0 },
+    { "rgb_color",    (getter)pycairo_current_rgb_color, (setter)0 },
+    { "stroke_extents", (getter)pycairo_stroke_extents, (setter)0 },
     { "target_surface", (getter)pycairo_current_target_surface, (setter)0 },
-    { "pattern", (getter)pycairo_current_pattern, (setter)0 },
+    { "tolerance",    (getter)pycairo_current_tolerance, (setter)0 },
     { NULL, (getter)0, (setter)0 }
 };
 




More information about the cairo-commit mailing list