⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wg_color.h

📁 一个小巧的嵌入式图形系统wGUI, 可以用VC编译
💻 H
字号:
// wg_color.h//// CRGBColor class interface////// Copyright (c) 2002 Rob Wiskow// rob-dev@boxedchaos.com//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.//// This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU// Lesser General Public License for more details.//// You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//#ifndef _WG_COLOR_H_#define _WG_COLOR_H_#include "SDL.h"namespace wGui{//! The CRGBColor class is used for all wGui representations of colorclass CRGBColor{public:	unsigned char red;  //!< Red component of the color	unsigned char green;  //!< Green component of the color	unsigned char blue;  //!< Blue component of the color	unsigned char alpha;  //!< Alpha component (or opacity) of the color	//! Construct a new color object	//! \param r Red component value	//! \param b Blue component value	//! \param g Green component value	//! \param a Alpha value, default value of 0xFF (fully opaque)	CRGBColor(const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a = 0xFF) :		red(r), green(g), blue(b), alpha(a) { }	//! Construct a CRGBColor object from an SDL Color	//! \param pColorValue A pointer to the SDL Color	//! \param pFormat A pointer to the SDL Pixel Format	CRGBColor(const Uint32* pColorValue, const SDL_PixelFormat* pFormat);	//! Convert the color so an SDL Color	//! \param pFormat A pointer to the SDL Pixel Format	unsigned long int SDLColor(SDL_PixelFormat* pFormat) const		{ return SDL_MapRGBA(pFormat, red, green, blue, alpha); }	//! Comparison operator does not take into account alpha values	//! \return true if the Red, Green, and Blue color components are the same	bool operator==(const CRGBColor& c) const	{		return (red == c.red && green == c.green && blue == c.blue);	}	//! Inequality operator does not take into accoutn alpha values	//! \return true if any of the Red, Green, or Blue color components differ	bool operator!=(const CRGBColor& c) const	{		return (red != c.red || green != c.green || blue != c.blue);	}	//! Assignment operator	CRGBColor& operator=(const CRGBColor& c);	//! Does standard color mixing	CRGBColor operator+(const CRGBColor& c) const;	//! Does OR color mixing	CRGBColor operator|(const CRGBColor& c) const;	//! Does AND color mixing	CRGBColor operator&(const CRGBColor& c) const;	//! Does XOR color mixing	CRGBColor operator^(const CRGBColor& c) const;};// Predefined colorsextern CRGBColor DEFAULT_BG_COLOR;extern CRGBColor DEFAULT_FG_COLOR;extern CRGBColor DEFAULT_LINE_COLOR;extern CRGBColor DEFAULT_DISABLED_LINE_COLOR;extern CRGBColor COLOR_TRANSPARENT;extern CRGBColor COLOR_WHITE;extern CRGBColor COLOR_LIGHTGRAY;extern CRGBColor COLOR_GRAY;extern CRGBColor COLOR_DARKGRAY;extern CRGBColor COLOR_BLACK;extern CRGBColor COLOR_BLUE;extern CRGBColor COLOR_RED;extern CRGBColor COLOR_GREEN;extern CRGBColor COLOR_YELLOW;}#endif // _WG_COLOR_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -