8 #ifndef _PyImathColor3_h_
9 #define _PyImathColor3_h_
12 #define HBOOST_BIND_GLOBAL_PLACEHOLDERS
13 #include <hboost/python.hpp>
19 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Color4<T> >
register_Color4();
20 template <
class T> hboost::python::class_<PyImath::FixedArray2D<IMATH_NAMESPACE::Color4<T> > >
register_Color4Array2D();
21 template <
class T> hboost::python::class_<PyImath::FixedArray<IMATH_NAMESPACE::Color4<T> > >
register_Color4Array();
22 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Color3<T>, hboost::python::bases<IMATH_NAMESPACE::Vec3<T> > >
register_Color3();
23 template <
class T> hboost::python::class_<PyImath::FixedArray<IMATH_NAMESPACE::Color3<T> > >
register_Color3Array();
42 template <
class T,
class U>
45 static PyObject *
wrap (
const IMATH_NAMESPACE::Color3<T> &
c);
46 static int convert (PyObject *p, IMATH_NAMESPACE::Color3<T> *
v);
49 template <
class T,
class U>
52 static PyObject *
wrap (
const IMATH_NAMESPACE::Color4<T> &
c);
53 static int convert (PyObject *p, IMATH_NAMESPACE::Color4<T> *
v);
56 template <
class T,
class U>
60 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Color3<T> >
::type converter;
61 PyObject *p = converter (c);
65 template <
class T,
class U>
69 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Color4<T> >
::type converter;
70 PyObject *p = converter (c);
74 template <
class T,
class U>
78 hboost::python::extract <IMATH_NAMESPACE::C3c> extractorC3c (p);
79 if (extractorC3c.check())
82 v->setValue (U(c3c[0]), U(c3c[1]), U(c3c[2]));
86 hboost::python::extract <IMATH_NAMESPACE::C3f> extractorC3f (p);
87 if (extractorC3f.check())
90 v->setValue (U(c3f[0]), U(c3f[1]), U(c3f[2]));
94 hboost::python::extract <hboost::python::tuple> extractorTuple (p);
95 if (extractorTuple.check())
97 hboost::python::tuple
t = extractorTuple();
98 if (t.attr (
"__len__") () == 3)
100 double a = hboost::python::extract <double> (t[0]);
101 double b = hboost::python::extract <double> (t[1]);
102 double c = hboost::python::extract <double> (t[2]);
103 v->setValue (U(a), U(b), U(c));
108 hboost::python::extract <hboost::python::list> extractorList (p);
109 if (extractorList.check())
111 hboost::python::list l = extractorList();
112 if (l.attr (
"__len__") () == 3)
114 hboost::python::extract <double> extractor0 (l[0]);
115 hboost::python::extract <double> extractor1 (l[1]);
116 hboost::python::extract <double> extractor2 (l[2]);
117 if (extractor0.check() && extractor1.check() &&
120 v->setValue (U(extractor0()), U(extractor1()),
127 hboost::python::extract <IMATH_NAMESPACE::V3i> extractorV3i (p);
128 if (extractorV3i.check())
131 v->setValue (U(v3i[0]), U(v3i[1]), U(v3i[2]));
135 hboost::python::extract <IMATH_NAMESPACE::V3f> extractorV3f (p);
136 if (extractorV3f.check())
139 v->setValue (U(v3f[0]), U(v3f[1]), U(v3f[2]));
143 hboost::python::extract <IMATH_NAMESPACE::V3d> extractorV3d (p);
144 if (extractorV3d.check())
147 v->setValue (U(v3d[0]), U(v3d[1]), U(v3d[2]));
154 template <
class T,
class U>
158 hboost::python::extract <IMATH_NAMESPACE::C4c> extractorC4c (p);
159 if (extractorC4c.check())
162 v->setValue (U(c4c[0]), U(c4c[1]), U(c4c[2]), U(c4c[3]));
166 hboost::python::extract <IMATH_NAMESPACE::C4f> extractorC4f (p);
167 if (extractorC4f.check())
170 v->setValue (U(c4f[0]), U(c4f[1]), U(c4f[2]), U(c4f[3]));
174 hboost::python::extract <hboost::python::tuple> extractorTuple (p);
175 if (extractorTuple.check())
177 hboost::python::tuple
t = extractorTuple();
178 if (t.attr (
"__len__") () == 4)
184 double a = hboost::python::extract <double> (t[0]);
185 double b = hboost::python::extract <double> (t[1]);
186 double c = hboost::python::extract <double> (t[2]);
187 double d = hboost::python::extract <double> (t[3]);
188 v->setValue (U(a), U(b), U(c), U(d));
193 hboost::python::extract <hboost::python::list> extractorList (p);
194 if (extractorList.check())
196 hboost::python::list l = extractorList();
197 if (l.attr (
"__len__") () == 4)
199 hboost::python::extract <double> extractor0 (l[0]);
200 hboost::python::extract <double> extractor1 (l[1]);
201 hboost::python::extract <double> extractor2 (l[2]);
202 hboost::python::extract <double> extractor3 (l[3]);
203 if (extractor0.check() && extractor1.check() &&
204 extractor2.check() && extractor3.check())
206 v->setValue (U(extractor0()), U(extractor1()),
207 U(extractor2()), U(extractor3()));
FixedArray< IMATH_NAMESPACE::Color3c > C3cArray
hboost::python::class_< IMATH_NAMESPACE::Color4< T > > register_Color4()
Vec3< int > V3i
Vec3 of integer.
Color4< float > C4f
4 float channels
GLboolean GLboolean GLboolean GLboolean a
hboost::python::class_< PyImath::FixedArray< IMATH_NAMESPACE::Color4< T > > > register_Color4Array()
static PyObject * wrap(const IMATH_NAMESPACE::Color4< T > &c)
static int convert(PyObject *p, IMATH_NAMESPACE::Color3< T > *v)
FixedArray< IMATH_NAMESPACE::Color3f > C3fArray
Vec3< double > V3d
Vec3 of double.
C4< float, float > Color4f
GLint GLint GLsizei GLint GLenum GLenum type
C3< unsigned char, int > Color3c
C4< unsigned char, int > Color4c
FixedArray< IMATH_NAMESPACE::Color4c > C4cArray
Color4< unsigned char > C4c
4 8-bit integer channels
GLboolean GLboolean GLboolean b
Vec3< float > V3f
Vec3 of float.
hboost::python::class_< PyImath::FixedArray< IMATH_NAMESPACE::Color3< T > > > register_Color3Array()
static int convert(PyObject *p, IMATH_NAMESPACE::Color4< T > *v)
FixedArray< IMATH_NAMESPACE::Color4f > C4fArray
hboost::python::class_< IMATH_NAMESPACE::Color3< T >, hboost::python::bases< IMATH_NAMESPACE::Vec3< T > > > register_Color3()
hboost::python::class_< PyImath::FixedArray2D< IMATH_NAMESPACE::Color4< T > > > register_Color4Array2D()
FixedArray2D< IMATH_NAMESPACE::Color4f > Color4fArray
static PyObject * wrap(const IMATH_NAMESPACE::Color3< T > &c)
Color3< float > C3f
3 float channels
C3< float, float > Color3f
Color3< unsigned char > C3c
3 8-bit integer channels
FixedArray2D< IMATH_NAMESPACE::Color4c > Color4cArray