mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +08:00
@@ -132,6 +132,17 @@ namespace BlackMisc
|
||||
return withHash ? u'#' % h : h;
|
||||
}
|
||||
|
||||
int CRgbColor::packed() const
|
||||
{
|
||||
if (!isValid()) { return 0; }
|
||||
return static_cast<int>(toQColor().rgb() & qRgba(255, 255, 255, 0));
|
||||
}
|
||||
|
||||
CRgbColor CRgbColor::fromPacked(int rgb)
|
||||
{
|
||||
return { qRed(rgb), qGreen(rgb), qBlue(rgb) };
|
||||
}
|
||||
|
||||
void CRgbColor::setByString(const QString &color, bool isName)
|
||||
{
|
||||
if (color.isEmpty()) { return; }
|
||||
|
||||
@@ -86,6 +86,12 @@ namespace BlackMisc
|
||||
//! Hex value
|
||||
QString hex(bool withHash = false) const;
|
||||
|
||||
//! Value packed in 24 bit integer
|
||||
int packed() const;
|
||||
|
||||
//! Construct from packed 24 bit integer value
|
||||
static CRgbColor fromPacked(int rgb);
|
||||
|
||||
//! Hex or color name
|
||||
void setByString(const QString &color, bool isName = false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user