Blender  V3.3
BPy_ConstantColorShader.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
8 
9 #include "../../stroke/BasicStrokeShaders.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 using namespace Freestyle;
16 
18 
19 //------------------------INSTANCE METHODS ----------------------------------
20 
22  "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantColorShader`\n"
23  "\n"
24  "[Color shader]\n"
25  "\n"
26  ".. method:: __init__(red, green, blue, alpha=1.0)\n"
27  "\n"
28  " Builds a ConstantColorShader object.\n"
29  "\n"
30  " :arg red: The red component.\n"
31  " :type red: float\n"
32  " :arg green: The green component.\n"
33  " :type green: float\n"
34  " :arg blue: The blue component.\n"
35  " :type blue: float\n"
36  " :arg alpha: The alpha value.\n"
37  " :type alpha: float\n"
38  "\n"
39  ".. method:: shade(stroke)\n"
40  "\n"
41  " Assigns a constant color to every vertex of the Stroke.\n"
42  "\n"
43  " :arg stroke: A Stroke object.\n"
44  " :type stroke: :class:`freestyle.types.Stroke`\n";
45 
47  PyObject *args,
48  PyObject *kwds)
49 {
50  static const char *kwlist[] = {"red", "green", "blue", "alpha", nullptr};
51  float f1, f2, f3, f4 = 1.0;
52 
53  if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4)) {
54  return -1;
55  }
56  self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4);
57  return 0;
58 }
59 
60 /*-----------------------BPy_ConstantColorShader type definition ------------------------------*/
61 
62 PyTypeObject ConstantColorShader_Type = {
63  PyVarObject_HEAD_INIT(nullptr, 0) "ConstantColorShader", /* tp_name */
64  sizeof(BPy_ConstantColorShader), /* tp_basicsize */
65  0, /* tp_itemsize */
66  nullptr, /* tp_dealloc */
67  0, /* tp_vectorcall_offset */
68  nullptr, /* tp_getattr */
69  nullptr, /* tp_setattr */
70  nullptr, /* tp_reserved */
71  nullptr, /* tp_repr */
72  nullptr, /* tp_as_number */
73  nullptr, /* tp_as_sequence */
74  nullptr, /* tp_as_mapping */
75  nullptr, /* tp_hash */
76  nullptr, /* tp_call */
77  nullptr, /* tp_str */
78  nullptr, /* tp_getattro */
79  nullptr, /* tp_setattro */
80  nullptr, /* tp_as_buffer */
81  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
82  ConstantColorShader___doc__, /* tp_doc */
83  nullptr, /* tp_traverse */
84  nullptr, /* tp_clear */
85  nullptr, /* tp_richcompare */
86  0, /* tp_weaklistoffset */
87  nullptr, /* tp_iter */
88  nullptr, /* tp_iternext */
89  nullptr, /* tp_methods */
90  nullptr, /* tp_members */
91  nullptr, /* tp_getset */
92  &StrokeShader_Type, /* tp_base */
93  nullptr, /* tp_dict */
94  nullptr, /* tp_descr_get */
95  nullptr, /* tp_descr_set */
96  0, /* tp_dictoffset */
97  (initproc)ConstantColorShader___init__, /* tp_init */
98  nullptr, /* tp_alloc */
99  nullptr, /* tp_new */
100 };
101 
103 
104 #ifdef __cplusplus
105 }
106 #endif
PyTypeObject ConstantColorShader_Type
static int ConstantColorShader___init__(BPy_ConstantColorShader *self, PyObject *args, PyObject *kwds)
static char ConstantColorShader___doc__[]
PyTypeObject StrokeShader_Type
inherits from class Rep
Definition: AppCanvas.cpp:18