mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Changed: Allow to parse HTML color format in CRGBA::stringToRGBA
This commit is contained in:
parent
eb762eaf08
commit
8ac0537b9b
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