Base: Move App::Color to Base
Every basic data type is stored in Base module, color is standing out as one that does not. Moving it to Base opens possibilities to integrate it better with the rest of FreeCAD.
This commit is contained in:
@@ -46,24 +46,24 @@ FC_LOG_LEVEL_INIT("Import", true, true)
|
||||
|
||||
using namespace Import;
|
||||
|
||||
App::Color Tools::convertColor(const Quantity_ColorRGBA& rgba)
|
||||
Base::Color Tools::convertColor(const Quantity_ColorRGBA& rgba)
|
||||
{
|
||||
Standard_Real red, green, blue;
|
||||
rgba.GetRGB().Values(red, green, blue, OCC_COLOR_SPACE);
|
||||
return App::Color(static_cast<float>(red),
|
||||
static_cast<float>(green),
|
||||
static_cast<float>(blue),
|
||||
static_cast<float>(rgba.Alpha()));
|
||||
return Base::Color(static_cast<float>(red),
|
||||
static_cast<float>(green),
|
||||
static_cast<float>(blue),
|
||||
static_cast<float>(rgba.Alpha()));
|
||||
}
|
||||
|
||||
Quantity_ColorRGBA Tools::convertColor(const App::Color& col)
|
||||
Quantity_ColorRGBA Tools::convertColor(const Base::Color& col)
|
||||
{
|
||||
return Quantity_ColorRGBA(Quantity_Color(col.r, col.g, col.b, OCC_COLOR_SPACE), col.a);
|
||||
}
|
||||
|
||||
static inline std::ostream& operator<<(std::ostream& os, const Quantity_ColorRGBA& rgba)
|
||||
{
|
||||
App::Color color = Tools::convertColor(rgba);
|
||||
Base::Color color = Tools::convertColor(rgba);
|
||||
auto toHex = [](float v) {
|
||||
return boost::format("%02X") % static_cast<int>(v * 255);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user