added inverse function to calculate the inverse colour of an SDL_Color

This commit is contained in:
Jon Daniel 2005-03-01 20:42:52 +00:00
parent d2da3cf242
commit 202d59e3d7
2 changed files with 9 additions and 0 deletions

View file

@ -850,6 +850,14 @@ bool operator!=(const SDL_Color& a, const SDL_Color& b) {
return !operator==(a,b);
}
SDL_Color inverse(const SDL_Color& colour) {
SDL_Color inverse;
inverse.r = 255 - colour.r;
inverse.g = 255 - colour.g;
inverse.b = 255 - colour.b;
return inverse;
}
void pixel_data::read(const config& cfg) {
const std::string& red = cfg["red"];
const std::string& green = cfg["green"];

View file

@ -124,6 +124,7 @@ bool operator==(const SDL_Rect& a, const SDL_Rect& b);
bool operator!=(const SDL_Rect& a, const SDL_Rect& b);
bool operator==(const SDL_Color& a, const SDL_Color& b);
bool operator!=(const SDL_Color& a, const SDL_Color& b);
SDL_Color inverse(const SDL_Color& colour);
class config; // no need to include config.hpp