// // SPDX-License-Identifier: BSD-3-Clause // Copyright Contributors to the OpenEXR Project. // // clang-format off #ifndef _PyImathColor4ArrayImpl_h_ #define _PyImathColor4ArrayImpl_h_ // // This .C file was turned into a header file so that instantiations // of the various V3* types can be spread across multiple files in // order to work around MSVC limitations. // #include #include #include #include #include "PyImath.h" #include "PyImathMathExc.h" #include "PyImathDecorators.h" namespace PyImath { using namespace boost::python; using namespace IMATH_NAMESPACE; // XXX fixme - template this // really this should get generated automatically... template static FixedArray Color4Array_get(FixedArray > &ca) { return FixedArray(&(ca.unchecked_index(0)[index]), ca.len(),4*ca.stride(),ca.handle(),ca.writable()); } // Currently we are only exposing the RGBA components. template class_ > > register_Color4Array() { class_ > > color4Array_class = FixedArray >::register_("Fixed length array of IMATH_NAMESPACE::Color4"); color4Array_class .add_property("r",&Color4Array_get) .add_property("g",&Color4Array_get) .add_property("b",&Color4Array_get) .add_property("a",&Color4Array_get) ; return color4Array_class; } } // namespace PyImath #endif // _PyImathColor4ArrayImpl_h_