This is the color libary for the control of the colors. With this libary you can control the RGB libary with color objects.
Diff: color.cpp
- Revision:
- 0:8625ec7a9a67
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/color.cpp Fri Dec 25 19:32:59 2015 +0000 @@ -0,0 +1,44 @@ +/** +*Dit is de klasse color + +*/ + +#include "color.h" + +Color::Color(int red, int green, int blue){ + this->red=red; + this->green=green; + this->blue=blue; + } + +Color::Color(float red, float green, float blue){ + this->red=(int) (red*255); + this->green=(int) (green*255); + this->blue=(int) (blue*255); + } + + Color::Color(int color){ //0xAABBCC + this->red=(color>>16) & 0x0000FF; + this->green=(color>>8) & 0x0000FF; + this->blue=(color>>0) & 0x0000FF; + } + +int Color::floatToColorValue(float value){ + return (int) (value*MAX_COLOR_VALUE); + } + +int Color::getRed(){ + return red; + } + +int Color::getGreen(){ + return green; + } + +int Color::getBlue(){ + return blue; + } + +int Color::getHex(){ + return (red <<16) + (green<<8) + (blue<<0); + } \ No newline at end of file