j
Dependencies: mbed yeswecancoap C12832 LM75B
lib/Color.cpp
- Committer:
- arnedesmet
- Date:
- 2015-10-23
- Revision:
- 0:92d2ef9f009d
- Child:
- 1:92958e26bf2e
File content as of revision 0:92d2ef9f009d:
#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 = floatToColorValue(red); this->green = floatToColorValue(green); this->blue = floatToColorValue(blue); } int Color::floatToColorValue(float value){ return (int) (value * MAX_COLOR_VALUE); } Color::Color(int Color){ //AABBCC red = (Color >> 16) & 0x0000FF; green = (Color >> 8) & 0x0000FF; blue = Color & 0x0000FF; } int Color::getHex(){ return (red >> 16) + (green >> 8) + (blue >> 0); //verander shift register } int Color::getRed(){ return red; } int Color::getGreen(){ return green; } int Color::getBlue(){ return blue; }