1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 /** \file
18  * \ingroup pymathutils
19  */
20 
21 #pragma once
22 
23 extern PyTypeObject color_Type;
24 #define ColorObject_Check(v) PyObject_TypeCheck((v), &color_Type)
25 #define ColorObject_CheckExact(v) (Py_TYPE(v) == &color_Type)
26 
27 typedef struct {
28   BASE_MATH_MEMBERS(col);
29 } ColorObject;
30 
31 /* struct data contains a pointer to the actual data that the
32  * object uses. It can use either PyMem allocated data (which will
33  * be stored in py_data) or be a wrapper for data allocated through
34  * blender (stored in blend_data). This is an either/or struct not both*/
35 
36 /* prototypes */
37 PyObject *Color_CreatePyObject(const float col[3],
38                                PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT;
39 PyObject *Color_CreatePyObject_wrap(float col[3], PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT
40     ATTR_NONNULL(1);
41 PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
42                                   unsigned char cb_type,
43                                   unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT;
44