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
00101 Glib::ustring to_string() const;
00102
00109 void set_from_hls(guint8 hue, guint8 luminance, guint8 saturation);
00110
00117 void set_from_hlsx(Fixed hue, Fixed luminance, Fixed saturation);
00118
00125 void to_hls(guint8& hue, guint8& luminance, guint8& saturation) const;
00126
00133 void to_hlsx(Fixed& hue, Fixed& luminance, Fixed& saturation) const;
00134
00139 void set_from_pixel(guint32 pixel);
00140
00145 guint32 to_pixel() const;
00146
00147
00157 Color add(const Color& color) const;
00158
00159
00171 Color subtract(const Color& color) const;
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00190 void darken();
00191
00192
00198 void lighten();
00199
00200
00207 void shade(double shade);
00208
00209
00220 void shadex(Fixed shade);
00221
00222
00223
00224
00225 guint8 get_red() const;
00226 void set_red(const guint8& value);
00227 guint8 get_green() const;
00228 void set_green(const guint8& value);
00229 guint8 get_blue() const;
00230 void set_blue(const guint8& value);
00231 guint8 get_alpha() const;
00232 void set_alpha(const guint8& value);
00233
00234
00235 };
00236
00240 Color operator+(const Color& color1, const Color& color2);
00241
00245 Color operator-(const Color& color1, const Color& color2);
00246
00247 }
00248
00249
00250 namespace Clutter
00251 {
00252
00258 bool operator==(const Color& lhs, const Color& rhs);
00259
00265 bool operator!=(const Color& lhs, const Color& rhs);
00266
00267
00268 }
00269
00270
00271 namespace Clutter
00272 {
00273
00278 inline void swap(Color& lhs, Color& rhs)
00279 { lhs.swap(rhs); }
00280
00281 }
00282
00283 namespace Glib
00284 {
00285
00294 Clutter::Color wrap(ClutterColor* object, bool take_copy = false);
00295
00296 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00297 template <>
00298 class Value<Clutter::Color> : public Glib::Value_Boxed<Clutter::Color>
00299 {};
00300 #endif
00301
00302 }
00303
00304
00305 #endif
00306