mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Changed: Allow to parse HTML color format in CRGBA::stringToRGBA
--HG-- branch : develop
This commit is contained in:
parent
dde8fd723a
commit
88d345e857
1 changed files with 11 additions and 0 deletions
|
@ -748,6 +748,17 @@ CRGBA CRGBA::stringToRGBA( const char *ptr )
|
||||||
|
|
||||||
return CRGBA( r,g,b,a );
|
return CRGBA( r,g,b,a );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we need at least 3 hexadecimal values to consider string is valid
|
||||||
|
if (sscanf(ptr, "#%02x%02x%02x%02x", &r, &g, &b, &a) >= 3)
|
||||||
|
{
|
||||||
|
clamp(r, 0, 255);
|
||||||
|
clamp(g, 0, 255);
|
||||||
|
clamp(b, 0, 255);
|
||||||
|
clamp(a, 0, 255);
|
||||||
|
|
||||||
|
return CRGBA(r, g, b, a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NLMISC::CRGBA::White;
|
return NLMISC::CRGBA::White;
|
||||||
|
|
Loading…
Reference in a new issue