7 #include "fwDataTools/Color.hpp" 9 #include <fwCore/exceptionmacros.hpp> 22 "Color string should start with '#' and followed by 6 ou 8 " 23 "hexadecimal digits. Given color : " + _hexaColor,
25 || ( _hexaColor.length() != 7 && _hexaColor.length() != 9)
28 std::string redString = _hexaColor.substr(1, 2);
29 std::string greenString = _hexaColor.substr(3, 2);
30 std::string blueString = _hexaColor.substr(5, 2);
33 std::istringstream iss;
37 iss.str (greenString);
44 if (_hexaColor.length() == 9)
46 std::string alphaString = _hexaColor.substr(7, 2);
48 iss.str (alphaString);
52 _rgba[0] =
static_cast< std::uint8_t
>(r);
53 _rgba[1] =
static_cast< std::uint8_t
>(g);
54 _rgba[2] =
static_cast< std::uint8_t
>(b);
55 _rgba[3] =
static_cast< std::uint8_t
>(a);
This file defines SpyLog macros. These macros are used to log messages to a file or to the console du...