|
|
@ -734,11 +734,13 @@ void CRGBA::buildFromHLS(float h, float l, float s)
|
|
|
|
|
|
|
|
|
|
|
|
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
|
|
|
CRGBA CRGBA::stringToRGBA( const char *ptr )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!ptr)
|
|
|
|
if (ptr)
|
|
|
|
return NLMISC::CRGBA::White;
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
int r = 255, g = 255, b = 255, a = 255;
|
|
|
|
int r = 255, g = 255, b = 255, a = 255;
|
|
|
|
sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a );
|
|
|
|
|
|
|
|
|
|
|
|
// we need at least 3 integer values to consider string is valid
|
|
|
|
|
|
|
|
if (sscanf( ptr, "%d %d %d %d", &r, &g, &b, &a ) >= 3)
|
|
|
|
|
|
|
|
{
|
|
|
|
clamp( r, 0, 255 );
|
|
|
|
clamp( r, 0, 255 );
|
|
|
|
clamp( g, 0, 255 );
|
|
|
|
clamp( g, 0, 255 );
|
|
|
|
clamp( b, 0, 255 );
|
|
|
|
clamp( b, 0, 255 );
|
|
|
@ -746,6 +748,10 @@ CRGBA CRGBA::stringToRGBA( const char *ptr )
|
|
|
|
|
|
|
|
|
|
|
|
return CRGBA( r,g,b,a );
|
|
|
|
return CRGBA( r,g,b,a );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return NLMISC::CRGBA::White;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string CRGBA::toString() const
|
|
|
|
std::string CRGBA::toString() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|