summaryrefslogtreecommitdiff
path: root/glcdgraphics
diff options
context:
space:
mode:
Diffstat (limited to 'glcdgraphics')
-rw-r--r--glcdgraphics/bitmap.c20
-rw-r--r--glcdgraphics/bitmap.h30
2 files changed, 31 insertions, 19 deletions
diff --git a/glcdgraphics/bitmap.c b/glcdgraphics/bitmap.c
index 0ab27b6..b96fe6d 100644
--- a/glcdgraphics/bitmap.c
+++ b/glcdgraphics/bitmap.c
@@ -27,6 +27,17 @@
namespace GLCD
{
+const uint32_t cColor::Black = GRAPHLCD_Black;
+const uint32_t cColor::White = GRAPHLCD_White;
+const uint32_t cColor::Red = 0xFFFF0000;
+const uint32_t cColor::Green = 0xFF00FF00;
+const uint32_t cColor::Blue = 0xFF0000FF;
+const uint32_t cColor::Magenta = 0xFFFF00FF;
+const uint32_t cColor::Cyan = 0xFF00FFFF;
+const uint32_t cColor::Yellow = 0xFFFFFF00;
+const uint32_t cColor::Transparent = GRAPHLCD_Transparent;
+const uint32_t cColor::ERRCOL = GRAPHLCD_ERRCOL;
+
cColor cColor::ParseColor(std::string col) {
if (col == "black") return cColor(cColor::Black);
@@ -61,6 +72,15 @@ cColor cColor::Invert(void)
return cColor( (uint32_t)(color ^ 0x00FFFFFF) ) ;
}
+uint32_t cColor::AlignAlpha (uint32_t col) {
+ switch (col) {
+ case Transparent:
+ case ERRCOL:
+ return col;
+ default:
+ return (col & 0xFF000000) ? col : (col | 0xFF000000);
+ }
+}
const unsigned char bitmask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
const unsigned char bitmaskl[8] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff};
diff --git a/glcdgraphics/bitmap.h b/glcdgraphics/bitmap.h
index c3442e2..5710a78 100644
--- a/glcdgraphics/bitmap.h
+++ b/glcdgraphics/bitmap.h
@@ -60,16 +60,16 @@ public:
cColor(uint32_t col) { color = col; }
cColor(const cColor & col) { color = col.color; }
- static const uint32_t Black = GRAPHLCD_Black;
- static const uint32_t White = GRAPHLCD_White;
- static const uint32_t Red = 0xFFFF0000;
- static const uint32_t Green = 0xFF00FF00;
- static const uint32_t Blue = 0xFF0000FF;
- static const uint32_t Magenta = 0xFFFF00FF;
- static const uint32_t Cyan = 0xFF00FFFF;
- static const uint32_t Yellow = 0xFFFFFF00;
- static const uint32_t Transparent = GRAPHLCD_Transparent;
- static const uint32_t ERRCOL = GRAPHLCD_ERRCOL;
+ static const uint32_t Black;
+ static const uint32_t White;
+ static const uint32_t Red;
+ static const uint32_t Green;
+ static const uint32_t Blue;
+ static const uint32_t Magenta;
+ static const uint32_t Cyan;
+ static const uint32_t Yellow;
+ static const uint32_t Transparent;
+ static const uint32_t ERRCOL;
uint32_t GetColor (void) { return color; }
void SetColor (uint32_t col) { color = col; }
@@ -79,15 +79,7 @@ public:
operator uint32_t(void) { return GetColor(); }
static cColor ParseColor (std::string col);
- static uint32_t AlignAlpha (uint32_t col) {
- switch (col) {
- case Transparent:
- case ERRCOL:
- return col;
- default:
- return (col & 0xFF000000) ? col : (col | 0xFF000000);
- }
- }
+ static uint32_t AlignAlpha (uint32_t col);
};