void graphics::brush::BrushSet::SetColorSet(const graphics::color::ColorSet &colorSet) { Clear(); for (size_t i = 0; i < colorSet.GetNumberOfColors(); ++i) { auto color = colorSet.GetColor(i); switch (color->GetColorType()) { case graphics::color::IColor::COLOR_TYPE_SOLID_COLOR: { auto solidColor = std::dynamic_pointer_cast<graphics::color::SolidColor>(color); auto solidBrush = std::make_shared<graphics::brush::SolidColorBrush>(); solidBrush->SetColor(solidColor->GetCurrentColor()); if (solidColor->GetLabel().length() > 0) { solidBrush->SetLabel(solidColor->GetLabel()); m_labelToBrashMap.insert( std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>( solidColor->GetLabel(), solidBrush)); } m_brushes.push_back(solidBrush); } break; case graphics::color::IColor::COLOR_TYPE_LINEAR_GRADIENT_COLOR: { auto linearGradientColor = std::dynamic_pointer_cast<graphics::color::LinearGradientColor>(color); auto linearBrush = std::make_shared<graphics::brush::LinearGradientBrush>(); linearBrush->SetGradientDirection(linearGradientColor->GetGradientDirection()); linearBrush->SetGradientStops(linearGradientColor->GetCurrentColor()); if (linearGradientColor->GetLabel().length() > 0) { linearBrush->SetLabel(linearGradientColor->GetLabel()); m_labelToBrashMap.insert( std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>( linearGradientColor->GetLabel(), linearBrush)); } m_brushes.push_back(linearBrush); } break; case graphics::color::IColor::COLOR_TYPE_RADIAL_GRADIENT_COLOR: { auto radialGradientColor = std::dynamic_pointer_cast<graphics::color::RadialGradientColor>(color); auto radialBrush = std::make_shared<graphics::brush::RadialGradientBrush>(); radialBrush->SetGradientOriginOffsetRate( radialGradientColor->GetGradientOffsetX(), radialGradientColor->GetGradientOffsetY()); radialBrush->SetGradientStops(radialGradientColor->GetCurrentColor()); if (radialGradientColor->GetLabel().length() > 0) { radialBrush->SetLabel(radialGradientColor->GetLabel()); m_labelToBrashMap.insert( std::make_pair<std::wstring, std::shared_ptr<graphics::brush::IBrush>>( radialGradientColor->GetLabel(), radialBrush)); } m_brushes.push_back(radialBrush); } break; } } }
int CXTPChartFillStyle::OleGetGradientDirection() { return GetGradientDirection(); }