10 #define PY_SSIZE_T_CLEAN
15 #include "../../blenfont/BLF_api.h"
22 ".. function:: position(fontid, x, y, z)\n"
24 " Set the position for drawing text.\n"
26 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
28 " :type fontid: int\n"
29 " :arg x: X axis position to draw the text.\n"
31 " :arg y: Y axis position to draw the text.\n"
33 " :arg z: Z axis position to draw the text.\n"
41 if (!PyArg_ParseTuple(args,
"ifff:blf.position", &fontid, &
x, &
y, &
z)) {
51 ".. function:: size(fontid, size, dpi)\n"
53 " Set the size and DPI for drawing text.\n"
55 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
57 " :type fontid: int\n"
58 " :arg size: Point size of the font.\n"
59 " :type size: float\n"
60 " :arg dpi: dots per inch value to use for drawing.\n"
67 if (!PyArg_ParseTuple(args,
"ifi:blf.size", &fontid, &
size, &dpi)) {
77 ".. function:: aspect(fontid, aspect)\n"
79 " Set the aspect for drawing text.\n"
81 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
83 " :type fontid: int\n"
84 " :arg aspect: The aspect ratio for text drawing to use.\n"
85 " :type aspect: float\n");
91 if (!PyArg_ParseTuple(args,
"if:blf.aspect", &fontid, &aspect)) {
101 ".. function:: color(fontid, r, g, b, a)\n"
103 " Set the color for drawing text.\n"
105 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
107 " :type fontid: int\n"
108 " :arg r: red channel 0.0 - 1.0.\n"
110 " :arg g: green channel 0.0 - 1.0.\n"
112 " :arg b: blue channel 0.0 - 1.0.\n"
114 " :arg a: alpha channel 0.0 - 1.0.\n"
115 " :type a: float\n");
121 if (!PyArg_ParseTuple(
122 args,
"iffff:blf.color", &fontid, &
rgba[0], &
rgba[1], &
rgba[2], &
rgba[3])) {
133 ".. function:: blur(fontid, radius)\n"
135 " Set the blur radius for drawing text.\n"
137 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
139 " :type fontid: int\n"
140 " :arg radius: The radius for blurring text (in pixels).\n"
141 " :type radius: int\n");
142 static PyObject *py_blf_blur(PyObject *
UNUSED(
self), PyObject *args)
146 if (!PyArg_ParseTuple(args,
"ii:blf.blur", &fontid, &blur)) {
150 BLF_blur(fontid, blur);
157 ".. function:: draw(fontid, text)\n"
159 " Draw text in the current context.\n"
161 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
163 " :type fontid: int\n"
164 " :arg text: the text to draw.\n"
165 " :type text: string\n");
169 Py_ssize_t text_length;
172 if (!PyArg_ParseTuple(args,
"is#:blf.draw", &fontid, &text, &text_length)) {
182 ".. function:: dimensions(fontid, text)\n"
184 " Return the width and height of the text.\n"
186 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
188 " :type fontid: int\n"
189 " :arg text: the text to draw.\n"
190 " :type text: string\n"
191 " :return: the width and height of the text.\n"
192 " :rtype: tuple of 2 floats\n");
196 float r_width, r_height;
200 if (!PyArg_ParseTuple(args,
"is:blf.dimensions", &fontid, &text)) {
206 ret = PyTuple_New(2);
212 ".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n"
214 " Set the clipping, enable/disable using CLIPPING.\n"
216 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
218 " :type fontid: int\n"
219 " :arg xmin: Clip the drawing area by these bounds.\n"
220 " :type xmin: float\n"
221 " :arg ymin: Clip the drawing area by these bounds.\n"
222 " :type ymin: float\n"
223 " :arg xmax: Clip the drawing area by these bounds.\n"
224 " :type xmax: float\n"
225 " :arg ymax: Clip the drawing area by these bounds.\n"
226 " :type ymax: float\n");
229 float xmin, ymin, xmax, ymax;
232 if (!PyArg_ParseTuple(args,
"iffff:blf.clipping", &fontid, &xmin, &ymin, &xmax, &ymax)) {
242 ".. function:: word_wrap(fontid, wrap_width)\n"
244 " Set the wrap width, enable/disable using WORD_WRAP.\n"
246 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
248 " :type fontid: int\n"
249 " :arg wrap_width: The width (in pixels) to wrap words at.\n"
250 " :type wrap_width: int\n");
256 if (!PyArg_ParseTuple(args,
"ii:blf.word_wrap", &fontid, &
wrap_width)) {
266 ".. function:: disable(fontid, option)\n"
270 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
272 " :type fontid: int\n"
273 " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
274 " :type option: int\n");
279 if (!PyArg_ParseTuple(args,
"ii:blf.disable", &fontid, &option)) {
289 ".. function:: enable(fontid, option)\n"
293 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
295 " :type fontid: int\n"
296 " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n"
297 " :type option: int\n");
302 if (!PyArg_ParseTuple(args,
"ii:blf.enable", &fontid, &option)) {
312 ".. function:: rotation(fontid, angle)\n"
314 " Set the text rotation angle, enable/disable using ROTATION.\n"
316 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
318 " :type fontid: int\n"
319 " :arg angle: The angle for text drawing to use.\n"
320 " :type angle: float\n");
326 if (!PyArg_ParseTuple(args,
"if:blf.rotation", &fontid, &
angle)) {
336 ".. function:: shadow(fontid, level, r, g, b, a)\n"
338 " Shadow options, enable/disable using SHADOW .\n"
340 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
342 " :type fontid: int\n"
343 " :arg level: The blur level, can be 3, 5 or 0.\n"
344 " :type level: int\n"
345 " :arg r: Shadow color (red channel 0.0 - 1.0).\n"
347 " :arg g: Shadow color (green channel 0.0 - 1.0).\n"
349 " :arg b: Shadow color (blue channel 0.0 - 1.0).\n"
351 " :arg a: Shadow color (alpha channel 0.0 - 1.0).\n"
352 " :type a: float\n");
358 if (!PyArg_ParseTuple(
359 args,
"iiffff:blf.shadow", &fontid, &level, &
rgba[0], &
rgba[1], &
rgba[2], &
rgba[3])) {
363 if (!
ELEM(level, 0, 3, 5)) {
364 PyErr_SetString(PyExc_TypeError,
"blf.shadow expected arg to be in (0, 3, 5)");
374 ".. function:: shadow_offset(fontid, x, y)\n"
376 " Set the offset for shadow text.\n"
378 " :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default "
380 " :type fontid: int\n"
381 " :arg x: Vertical shadow offset value in pixels.\n"
383 " :arg y: Horizontal shadow offset value in pixels.\n"
384 " :type y: float\n");
389 if (!PyArg_ParseTuple(args,
"iii:blf.shadow_offset", &fontid, &
x, &
y)) {
399 ".. function:: load(filepath)\n"
401 " Load a new font.\n"
403 " :arg filepath: the filepath of the font.\n"
404 " :type filepath: string\n"
405 " :return: the new font's fontid or -1 if there was an error.\n"
406 " :rtype: integer\n");
409 const char *filepath;
411 if (!PyArg_ParseTuple(args,
"s:blf.load", &filepath)) {
415 return PyLong_FromLong(
BLF_load(filepath));
419 ".. function:: unload(filepath)\n"
421 " Unload an existing font.\n"
423 " :arg filepath: the filepath of the font.\n"
424 " :type filepath: string\n");
427 const char *filepath;
429 if (!PyArg_ParseTuple(args,
"s:blf.unload", &filepath)) {
440 {
"aspect", (PyCFunction)
py_blf_aspect, METH_VARARGS, py_blf_aspect_doc},
442 {
"blur", (PyCFunction)py_blf_blur, METH_VARARGS, py_blf_blur_doc},
444 {
"clipping", (PyCFunction)
py_blf_clipping, METH_VARARGS, py_blf_clipping_doc},
445 {
"word_wrap", (PyCFunction)
py_blf_word_wrap, METH_VARARGS, py_blf_word_wrap_doc},
446 {
"disable", (PyCFunction)
py_blf_disable, METH_VARARGS, py_blf_disable_doc},
447 {
"dimensions", (PyCFunction)
py_blf_dimensions, METH_VARARGS, py_blf_dimensions_doc},
448 {
"draw", (PyCFunction)
py_blf_draw, METH_VARARGS, py_blf_draw_doc},
449 {
"enable", (PyCFunction)
py_blf_enable, METH_VARARGS, py_blf_enable_doc},
450 {
"position", (PyCFunction)
py_blf_position, METH_VARARGS, py_blf_position_doc},
451 {
"rotation", (PyCFunction)
py_blf_rotation, METH_VARARGS, py_blf_rotation_doc},
452 {
"shadow", (PyCFunction)
py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
454 {
"size", (PyCFunction)
py_blf_size, METH_VARARGS, py_blf_size_doc},
455 {
"color", (PyCFunction)
py_blf_color, METH_VARARGS, py_blf_color_doc},
456 {
"load", (PyCFunction)
py_blf_load, METH_VARARGS, py_blf_load_doc},
457 {
"unload", (PyCFunction)
py_blf_unload, METH_VARARGS, py_blf_unload_doc},
461 PyDoc_STRVAR(BLF_doc,
"This module provides access to Blender's text drawing functions.");
463 PyModuleDef_HEAD_INIT,
480 PyModule_AddIntConstant(submodule,
"ROTATION",
BLF_ROTATION);
481 PyModule_AddIntConstant(submodule,
"CLIPPING",
BLF_CLIPPING);
482 PyModule_AddIntConstant(submodule,
"SHADOW",
BLF_SHADOW);
483 PyModule_AddIntConstant(submodule,
"WORD_WRAP",
BLF_WORD_WRAP);
void BLF_aspect(int fontid, float x, float y, float z)
void BLF_clipping(int fontid, int xmin, int ymin, int xmax, int ymax)
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
void BLF_color4fv(int fontid, const float rgba[4])
void BLF_shadow_offset(int fontid, int x, int y)
void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
void BLF_disable(int fontid, int option)
void BLF_rotation(int fontid, float angle)
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2)
void BLF_unload(const char *name) ATTR_NONNULL()
void BLF_enable(int fontid, int option)
int BLF_load(const char *name) ATTR_NONNULL()
void BLF_size(int fontid, float size, int dpi)
void BLF_wordwrap(int fontid, int wrap_width)
void BLF_position(int fontid, float x, float y, float z)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static PyObject * py_blf_word_wrap(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_load(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
static struct PyModuleDef BLF_module_def
static PyObject * py_blf_draw(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_position(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
static PyMethodDef BLF_methods[]
static PyObject * py_blf_enable(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_unload(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_disable(PyObject *UNUSED(self), PyObject *args)
PyDoc_STRVAR(py_blf_position_doc, ".. function:: position(fontid, x, y, z)\n" "\n" " Set the position 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 x: X axis position to draw the text.\n" " :type x: float\n" " :arg y: Y axis position to draw the text.\n" " :type y: float\n" " :arg z: Z axis position to draw the text.\n" " :type z: float\n")
PyObject * BPyInit_blf(void)
static PyObject * py_blf_size(PyObject *UNUSED(self), PyObject *args)
static PyObject * py_blf_color(PyObject *UNUSED(self), PyObject *args)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
static const pxr::TfToken rgba("rgba", pxr::TfToken::Immortal)
#define PyTuple_SET_ITEMS(op_arg,...)
int wrap_width(const struct SpaceText *st, struct ARegion *region)