From eb7890cfe8ef5f564e594e79709e9174acf2afb0 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Wed, 31 Aug 2005 19:36:08 +0000 Subject: [PATCH] added alpha() method --- include/color.hpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/include/color.hpp b/include/color.hpp index 35a60fb7b..fc74b9bcb 100644 --- a/include/color.hpp +++ b/include/color.hpp @@ -31,9 +31,9 @@ namespace mapnik { Color() :rgba_(0xffffffff) {} - Color(int red,int green,int blue) - : rgba_(0xff<<24 | (blue&0xff) << 16 | (green&0xff) << 8 | red&0xff) {} - + Color(int red,int green,int blue,int alpha=0xff) + : rgba_((alpha&0xff) << 24 | (blue&0xff) << 16 | (green&0xff) << 8 | red&0xff) {} + explicit Color(int rgba) : rgba_(rgba) {} @@ -58,6 +58,12 @@ namespace mapnik { { return rgba_&0xff; } + + inline int alpha() const + { + return (rgba_>>24)&0xff; + } + inline int rgba() const { return rgba_;