color.h
Go to the documentation of this file.00001
00002
00003 #ifndef _CLUTTERMM_COLOR_H
00004 #define _CLUTTERMM_COLOR_H
00005
00006
00007 #include <glibmm.h>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <glibmm/ustring.h>
00027 #include <cluttermm/types.h>
00028
00029
00030 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00031 extern "C" { typedef struct _ClutterColor ClutterColor; }
00032 #endif
00033
00034 namespace Clutter
00035 {
00036
00037 class Color
00038 {
00039 public:
00040 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00041 typedef Color CppObjectType;
00042 typedef ClutterColor BaseObjectType;
00043
00044 static GType get_type() G_GNUC_CONST;
00045 #endif
00046
00047
00048 explicit Color(ClutterColor* gobject, bool make_a_copy = true);
00049
00050 Color(const Color& other);
00051 Color& operator=(const Color& other);
00052
00053 ~Color();
00054
00055 void swap(Color& other);
00056
00058 ClutterColor* gobj() { return gobject_; }
00059
00061 const ClutterColor* gobj() const { return gobject_; }
00062
00064 ClutterColor* gobj_copy() const;
00065
00066 protected:
00067 ClutterColor* gobject_;
00068
00069 private:
00070
00071
00072 public:
00073
00074
00075
00076
00077
00078
00079
00080
00081 Color();
00084 Color(guint8 red, guint8 green, guint8 blue, guint8 alpha=255);
00085
00088 explicit Color(guint32 pixel);
00089
00090
00091 explicit Color(const Glib::ustring& color);
00092
00093 void set_from_rgb(guint8 red, guint8 blue, guint8 green);
00094 void set_from_string(const Glib::ustring& color);
00095
00096
00102 Glib::ustring to_string() const;
00103
00110 void set_from_hls(float hue, float luminance, float saturation);
00111
00120 void to_hls(float& hue, float& luminance, float& saturation) const;
00121
00126 void set_from_pixel(guint32 pixel);
00127
00132 guint32 to_pixel() const;
00133
00134
00143 Color add(const Color& color) const;
00144
00145
00157 Color subtract(const Color& color) const;
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00176 void darken();
00177
00178
00184 void lighten();
00185
00186
00192 void shade(double shade);
00193
00194
00195
00196
00197 guint8 get_red() const;
00198 void set_red(const guint8& value);
00199 guint8 get_green() const;
00200 void set_green(const guint8& value);
00201 guint8 get_blue() const;
00202 void set_blue(const guint8& value);
00203 guint8 get_alpha() const;
00204 void set_alpha(const guint8& value);
00205
00206
00207 };
00208
00212 Color operator+(const Color& color1, const Color& color2);
00213
00217 Color operator-(const Color& color1, const Color& color2);
00218
00219 }
00220
00221
00222 namespace Clutter
00223 {
00224
00230 bool operator==(const Color& lhs, const Color& rhs);
00231
00237 bool operator!=(const Color& lhs, const Color& rhs);
00238
00239
00240 }
00241
00242
00243 namespace Clutter
00244 {
00245
00250 inline void swap(Color& lhs, Color& rhs)
00251 { lhs.swap(rhs); }
00252
00253 }
00254
00255 namespace Glib
00256 {
00257
00266 Clutter::Color wrap(ClutterColor* object, bool take_copy = false);
00267
00268 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00269 template <>
00270 class Value<Clutter::Color> : public Glib::Value_Boxed<Clutter::Color>
00271 {};
00272 #endif
00273
00274 }
00275
00276
00277 #endif
00278