24 #include "../stroke/ContextFunctions.h"
37 ".. function:: get_time_stamp()\n"
39 " Returns the system time stamp.\n"
41 " :return: The system time stamp.\n"
50 ".. method:: get_canvas_width()\n"
52 " Returns the canvas width.\n"
54 " :return: The canvas width.\n"
63 ".. method:: get_canvas_height()\n"
65 " Returns the canvas height.\n"
67 " :return: The canvas height.\n"
76 ".. method:: get_border()\n"
78 " Returns the border.\n"
80 " :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n"
86 PyObject *
v = PyTuple_New(4);
88 PyLong_FromLong(
border.getMin().x()),
89 PyLong_FromLong(
border.getMin().y()),
90 PyLong_FromLong(
border.getMax().x()),
91 PyLong_FromLong(
border.getMax().y()));
96 ".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n"
98 " Loads an image map for further reading.\n"
100 " :arg file_name: The name of the image file.\n"
101 " :type file_name: str\n"
102 " :arg map_name: The name that will be used to access this image.\n"
103 " :type map_name: str\n"
104 " :arg num_levels: The number of levels in the map pyramid\n"
105 " (default = 4). If num_levels == 0, the complete pyramid is\n"
107 " :type num_levels: int\n"
108 " :arg sigma: The sigma value of the gaussian function.\n"
109 " :type sigma: float\n";
113 static const char *kwlist[] = {
"file_name",
"map_name",
"num_levels",
"sigma",
nullptr};
114 char *fileName, *mapName;
115 unsigned nbLevels = 4;
118 if (!PyArg_ParseTupleAndKeywords(
119 args, kwds,
"ss|If", (
char **)kwlist, &fileName, &mapName, &nbLevels, &sigma)) {
127 ".. function:: read_map_pixel(map_name, level, x, y)\n"
129 " Reads a pixel in a user-defined map.\n"
131 " :arg map_name: The name of the map.\n"
132 " :type map_name: str\n"
133 " :arg level: The level of the pyramid in which we wish to read the\n"
135 " :type level: int\n"
136 " :arg x: The x coordinate of the pixel we wish to read. The origin\n"
137 " is in the lower-left corner.\n"
139 " :arg y: The y coordinate of the pixel we wish to read. The origin\n"
140 " is in the lower-left corner.\n"
142 " :return: The floating-point value stored for that pixel.\n"
149 static const char *kwlist[] = {
"map_name",
"level",
"x",
"y",
nullptr};
154 if (!PyArg_ParseTupleAndKeywords(
155 args, kwds,
"siII", (
char **)kwlist, &mapName, &level, &
x, &
y)) {
162 ".. function:: read_complete_view_map_pixel(level, x, y)\n"
164 " Reads a pixel in the complete view map.\n"
166 " :arg level: The level of the pyramid in which we wish to read the\n"
168 " :type level: int\n"
169 " :arg x: The x coordinate of the pixel we wish to read. The origin\n"
170 " is in the lower-left corner.\n"
172 " :arg y: The y coordinate of the pixel we wish to read. The origin\n"
173 " is in the lower-left corner.\n"
175 " :return: The floating-point value stored for that pixel.\n"
182 static const char *kwlist[] = {
"level",
"x",
"y",
nullptr};
186 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"iII", (
char **)kwlist, &level, &
x, &
y)) {
193 ".. function:: read_directional_view_map_pixel(orientation, level, x, y)\n"
195 " Reads a pixel in one of the oriented view map images.\n"
197 " :arg orientation: The number telling which orientation we want to\n"
199 " :type orientation: int\n"
200 " :arg level: The level of the pyramid in which we wish to read the\n"
202 " :type level: int\n"
203 " :arg x: The x coordinate of the pixel we wish to read. The origin\n"
204 " is in the lower-left corner.\n"
206 " :arg y: The y coordinate of the pixel we wish to read. The origin\n"
207 " is in the lower-left corner.\n"
209 " :return: The floating-point value stored for that pixel.\n"
216 static const char *kwlist[] = {
"orientation",
"level",
"x",
"y",
nullptr};
217 int orientation, level;
220 if (!PyArg_ParseTupleAndKeywords(
221 args, kwds,
"iiII", (
char **)kwlist, &orientation, &level, &
x, &
y)) {
224 return PyFloat_FromDouble(
229 ".. function:: get_selected_fedge()\n"
231 " Returns the selected FEdge.\n"
233 " :return: The selected FEdge.\n"
234 " :rtype: :class:`FEdge`\n";
260 {
"get_canvas_height",
270 METH_VARARGS | METH_KEYWORDS,
274 METH_VARARGS | METH_KEYWORDS,
276 {
"read_complete_view_map_pixel",
278 METH_VARARGS | METH_KEYWORDS,
280 {
"read_directional_view_map_pixel",
282 METH_VARARGS | METH_KEYWORDS,
284 {
"get_selected_fedge",
288 {
nullptr,
nullptr, 0,
nullptr},
294 PyModuleDef_HEAD_INIT,
295 "Freestyle.ContextFunctions",
316 PyModule_AddObject(
module,
"ContextFunctions", m);
static char ContextFunctions_get_border___doc__[]
static PyObject * ContextFunctions_load_map(PyObject *, PyObject *args, PyObject *kwds)
static PyObject * ContextFunctions_get_canvas_height(PyObject *)
static char ContextFunctions_get_time_stamp___doc__[]
static PyObject * ContextFunctions_get_canvas_width(PyObject *)
static PyObject * ContextFunctions_get_border(PyObject *)
static char ContextFunctions_read_complete_view_map_pixel___doc__[]
static char ContextFunctions_read_map_pixel___doc__[]
static PyObject * ContextFunctions_get_time_stamp(PyObject *)
static PyObject * ContextFunctions_read_map_pixel(PyObject *, PyObject *args, PyObject *kwds)
static PyModuleDef module_definition
static char module_docstring[]
static char ContextFunctions_read_directional_view_map_pixel___doc__[]
static PyObject * ContextFunctions_read_directional_view_map_pixel(PyObject *, PyObject *args, PyObject *kwds)
static PyObject * ContextFunctions_read_complete_view_map_pixel(PyObject *, PyObject *args, PyObject *kwds)
static char ContextFunctions_load_map___doc__[]
int ContextFunctions_Init(PyObject *module)
static PyObject * ContextFunctions_get_selected_fedge(PyObject *)
static char ContextFunctions_get_canvas_width___doc__[]
static PyMethodDef module_functions[]
static char ContextFunctions_get_canvas_height___doc__[]
static char ContextFunctions_get_selected_fedge___doc__[]
PyObject * Any_BPy_FEdge_from_FEdge(FEdge &fe)
_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 struct PyModuleDef module
ATTR_WARN_UNUSED_RESULT const BMVert * v
IconTextureDrawCall border
unsigned GetCanvasWidthCF()
float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y)
FEdge * GetSelectedFEdgeCF()
float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, unsigned y)
void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma)
unsigned GetCanvasHeightCF()
BBox< Vec2i > GetBorderCF()
unsigned GetTimeStampCF()
float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y)
#define PyTuple_SET_ITEMS(op_arg,...)