diff options
Diffstat (limited to 'source/blender/python/generic/blf_py_api.c')
-rw-r--r-- | source/blender/python/generic/blf_py_api.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c index 629335888e4..d0f708b7e3c 100644 --- a/source/blender/python/generic/blf_py_api.c +++ b/source/blender/python/generic/blf_py_api.c @@ -114,6 +114,41 @@ static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args) } +PyDoc_STRVAR(py_blf_color_doc, +".. function:: color(fontid, level, r, g, b, a)\n" +"\n" +" Set the color for drawing text.\n" +"\n" +" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n" +" :type fontid: int\n" +" :arg r: red channel 0.0 - 1.0.\n" +" :type r: float\n" +" :arg g: green channel 0.0 - 1.0.\n" +" :type g: float\n" +" :arg b: blue channel 0.0 - 1.0.\n" +" :type b: float\n" +" :arg a: alpha channel 0.0 - 1.0.\n" +" :type a: float\n" +); +static PyObject *py_blf_color(PyObject *UNUSED(self), PyObject *args) +{ + int fontid; + float rgba[4]; + + if (!PyArg_ParseTuple( + args, "iffff:blf.color", + &fontid, &rgba[0], &rgba[1], &rgba[2], &rgba[3])) + { + return NULL; + } + + BLF_color4fv(fontid, rgba); + + Py_RETURN_NONE; +} + + +#if BLF_BLUR_ENABLE PyDoc_STRVAR(py_blf_blur_doc, ".. function:: blur(fontid, radius)\n" "\n" @@ -135,6 +170,7 @@ static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args) Py_RETURN_NONE; } +#endif PyDoc_STRVAR(py_blf_draw_doc, @@ -418,7 +454,9 @@ static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args) /*----------------------------MODULE INIT-------------------------*/ static PyMethodDef BLF_methods[] = { {"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, py_blf_aspect_doc}, +#if BLF_BLUR_ENABLE {"blur", (PyCFunction) py_blf_blur, METH_VARARGS, py_blf_blur_doc}, +#endif {"clipping", (PyCFunction) py_blf_clipping, METH_VARARGS, py_blf_clipping_doc}, {"word_wrap", (PyCFunction) py_blf_word_wrap, METH_VARARGS, py_blf_word_wrap_doc}, {"disable", (PyCFunction) py_blf_disable, METH_VARARGS, py_blf_disable_doc}, @@ -430,6 +468,7 @@ static PyMethodDef BLF_methods[] = { {"shadow", (PyCFunction) py_blf_shadow, METH_VARARGS, py_blf_shadow_doc}, {"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc}, {"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc}, + {"color", (PyCFunction) py_blf_color, METH_VARARGS, py_blf_color_doc}, {"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc}, {"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc}, {NULL, NULL, 0, NULL} |