mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:40:05 +00:00
Draw alert boxes using colors from settings
This commit is contained in:
parent
3289f98638
commit
14f825d896
3 changed files with 34 additions and 15 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include <scwx/qt/util/color.hpp>
|
||||
|
||||
#include <format>
|
||||
#include <QColor>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
|
|
@ -19,6 +20,15 @@ std::string ToArgbString(const boost::gil::rgba8_pixel_t& color)
|
|||
"#{:02x}{:02x}{:02x}{:02x}", color[3], color[0], color[1], color[2]);
|
||||
}
|
||||
|
||||
boost::gil::rgba8_pixel_t ToRgba8PixelT(const std::string& argbString)
|
||||
{
|
||||
QRgb color = QColor(QString::fromStdString(argbString)).rgba();
|
||||
return boost::gil::rgba8_pixel_t {static_cast<uint8_t>(qRed(color)),
|
||||
static_cast<uint8_t>(qGreen(color)),
|
||||
static_cast<uint8_t>(qBlue(color)),
|
||||
static_cast<uint8_t>(qAlpha(color))};
|
||||
}
|
||||
|
||||
} // namespace color
|
||||
} // namespace util
|
||||
} // namespace qt
|
||||
|
|
|
|||
|
|
@ -11,8 +11,24 @@ namespace util
|
|||
namespace color
|
||||
{
|
||||
|
||||
/**
|
||||
* Converts a Boost.GIL 8-bit RGBA pixel to an ARGB string used by Qt libraries.
|
||||
*
|
||||
* @param color RGBA8 pixel
|
||||
*
|
||||
* @return ARGB string in the format #AARRGGBB
|
||||
*/
|
||||
std::string ToArgbString(const boost::gil::rgba8_pixel_t& color);
|
||||
|
||||
/**
|
||||
* Converts an ARGB string used by Qt libraries to a Boost.GIL 8-bit RGBA pixel.
|
||||
*
|
||||
* @param argbString ARGB string in the format #AARRGGBB
|
||||
*
|
||||
* @return RGBA8 pixel
|
||||
*/
|
||||
boost::gil::rgba8_pixel_t ToRgba8PixelT(const std::string& argbString);
|
||||
|
||||
} // namespace color
|
||||
} // namespace util
|
||||
} // namespace qt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue