add debug function for graphics::Color

This commit is contained in:
Kirill Zhdanovich 2013-11-19 14:11:27 +03:00 committed by Alex Zolotarev
parent c0f8d299f5
commit 9f40dca617

View file

@ -1,6 +1,8 @@
#pragma once
#include "../std/stdint.hpp"
#include "../std/string.hpp"
#include "../std/sstream.hpp"
namespace graphics
{
@ -34,4 +36,14 @@ namespace graphics
inline int greenFromARGB(uint32_t c) {return (c >> 8) & 0xFF; }
inline int blueFromARGB(uint32_t c) {return (c & 0xFF); }
inline int alphaFromARGB(uint32_t c) {return (c >> 24) & 0xFF;}
string DebugPrint(Color const & c)
{
ostringstream os;
os << "r: " << (int)c.r << " ";
os << "g: " << (int)c.g << " ";
os << "b: " << (int)c.b << " ";
os << "alpha: " << (int)c.a;
return os.str();
}
}