MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / fromName

Method fromName

src/Core/Graphics/Color.cpp:272–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270 }
271
272 bool Color::fromName(std::string name, bool strict)
273 {
274 std::for_each(name.begin(), name.end(), [](char& c) { c = std::tolower(c); });
275 if (const auto& color = ColorNames.find(name); color != ColorNames.end())
276 {
277 this->r = color->second.r;
278 this->g = color->second.g;
279 this->b = color->second.b;
280 this->a = color->second.a;
281 return true;
282 }
283 if (!strict)
284 return false;
285 throw Exceptions::InvalidColorName(name, EXC_INFO);
286 }
287
288 void Color::fromRgb(const double r, const double g, const double b, const double a)
289 {

Callers 2

fromStringMethod · 0.95
LoadClassColorFunction · 0.80

Calls 5

for_eachFunction · 0.85
InvalidColorNameClass · 0.85
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected