35 "Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n"
37 "Class to define a stroke. A stroke is made of a set of 2D vertices\n"
38 "(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n"
39 "defines the stroke's backbone geometry. Each of these stroke vertices\n"
40 "defines the stroke's shape and appearance at this vertex position.\n"
42 ".. method:: Stroke(*args)\n"
44 " Accepted call signatures:\n"
47 " - ``Stroke(brother)``\n"
49 " Creates a :class:`Stroke` using the default constructor or copy constructor\n");
52 static const char *kwlist[] = {
"brother",
nullptr};
53 PyObject *brother =
nullptr;
55 if (!PyArg_ParseTupleAndKeywords(args,
94 PyErr_Format(PyExc_IndexError,
"Stroke[index]: index %d out of range", keynum);
102 Stroke_compute_sampling_doc,
103 ".. method:: compute_sampling(n)\n"
105 " Compute the sampling needed to get N vertices. If the\n"
106 " specified number of vertices is less than the actual number of\n"
107 " vertices, the actual sampling value is returned. (To remove Vertices,\n"
108 " use the RemoveVertex() method of this class.)\n"
110 " :param n: The number of stroke vertices we eventually want\n"
113 " :return: The sampling that must be used in the Resample(float)\n"
118 static const char *kwlist[] = {
"n",
nullptr};
121 if (!PyArg_ParseTupleAndKeywords(args,
136 ".. method:: resample(*args)\n"
138 " Accepted call signatures:\n"
140 " - ``resample(n)``\n"
141 " - ``resample(sampling)``\n"
143 " Resamples the stroke so using one of two methods with the goal\n"
144 " of creating a stroke with fewer points and the same shape.\n"
146 " :param n: Resamples the stroke so that it eventually has N points. That means\n"
147 " it is going to add N-vertices_size, where vertices_size is the\n"
148 " number of points we already have. If vertices_size >= N, no\n"
149 " resampling is done.\n"
151 " :param sampling: Resamples the stroke with a given sampling value. If the\n"
152 " sampling is smaller than the actual sampling value, no resampling is done.\n"
153 " :type sampling: float\n");
156 static const char *kwlist_1[] = {
"n",
nullptr};
157 static const char *kwlist_2[] = {
"sampling",
nullptr};
161 if (PyArg_ParseTupleAndKeywords(args,
169 PyErr_SetString(PyExc_RuntimeError,
"Stroke resampling (by vertex count) failed");
173 else if ((
void)PyErr_Clear(),
174 PyArg_ParseTupleAndKeywords(args,
182 PyErr_SetString(PyExc_RuntimeError,
"Stroke resampling (by vertex interval) failed");
187 PyErr_SetString(PyExc_TypeError,
"invalid argument");
195 Stroke_insert_vertex_doc,
196 ".. method:: insert_vertex(vertex, next)\n"
198 " Inserts the StrokeVertex given as argument into the Stroke before the\n"
199 " point specified by next. The length and curvilinear abscissa are\n"
200 " updated consequently.\n"
202 " :param vertex: The StrokeVertex to insert in the Stroke.\n"
203 " :type vertex: :class:`StrokeVertex`\n"
204 " :param next: A StrokeVertexIterator pointing to the StrokeVertex\n"
205 " before which vertex must be inserted.\n"
206 " :type next: :class:`StrokeVertexIterator`\n");
209 static const char *kwlist[] = {
"vertex",
"next",
nullptr};
210 PyObject *py_sv =
nullptr, *py_sv_it =
nullptr;
212 if (!PyArg_ParseTupleAndKeywords(args,
237 Stroke_remove_vertex_doc,
238 ".. method:: remove_vertex(vertex)\n"
240 " Removes the StrokeVertex given as argument from the Stroke. The length\n"
241 " and curvilinear abscissa are updated consequently.\n"
243 " :param vertex: the StrokeVertex to remove from the Stroke.\n"
244 " :type vertex: :class:`StrokeVertex`\n");
247 static const char *kwlist[] = {
"vertex",
nullptr};
248 PyObject *py_sv =
nullptr;
250 if (!PyArg_ParseTupleAndKeywords(args,
264 PyErr_SetString(PyExc_TypeError,
"invalid argument");
272 Stroke_remove_all_vertices_doc,
273 ".. method:: remove_all_vertices()\n"
275 " Removes all vertices from the Stroke.\n");
284 Stroke_update_length_doc,
285 ".. method:: update_length()\n"
287 " Updates the 2D length of the Stroke.\n");
296 Stroke_stroke_vertices_begin_doc,
297 ".. method:: stroke_vertices_begin(t=0.0)\n"
299 " Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n"
300 " the Stroke. One can specify a sampling value to re-sample the Stroke\n"
301 " on the fly if needed.\n"
303 " :param t: The resampling value with which we want our Stroke to be\n"
304 " resampled. If 0 is specified, no resampling is done.\n"
306 " :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n"
307 " :rtype: :class:`StrokeVertexIterator`\n");
310 static const char *kwlist[] = {
"t",
nullptr};
313 if (!PyArg_ParseTupleAndKeywords(args,
317 ":stroke_vertices_begin",
329 Stroke_stroke_vertices_end_doc,
330 ".. method:: stroke_vertices_end()\n"
332 " Returns a StrokeVertexIterator pointing after the last StrokeVertex\n"
335 " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
336 " :rtype: :class:`StrokeVertexIterator`\n");
346 ".. method:: __reversed__()\n"
348 " Returns a StrokeVertexIterator iterating over the vertices of the Stroke\n"
349 " in the reversed order (from the last to the first).\n"
351 " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n"
352 " :rtype: :class:`StrokeVertexIterator`\n");
361 Stroke_stroke_vertices_size_doc,
362 ".. method:: stroke_vertices_size()\n"
364 " Returns the number of StrokeVertex constituting the Stroke.\n"
366 " :return: The number of stroke vertices.\n"
375# pragma clang diagnostic push
376# pragma clang diagnostic ignored "-Wcast-function-type"
378# pragma GCC diagnostic push
379# pragma GCC diagnostic ignored "-Wcast-function-type"
386 METH_VARARGS | METH_KEYWORDS,
387 Stroke_compute_sampling_doc},
388 {
"resample", (PyCFunction)
Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
389 {
"remove_all_vertices",
392 Stroke_remove_all_vertices_doc},
395 METH_VARARGS | METH_KEYWORDS,
396 Stroke_remove_vertex_doc},
399 METH_VARARGS | METH_KEYWORDS,
400 Stroke_insert_vertex_doc},
402 {
"stroke_vertices_begin",
404 METH_VARARGS | METH_KEYWORDS,
405 Stroke_stroke_vertices_begin_doc},
406 {
"stroke_vertices_end",
409 Stroke_stroke_vertices_end_doc},
410 {
"__reversed__", (PyCFunction)
Stroke_reversed, METH_NOARGS, Stroke_reversed_doc},
411 {
"stroke_vertices_size",
414 Stroke_stroke_vertices_size_doc},
415 {
nullptr,
nullptr, 0,
nullptr},
420# pragma clang diagnostic pop
422# pragma GCC diagnostic pop
430 Stroke_medium_type_doc,
431 "The MediumType used for this Stroke.\n"
433 ":type: :class:`MediumType`\n");
442 PyErr_SetString(PyExc_TypeError,
"value must be a MediumType");
451 Stroke_texture_id_doc,
452 "The ID of the texture used to simulate th marks system for this Stroke.\n"
462 uint i = PyLong_AsUnsignedLong(value);
463 if (PyErr_Occurred()) {
473 "True if this Stroke uses a texture with tips, and false otherwise.\n"
483 if (!PyBool_Check(value)) {
492 Stroke_length_2d_doc,
493 "The 2D length of the Stroke.\n"
504 if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) {
506 PyErr_SetString(PyExc_TypeError,
"value must be a number");
516 "The Id of this Stroke.\n"
518 ":type: :class:`Id`\n");
528 PyErr_SetString(PyExc_TypeError,
"value must be an Id");
539 Stroke_medium_type_doc,
544 Stroke_texture_id_doc,
550 Stroke_length_2d_doc,
553 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
572 PyVarObject_HEAD_INIT(
nullptr, 0)
591 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator &sv_it, bool reversed)
PyObject * BPy_Id_from_Id(Id &id)
bool bool_from_PyBool(PyObject *b)
PyObject * BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv)
PyObject * BPy_MediumType_from_MediumType(Stroke::MediumType n)
Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj)
PyObject * PyBool_from_bool(bool b)
PyDoc_STRVAR(FalseBP1D___doc__, "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" "\n" ".. method:: __call__(inter1, inter2)\n" "\n" " Always returns false.\n" "\n" " :param inter1: The first Interface1D object.\n" " :type inter1: :class:`freestyle.types.Interface1D`\n" " :param inter2: The second Interface1D object.\n" " :type inter2: :class:`freestyle.types.Interface1D`\n" " :return: False.\n" " :rtype: bool\n")
PyTypeObject Interface1D_Type
#define BPy_MediumType_Check(v)
PyTypeObject StrokeVertexIterator_Type
PyTypeObject StrokeVertex_Type
static PyObject * Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void *)
static PyObject * Stroke_update_length(BPy_Stroke *self)
static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
static PyObject * Stroke_texture_id_get(BPy_Stroke *self, void *)
static PyObject * Stroke_iter(PyObject *self)
static PyObject * Stroke_remove_all_vertices(BPy_Stroke *self)
static PyObject * Stroke_resample(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void *)
static PyObject * Stroke_stroke_vertices_end(BPy_Stroke *self)
static PyObject * Stroke_medium_type_get(BPy_Stroke *self, void *)
static PySequenceMethods BPy_Stroke_as_sequence
static PyObject * Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static PyObject * Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static PyObject * Stroke_length_2d_get(BPy_Stroke *self, void *)
static PyMethodDef BPy_Stroke_methods[]
static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void *)
static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *)
static PyObject * Stroke_tips_get(BPy_Stroke *self, void *)
static PyObject * Stroke_reversed(BPy_Stroke *self)
static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *)
static PyObject * Stroke_stroke_vertices_size(BPy_Stroke *self)
static PyObject * Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static PyGetSetDef BPy_Stroke_getseters[]
static PyObject * Stroke_sq_item(BPy_Stroke *self, Py_ssize_t keynum)
static PyObject * Stroke_id_get(BPy_Stroke *self, void *)
void setTextureId(uint id)
StrokeVertex & strokeVerticeAt(uint i)
void RemoveVertex(StrokeVertex *iVertex)
void InsertVertex(StrokeVertex *iVertex, StrokeInternal::StrokeVertexIterator next)
uint strokeVerticesSize() const
MediumType getMediumType() const
void setLength(float iLength)
float ComputeSampling(int iNVertices)
StrokeInternal::StrokeVertexIterator strokeVerticesEnd()
StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t=0.0f)
int Resample(int iNPoints)
void setMediumType(MediumType iType)
PyObject_HEAD Freestyle::Interface1D * if1D