[cluttermm] Color class updated with new methods and the StaticColor enum.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Color class updated with new methods and the StaticColor enum.
- Date: Wed, 26 Mar 2014 09:23:35 +0000 (UTC)
commit 50b58b9cef72ef0e4fcc46181d3312114ed96c46
Author: Ian Martin <martin_id vodafone co nz>
Date: Wed Mar 26 14:57:49 2014 +1300
Color class updated with new methods and the StaticColor enum.
clutter/src/color.ccg | 12 ++++++++++--
clutter/src/color.hg | 22 +++++++++++++++++-----
codegen/m4/convert_clutter.m4 | 2 ++
3 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/clutter/src/color.ccg b/clutter/src/color.ccg
index 23012a5..b916ba7 100644
--- a/clutter/src/color.ccg
+++ b/clutter/src/color.ccg
@@ -53,6 +53,16 @@ Color::Color(guint32 pixel)
set_from_pixel(pixel);
}
+Color::Color(StaticColor color)
+{
+ //ClutterColor tmp = { 0, 0, 0, 255 };
+ ClutterStaticColor c= static_cast<ClutterStaticColor> (color);
+ const ClutterColor* tmp = clutter_color_get_static(c);
+ // that obtained a const colour;
+ gobject_ = clutter_color_copy(tmp);
+
+}
+
void Color::set_from_string(const Glib::ustring& color)
{
clutter_color_from_string(this->gobj(), color.c_str());
@@ -107,5 +117,3 @@ Color operator-(const Color& color1, const Color& color2)
}
} //namespace Clutter
-
-
diff --git a/clutter/src/color.hg b/clutter/src/color.hg
index 1b33dd7..e6b3369 100644
--- a/clutter/src/color.hg
+++ b/clutter/src/color.hg
@@ -17,17 +17,21 @@
#include <glibmm/ustring.h>
#include <cluttermm/types.h>
-
+
_DEFS(cluttermm,clutter)
namespace Clutter
{
+_WRAP_ENUM(StaticColor, ClutterStaticColor)
+
class Color
{
_CLASS_BOXEDTYPE(Color, ClutterColor, NONE, clutter_color_copy, clutter_color_free)
_IGNORE(clutter_color_copy)
_IGNORE(clutter_color_free)
+ _IGNORE(clutter_color_alloc, clutter_color_node_new, clutter_color_init)
+
public:
@@ -48,6 +52,10 @@ public:
// TODO: this could fail, just return a 'default' color or throw an exception?
explicit Color(const Glib::ustring& color);
+#m4 _CONVERSION(`StaticColor',`ClutterStaticColor',`($2)($3)')
+#m4 _INITIALIZATION(`Clutter::StaticColor',`ClutterStaticColor',`($2)($3)')
+
+ explicit Color(StaticColor color);
void set_from_rgb(guint8 red, guint8 blue, guint8 green);
void set_from_string(const Glib::ustring& color);
@@ -87,6 +95,13 @@ public:
void shade(double shade);
_IGNORE(clutter_color_shade)
+ #m4 _INITIALIZATION(`Glib::RefPtr<Color>',`ClutterColor',`&($3).gobj()')
+ #m4 _INITIALIZATION(`Color&',`ClutterColor',`($2)')
+ _WRAP_METHOD(void interpolate(const Color& final, double progress, Color& result),
clutter_color_interpolate)
+
+ //TODO IM: ParamSpec. 'nuff said. Not wrapped until I have to.
+ _IGNORE(clutter_param_spec_color, clutter_value_set_color, clutter_value_get_color)
+
// provide accessors/mutators to modify the individual members like you could
// do in C by directly modifying the struct members
_MEMBER_GET(red, red, guint8, guint8)
@@ -98,10 +113,8 @@ public:
_MEMBER_GET(alpha, alpha, guint8, guint8)
_MEMBER_SET(alpha, alpha, guint8, guint8)
-#m4begin
+
_WRAP_EQUAL(clutter_color_equal)
-#m4end
- _IGNORE(clutter_color_equal)
};
/** @relates Clutter::Color
@@ -115,4 +128,3 @@ Color operator+(const Color& color1, const Color& color2);
Color operator-(const Color& color1, const Color& color2);
} // namespace Clutter
-
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index d523fc2..e294447 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -38,6 +38,8 @@ _CONVERSION(`Glib::RefPtr<ChildMeta>',`ClutterChildMeta*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`ClutterChildMeta*',`Glib::RefPtr<ChildMeta>',`Glib::wrap($3)')
_CONVERSION(`ClutterChildMeta*',`Glib::RefPtr<const ChildMeta>',`Glib::wrap($3)')
+_CONVERSION(`Color',`ClutterColor*',`($3).gobj()')
+_CONVERSION(`Color&',`ClutterColor*',`($3).gobj()')
_CONVERSION(`const Color&',`ClutterColor*',`($3).gobj()')
_CONVERSION(`const Color&',`const ClutterColor*',`($3).gobj()')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]