[cairo-commit] pycairo/cairo pycairo-context.c,1.40,1.41
Steve Chaplin
commit at pdx.freedesktop.org
Thu Apr 28 15:28:42 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv12218/cairo
Modified Files:
pycairo-context.c
Log Message:
SC
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- pycairo-context.c 28 Apr 2005 01:46:36 -0000 1.40
+++ pycairo-context.c 28 Apr 2005 22:28:36 -0000 1.41
@@ -182,6 +182,19 @@
}
static PyObject *
+pycairo_font_extents(PyCairoContext *c)
+{
+ cairo_font_extents_t extents;
+
+ cairo_font_extents(c->ctx, &extents);
+ if (pycairo_check_status(cairo_status(c->ctx)))
+ return NULL;
+ return Py_BuildValue("(ddddd)", extents.ascent, extents.descent,
+ extents.height, extents.max_x_advance,
+ extents.max_y_advance);
+}
+
+static PyObject *
pycairo_get_current_point(PyCairoContext *c)
{
double x, y;
@@ -1091,26 +1104,12 @@
static PyObject *
pycairo_set_font_size(PyCairoContext *c, PyObject *args)
{
- double scale;
-
- if (!PyArg_ParseTuple(args, "d:Context.set_font_size", &scale))
- return NULL;
-
- cairo_set_font_size(c->ctx, scale);
- if (pycairo_check_status(cairo_status(c->ctx)))
- return NULL;
- Py_RETURN_NONE;
-}
-
-static PyObject *
-pycairo_show_text(PyCairoContext *c, PyObject *args)
-{
- const char *utf8;
+ double size;
- if (!PyArg_ParseTuple(args, "s:Context.show_text", &utf8))
+ if (!PyArg_ParseTuple(args, "d:Context.set_font_size", &size))
return NULL;
- cairo_show_text(c->ctx, utf8);
+ cairo_set_font_size(c->ctx, size);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
@@ -1133,51 +1132,53 @@
}
static PyObject *
-pycairo_text_extents(PyCairoContext *c, PyObject *args)
+pycairo_show_surface(PyCairoContext *c, PyObject *args)
{
- const char *utf8;
- cairo_text_extents_t extents;
+ PyCairoSurface *surface;
+ int width, height;
- if (!PyArg_ParseTuple(args, "s:Context.text_extents", &utf8))
+ if (!PyArg_ParseTuple(args, "O!ii:Context.show_surface",
+ &PyCairoSurface_Type, &surface, &width, &height))
return NULL;
- cairo_text_extents(c->ctx, utf8, &extents);
+ cairo_show_surface(c->ctx, surface->surface, width, height);
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,
- extents.y_advance);
+ Py_RETURN_NONE;
}
static PyObject *
-pycairo_font_extents(PyCairoContext *c)
+pycairo_show_text(PyCairoContext *c, PyObject *args)
{
- cairo_font_extents_t extents;
+ const char *utf8;
- cairo_font_extents(c->ctx, &extents);
+ if (!PyArg_ParseTuple(args, "s:Context.show_text", &utf8))
+ return NULL;
+
+ cairo_show_text(c->ctx, utf8);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
- return Py_BuildValue("(ddddd)", extents.ascent, extents.descent,
- extents.height, extents.max_x_advance,
- extents.max_y_advance);
+ Py_RETURN_NONE;
}
static PyObject *
-pycairo_show_surface(PyCairoContext *c, PyObject *args)
+pycairo_text_extents(PyCairoContext *c, PyObject *args)
{
- PyCairoSurface *surface;
- int width, height;
+ const char *utf8;
+ cairo_text_extents_t extents;
- if (!PyArg_ParseTuple(args, "O!ii:Context.show_surface",
- &PyCairoSurface_Type, &surface, &width, &height))
+ if (!PyArg_ParseTuple(args, "s:Context.text_extents", &utf8))
return NULL;
- cairo_show_surface(c->ctx, surface->surface, width, height);
+ cairo_text_extents(c->ctx, utf8, &extents);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
- Py_RETURN_NONE;
+ return Py_BuildValue("(dddddd)", extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height, extents.x_advance,
+ extents.y_advance);
}
+
static PyMethodDef pycairo_methods[] = {
/* append_path_data */
{ "arc", (PyCFunction)pycairo_arc, METH_VARARGS },
More information about the cairo-commit
mailing list