www.pudn.com > Ì廿֯Âë.rar > color.h, change:2001-12-13,size:1359b
#ifndef __color_h__
#define __color_h__
#pragma pack(1)
//! byte rgba color
struct rgba
{
unsigned char r,g,b,a;
};
#pragma pack()
//! floating point rgba color
struct rgbaf
{
float r,g,b,a;
};
/*! component wise scalar multiplication
* \param c1 color
* \param s scalar value to be multiplied with the color c1
* \return result of multiplication
*/
rgbaf operator * (rgbaf c1, float s);
/*! component wise addition
* \param c1 first color
* \param c2 second coloor
* \return result of addition
*/
rgbaf operator + (rgbaf c1, rgbaf c2);
/*! converts byte color to float color
* \param c color
* \return converted color
*/
rgbaf rgba2rgbaf(rgba c);
/*! converts float color to byte color
* \param c color
* \return converted color
*/
rgba rgbaf2rgba(rgbaf c);
/*! sets color to black
* \param c color
*/
void black(rgba &color);
/*! sets color to white
* \param c color
*/
void white(rgba &color);
/*! sets color to gray
* \param c color
* \param i intensity value
*/
void gray(rgba &color, unsigned char i);
/*! sets color to any color
* \param c color
* \param r red component of color
* \param g green component of color
* \param b blue component of color
*/
void anycolor(rgba &color, unsigned char r, unsigned char g, unsigned char b);
#endif