[cairo-commit] pycairo/cairo pycairo-context.c, 1.35,
1.36 pycairo-pattern.c, 1.14, 1.15
Steve Chaplin
commit at pdx.freedesktop.org
Thu Apr 14 20:25:39 PDT 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv26442/cairo
Modified Files:
pycairo-context.c pycairo-pattern.c
Log Message:
SC 2005/04/15
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- pycairo-context.c 14 Apr 2005 08:55:40 -0000 1.35
+++ pycairo-context.c 15 Apr 2005 03:25:37 -0000 1.36
@@ -287,44 +287,45 @@
}
static PyObject *
-pycairo_set_rgb_color(PyCairoContext *c, PyObject *args)
+pycairo_set_source_rgb(PyCairoContext *c, PyObject *args)
{
double red, green, blue;
- if (!PyArg_ParseTuple(args, "ddd:Context.set_rgb_color",
+ if (!PyArg_ParseTuple(args, "ddd:Context.set_source_rgb",
&red, &green, &blue))
return NULL;
- cairo_set_rgb_color(c->ctx, red, green, blue);
+ cairo_set_source_rgb(c->ctx, red, green, blue);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
static PyObject *
-pycairo_set_alpha(PyCairoContext *c, PyObject *args)
+pycairo_set_source_rgba(PyCairoContext *c, PyObject *args)
{
- double alpha;
+ double red, green, blue, alpha;
- if (!PyArg_ParseTuple(args, "d:Context.set_alpha", &alpha))
+ if (!PyArg_ParseTuple(args, "dddd:Context.set_source_rgba",
+ &red, &green, &blue, &alpha))
return NULL;
- cairo_set_alpha(c->ctx, alpha);
+ cairo_set_source_rgba(c->ctx, red, green, blue, alpha);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
}
static PyObject *
-pycairo_set_pattern(PyCairoContext *c, PyObject *args)
+pycairo_set_source(PyCairoContext *c, PyObject *args)
{
- PyCairoPattern *pattern;
+ PyCairoPattern *p;
- if (!PyArg_ParseTuple(args, "O!:Context.set_pattern",
- &PyCairoPattern_Type, &pattern))
+ if (!PyArg_ParseTuple(args, "O!:Context.set_source",
+ &PyCairoPattern_Type, &p))
return NULL;
- cairo_set_pattern(c->ctx, pattern->pattern);
+ cairo_set_source(c->ctx, p->pattern);
if (pycairo_check_status(cairo_status(c->ctx)))
return NULL;
Py_RETURN_NONE;
@@ -926,12 +927,6 @@
}
static PyObject *
-pycairo_get_alpha(PyCairoContext *c)
-{
- return PyFloat_FromDouble(cairo_get_alpha(c->ctx));
-}
-
-static PyObject *
pycairo_get_tolerance(PyCairoContext *c)
{
return PyFloat_FromDouble(cairo_get_tolerance(c->ctx));
@@ -993,18 +988,18 @@
}
static PyObject *
-pycairo_get_pattern(PyCairoContext *c)
+pycairo_get_source(PyCairoContext *c)
{
- PyObject *py_pattern;
- cairo_pattern_t *pattern = cairo_get_pattern(c->ctx);
+ PyObject *p;
+ cairo_pattern_t *pattern = cairo_get_source(c->ctx);
if (!pattern)
return PyErr_NoMemory();
- py_pattern = PyCairoPattern_FromPattern(pattern);
- if (py_pattern)
+ p = PyCairoPattern_FromPattern(pattern);
+ if (p)
cairo_pattern_reference(pattern);
- return py_pattern;
+ return p;
}
@@ -1167,7 +1162,6 @@
{ "save", (PyCFunction)pycairo_save, METH_NOARGS },
{ "scale", (PyCFunction)pycairo_scale, METH_VARARGS },
{ "select_font_face",(PyCFunction)pycairo_select_font_face,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_face", (PyCFunction)pycairo_set_font_face, METH_VARARGS },
@@ -1179,8 +1173,9 @@
{ "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 },
+ { "set_source", (PyCFunction)pycairo_set_source, METH_VARARGS },
+ { "set_source_rgb", (PyCFunction)pycairo_set_source_rgb,METH_VARARGS },
+ { "set_source_rgba",(PyCFunction)pycairo_set_source_rgba,METH_VARARGS },
/* "set_target_image" */
# if 0
#ifdef CAIRO_HAS_PDF_SURFACE
@@ -1209,7 +1204,6 @@
};
static PyGetSetDef pycairo_getsets[] = {
- { "alpha", (getter)pycairo_get_alpha, (setter)0 },
{ "fill_extents", (getter)pycairo_fill_extents, (setter)0 },
{ "fill_rule", (getter)pycairo_get_fill_rule, (setter)0 },
{ "font_face", (getter)pycairo_get_font_face, (setter)0 },
@@ -1220,9 +1214,9 @@
{ "line_width", (getter)pycairo_get_line_width, (setter)0 },
{ "miter_limit", (getter)pycairo_get_miter_limit, (setter)0 },
{ "operator", (getter)pycairo_get_operator, (setter)0 },
- { "pattern", (getter)pycairo_get_pattern, (setter)0 },
{ "point", (getter)pycairo_get_current_point,(setter)0 },
{ "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 },
Index: pycairo-pattern.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-pattern.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- pycairo-pattern.c 13 Apr 2005 14:14:18 -0000 1.14
+++ pycairo-pattern.c 15 Apr 2005 03:25:37 -0000 1.15
@@ -141,17 +141,34 @@
}
static PyObject *
-pattern_add_color_stop(PyCairoPattern *p, PyObject *args)
+pattern_add_color_stop_rgb(PyCairoPattern *p, PyObject *args)
+{
+ double offset, red, green, blue;
+ cairo_status_t status;
+
+ if (!PyArg_ParseTuple(args, "ddddd:Pattern.add_color_stop_rgb",
+ &offset, &red, &green, &blue))
+ return NULL;
+
+ status = cairo_pattern_add_color_stop_rgb (p->pattern, offset, red, green,
+ blue);
+ if (pycairo_check_status(status))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
+pattern_add_color_stop_rgba(PyCairoPattern *p, PyObject *args)
{
double offset, red, green, blue, alpha;
cairo_status_t status;
- if (!PyArg_ParseTuple(args, "ddddd:Pattern.add_color_stop",
+ if (!PyArg_ParseTuple(args, "ddddd:Pattern.add_color_stop_rgba",
&offset, &red, &green, &blue, &alpha))
return NULL;
- status = cairo_pattern_add_color_stop (p->pattern, offset, red, green,
- blue, alpha);
+ status = cairo_pattern_add_color_stop_rgba (p->pattern, offset, red,
+ green, blue, alpha);
if (pycairo_check_status(status))
return NULL;
Py_RETURN_NONE;
@@ -220,7 +237,10 @@
static PyMethodDef pattern_methods[] = {
- { "add_color_stop", (PyCFunction)pattern_add_color_stop, METH_VARARGS },
+ { "add_color_stop_rgb",(PyCFunction)pattern_add_color_stop_rgb,
+ METH_VARARGS },
+ { "add_color_stop_rgba",(PyCFunction)pattern_add_color_stop_rgba,
+ METH_VARARGS },
{ "create_for_surface",(PyCFunction)pattern_create_for_surface,
METH_VARARGS | METH_CLASS },
{ "create_linear", (PyCFunction)pattern_create_linear,
More information about the cairo-commit
mailing list