4 #include <boost/shared_ptr.hpp>
6 #include <boost/serialization/export.hpp>
7 #include <boost/serialization/nvp.hpp>
8 #include <boost/serialization/version.hpp>
13 typedef boost::shared_ptr<Color> ColorRef;
15 //! convienece class for handling opengl colors
21 //! initialize with red, green, blue, alpha
22 Color(float r, float g, float b, float a=1.0);
23 Color(const ColorRef);
25 //! set all channels simultaneously
26 void set(float r, float g, float b, float a=1.0);
27 //! return an array of 4 colors (stored by class)
28 const float* const get() const;
38 enum color_channels { RedChannel, GreenChannel, BlueChannel, AlphaChannel };
39 friend bool operator==(const Color&, const Color&);
40 friend std::ostream& operator<<(std::ostream&, const Color&);
46 friend class boost::serialization::access;
47 template<class Archive>
48 void serialize(Archive& ar, const unsigned int /*version*/) {
49 ar & boost::serialization::make_nvp("red", colors[RedChannel]);
50 ar & boost::serialization::make_nvp("green", colors[GreenChannel]);
51 ar & boost::serialization::make_nvp("blue", colors[BlueChannel]);
52 ar & boost::serialization::make_nvp("alpha", colors[AlphaChannel]);
55 BOOST_CLASS_EXPORT(Color)