[gtkmm] Gdk::Color: Rename the setters and getters.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gdk::Color: Rename the setters and getters.
- Date: Wed, 8 Dec 2010 10:11:27 +0000 (UTC)
commit 266fbe8f149f051215bacf35b0660d2f3a62960a
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Dec 8 11:03:56 2010 +0100
Gdk::Color: Rename the setters and getters.
* gdk/src/rgba.[hg|ccg]: Rename set/get_*_p(double) to set/get_*(), without
the _p, because GdkRGBA uses doubles, though GdkColor used gushort.
Rename set/get_*(gushort) (without the _p) to set/get_*_u(), as a convenience,
particularly for older code that used Gdk::Color.
ChangeLog | 9 +++++++++
gdk/src/rgba.ccg | 48 ++++++++++++++++++++++++------------------------
gdk/src/rgba.hg | 32 ++++++++++++++++----------------
3 files changed, 49 insertions(+), 40 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fe2bda6..18beba7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-12-08 Murray Cumming <murrayc murrayc com>
+
+ Gdk::Color: Rename the setters and getters.
+
+ * gdk/src/rgba.[hg|ccg]: Rename set/get_*_p(double) to set/get_*(), without
+ the _p, because GdkRGBA uses doubles, though GdkColor used gushort.
+ Rename set/get_*(gushort) (without the _p) to set/get_*_u(), as a convenience,
+ particularly for older code that used Gdk::Color.
+
2010-12-07 Murray Cumming <murrayc murrayc com>
StyleContext: Add render_*() methods.
diff --git a/gdk/src/rgba.ccg b/gdk/src/rgba.ccg
index 2db4430..f2d832e 100644
--- a/gdk/src/rgba.ccg
+++ b/gdk/src/rgba.ccg
@@ -38,19 +38,19 @@ RGBA::RGBA(const Glib::ustring& value)
set(value);
}
-void RGBA::set_grey(gushort value, gushort alpha)
+void RGBA::set_grey_u(gushort value, gushort alpha)
{
gobject_->red = gobject_->green = gobject_->blue = (value / MULTIPLIER);
gobject_->alpha = alpha / MULTIPLIER;
}
-void RGBA::set_grey_p(double g, double alpha)
+void RGBA::set_grey(double g, double alpha)
{
gobject_->red = gobject_->green = gobject_->blue = g;
gobject_->alpha = alpha;
}
-void RGBA::set_rgba(gushort red_, gushort green_, gushort blue_, gushort alpha_)
+void RGBA::set_rgba_u(gushort red_, gushort green_, gushort blue_, gushort alpha_)
{
gobject_->red = red_ / MULTIPLIER;
gobject_->green = green_/ MULTIPLIER;
@@ -58,7 +58,7 @@ void RGBA::set_rgba(gushort red_, gushort green_, gushort blue_, gushort alpha_)
gobject_->alpha = alpha_/ MULTIPLIER;
}
-void RGBA::set_rgba_p(double red_, double green_, double blue_, double alpha_)
+void RGBA::set_rgba(double red_, double green_, double blue_, double alpha_)
{
gobject_->red = red_;
gobject_->green = green_;
@@ -79,22 +79,22 @@ void RGBA::set_hsv(double h, double s, double v)
switch(i)
{
case 0:
- set_rgba_p(v, t, p);
+ set_rgba(v, t, p);
break;
case 1:
- set_rgba_p(q, v, p);
+ set_rgba(q, v, p);
break;
case 2:
- set_rgba_p(p, v, t);
+ set_rgba(p, v, t);
break;
case 3:
- set_rgba_p(p, q, v);
+ set_rgba(p, q, v);
break;
case 4:
- set_rgba_p(t, p, v);
+ set_rgba(t, p, v);
break;
default:
- set_rgba_p(v, p, q);
+ set_rgba(v, p, q);
}
}
@@ -103,7 +103,7 @@ void RGBA::set_hsl(double h, double s, double l)
//TODO: Comments/Documentation. I have no idea what this code does. murrayc.
if(s == 0.0)
- set_grey_p(l);
+ set_grey(l);
else
{
double t2 = (l < 0.5) ? l * (1.0 + s) : l + s - l * s;
@@ -138,68 +138,68 @@ void RGBA::set_hsl(double h, double s, double l)
else if (tb < 2.0/3.0)
b = t1+(t2-t1)*(2.0/3.0 - tb) * 6.0;
- set_rgba_p(r, g, b);
+ set_rgba(r, g, b);
}
}
-gushort RGBA::get_red() const
+gushort RGBA::get_red_u() const
{
return gobject_->red * MULTIPLIER;
}
-gushort RGBA::get_green() const
+gushort RGBA::get_green_u() const
{
return gobject_->green * MULTIPLIER;
}
-gushort RGBA::get_blue() const
+gushort RGBA::get_blue_u() const
{
return gobject_->blue * MULTIPLIER;
}
-gushort RGBA::get_alpha() const
+gushort RGBA::get_alpha_u() const
{
return gobject_->alpha * MULTIPLIER;
}
-void RGBA::set_red(gushort value)
+void RGBA::set_red_u(gushort value)
{
gobject_->red = value / MULTIPLIER;
}
-void RGBA::set_green(gushort value)
+void RGBA::set_green_u(gushort value)
{
gobject_->green = value / MULTIPLIER;
}
-void RGBA::set_blue(gushort value)
+void RGBA::set_blue_u(gushort value)
{
gobject_->blue = value / MULTIPLIER;
}
-void RGBA::set_alpha(gushort value)
+void RGBA::set_alpha_u(gushort value)
{
gobject_->alpha = value / MULTIPLIER;
}
-double RGBA::get_red_p() const
+double RGBA::get_red() const
{
return gobject_->red;
}
-double RGBA::get_green_p() const
+double RGBA::get_green() const
{
return gobject_->green;
}
-double RGBA::get_blue_p() const
+double RGBA::get_blue() const
{
return gobject_->blue;
}
-double RGBA::get_alpha_p() const
+double RGBA::get_alpha() const
{
return gobject_->alpha;
}
diff --git a/gdk/src/rgba.hg b/gdk/src/rgba.hg
index 3f5f585..ad201dd 100644
--- a/gdk/src/rgba.hg
+++ b/gdk/src/rgba.hg
@@ -47,22 +47,22 @@ public:
/** Set a grey color, by using the same value for all color components.
* @param value The value to be used for the red, green, and blue components.
*/
- void set_grey(gushort value, gushort alpha = 1);
- void set_grey_p(double g, double alpha = 65535.0);
+ void set_grey_u(gushort value, gushort alpha = 1);
+ void set_grey(double g, double alpha = 65535.0);
/** Set the color, by specifying red, green, and blue color component values.
* @param red_ The red component of the color.
* @param green_ The green component of the color.
* @param blue_ The blue component of the color.
*/
- void set_rgba(gushort red_, gushort green_, gushort blue_, gushort alpha_ = 65535.0);
+ void set_rgba_u(gushort red_, gushort green_, gushort blue_, gushort alpha_ = 65535.0);
/** Set the color, by specifying red, green, and blue color component values, as percentages.
* @param red_ The red component of the color, as a percentage.
* @param green_ The green component of the color, as a percentage.
* @param blue_ The blue component of the color, as a percentage.
*/
- void set_rgba_p(double red_, double green_, double blue_, double alpha_ = 1);
+ void set_rgba(double red_, double green_, double blue_, double alpha_ = 1);
//TODO: Add alpha parameter?
void set_hsv(double h, double s, double v);
@@ -73,63 +73,63 @@ public:
/** Get the red component of the color.
* @result The red component of the color.
*/
- gushort get_red() const;
+ gushort get_red_u() const;
/** Get the green component of the color.
* @result The green component of the color.
*/
- gushort get_green() const;
+ gushort get_green_u() const;
/** Get the blue component of the color.
* @result The blue component of the color.
*/
- gushort get_blue() const;
+ gushort get_blue_u() const;
/** Get the alpha component of the color.
* @result The alpha component of the color.
*/
- gushort get_alpha() const;
+ gushort get_alpha_u() const;
/** Set the red component of the color.
* @param value The red component of the color.
*/
- void set_red(gushort value);
+ void set_red_u(gushort value);
/** Set the green component of the color.
* @param value The green component of the color.
*/
- void set_green(gushort value);
+ void set_green_u(gushort value);
/** Set the blue component of the color.
* @param value The blue component of the color.
*/
- void set_blue(gushort value);
+ void set_blue_u(gushort value);
/** Set the alpha component of the color.
* @param value The alpha component of the color.
*/
- void set_alpha(gushort value);
+ void set_alpha_u(gushort value);
/** Get the red component of the color, as a percentage.
* @result The red component of the color, as a percentage.
*/
- double get_red_p() const;
+ double get_red() const;
/** Get the green component of the color, as a percentage.
* @result The green component of the color, as a percentage.
*/
- double get_green_p() const;
+ double get_green() const;
/** Get the blue component of the color, as a percentage.
* @result The blue component of the color, as a percentage.
*/
- double get_blue_p() const;
+ double get_blue() const;
/** Get the alpha component of the color, as a percentage.
* @result The alpha component of the color, as a percentage.
*/
- double get_alpha_p() const;
+ double get_alpha() const;
_WRAP_METHOD(Glib::ustring to_string() const, gdk_rgba_to_string)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]