From ac54a40ea26f43cc0051c71723d62f6aec6df920 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 3 Apr 2005 19:40:54 +0000 Subject: Added possibility to have an overlay with an alpha channel. svn-id: r17353 --- common/system.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'common/system.h') diff --git a/common/system.h b/common/system.h index 6ae8a659a4..39bfd1ee9e 100644 --- a/common/system.h +++ b/common/system.h @@ -332,6 +332,13 @@ public: virtual int overlayToScreenX(int x) { return x; } virtual int overlayToScreenY(int y) { return y; } + /** + * Return true if the overlay pixel format has an alpha channel. + */ + virtual bool hasAlpha() const { + return false; + } + /** * Convert the given RGB triplet into an OverlayColor. A OverlayColor can * be 8bit, 16bit or 32bit, depending on the target system. The default @@ -356,6 +363,29 @@ public: b = ((color&0x1F) << 3); } + /** + * Convert the given ARGB quadruplet into an OverlayColor. A OverlayColor can + * be 8bit, 16bit or 32bit, depending on the target system. The default + * implementation generates a 16 bit color value, in the 565 format + * (that is, 5 bits red, 6 bits green, 5 bits blue). + * @see colorToRGB + */ + virtual OverlayColor ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { + return RGBToColor(r, g, b); + } + + /** + * Convert the given OverlayColor into an ARGB quadruplet. An OverlayColor can + * be 8bit, 16bit or 32bit, depending on the target system. The default + * implementation takes a 16 bit color value and assumes it to be in 565 format + * (that is, 5 bits red, 6 bits green, 5 bits blue). + * @see RGBToColor + */ + virtual void colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { + colorToRGB(color, r, g, b); + a = 255; + } + //@} -- cgit v1.2.3