Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ColorLib.h
- Revision:
- 3:786b31c65e7a
- Parent:
- 2:cc8e091fd975
- Child:
- 6:5aff0da4b663
--- a/ColorLib.h Wed Jul 27 14:42:36 2016 +0000
+++ b/ColorLib.h Thu Jul 28 05:43:06 2016 +0000
@@ -89,13 +89,6 @@
blue = (b < 0) ? 0 : ((RGB_MAX_VAL < b) ? RGB_MAX_VAL : b);
}
- RGBColor(uint32_t rgb)
- {
- red = GetRValue(rgb);
- green = GetGValue(rgb);
- blue = GetBValue(rgb);
- }
-
RGBColor(int rgb)
{
red = GetRValue(rgb);
@@ -136,14 +129,6 @@
return *this;
}
- RGBColor& operator= (const uint32_t rgb)
- {
- red = GetRValue(rgb);
- green = GetGValue(rgb);
- blue = GetBValue(rgb);
- return *this;
- }
-
RGBColor& operator= (const int rgb)
{
red = GetRValue(rgb);
@@ -152,15 +137,11 @@
return *this;
}
- operator uint32_t()
+ operator int()
{
return COLORREF(red, green, blue);
}
- operator int()
- {
- return COLORREF(red, green, blue);
- }
};
//----------------------------------------------------------------------------
@@ -205,7 +186,7 @@
@param s - the sat byte
@param v - the val byte
*/
- HSVColor(int h, int s = HSV_MAX_SAT, int v = HSV_MAX_VAL)
+ HSVColor(int h, int s, int v)
{
hue = nomalize_hue(h);
sat = (s < 0) ? 0 : ((HSV_MAX_SAT < s) ? HSV_MAX_SAT : s);
@@ -224,6 +205,12 @@
rgb2hsv(rgb, *this);
}
+ HSVColor(int rgbcolor)
+ {
+ RGBColor rgb(rgbcolor);
+ rgb2hsv(rgb, *this);
+ }
+
/**
Default constructor
*/
@@ -252,6 +239,19 @@
return *this;
}
+ HSVColor& operator= (const int& rhs)
+ {
+ RGBColor rgb(rhs);
+ rgb2hsv(rhs, *this);
+ return *this;
+ }
+
+ operator int()
+ {
+ RGBColor rgb(*this);
+ return (int)rgb;
+ }
+
};
//----------------------------------------------------------------------------