diff options
author | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-24 21:21:52 +0200 |
---|---|---|
committer | mrwastl <mrwastl@users.sourceforge.net> | 2011-05-24 21:21:52 +0200 |
commit | 84efb00f6b7b30ddbfd0551aae3130e86c90562c (patch) | |
tree | 489c4e9e4ff9ae8466caf522cfdaef58efda019b /glcdgraphics/bitmap.h | |
parent | 38bea28bf1f88a45f2ada8b7f1c95cd5ea89a6bc (diff) | |
download | graphlcd-base-84efb00f6b7b30ddbfd0551aae3130e86c90562c.tar.gz graphlcd-base-84efb00f6b7b30ddbfd0551aae3130e86c90562c.tar.bz2 |
support for transparency (images and text); text and images are transparent per default; bug fix: crash when allocing bitmap object with width=0
Diffstat (limited to 'glcdgraphics/bitmap.h')
-rw-r--r-- | glcdgraphics/bitmap.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/glcdgraphics/bitmap.h b/glcdgraphics/bitmap.h index 7f17e51..0528441 100644 --- a/glcdgraphics/bitmap.h +++ b/glcdgraphics/bitmap.h @@ -71,7 +71,15 @@ public: operator uint32_t(void) { return GetColor(); } static cColor ParseColor (std::string col); - static uint32_t AlignAlpha (uint32_t col) { return (col & 0xFF000000) ? col : (col | 0xFF000000); } + static uint32_t AlignAlpha (uint32_t col) { + switch (col) { + case Transparent: + case ERRCOL: + return col; + default: + return (col & 0xFF000000) ? col : (col | 0xFF000000); + } + } }; |