diff --git a/resources/images/color_picker_border.svg b/resources/images/color_picker_border.svg
new file mode 100644
index 000000000..e9af4f91e
--- /dev/null
+++ b/resources/images/color_picker_border.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp
index 9cc496dec..458011fa6 100644
--- a/src/slic3r/GUI/AMSMaterialsSetting.cpp
+++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp
@@ -536,6 +536,13 @@ void AMSMaterialsSetting::set_color(wxColour color)
m_clr_picker->set_color(color);
}
+void AMSMaterialsSetting::set_colors(std::vector colors)
+{
+ //m_clrData->SetColour(color);
+ m_clr_picker->set_colors(colors);
+}
+
+
void AMSMaterialsSetting::on_picker_color(wxCommandEvent& event)
{
unsigned int color_num = event.GetInt();
@@ -836,6 +843,7 @@ ColorPicker::ColorPicker(wxWindow* parent, wxWindowID id, const wxPoint& pos /*=
wxWindow::Create(parent, id, pos, size);
Bind(wxEVT_PAINT, &ColorPicker::paintEvent, this);
+ m_bitmap_border = create_scaled_bitmap("color_picker_border", nullptr, 25);
}
ColorPicker::~ColorPicker(){}
@@ -846,6 +854,12 @@ void ColorPicker::set_color(wxColour col)
Refresh();
}
+void ColorPicker::set_colors(std::vector cols)
+{
+ m_cols = cols;
+ Refresh();
+}
+
void ColorPicker::paintEvent(wxPaintEvent& evt)
{
wxPaintDC dc(this);
@@ -894,6 +908,24 @@ void ColorPicker::doRender(wxDC& dc)
dc.SetPen(wxPen(wxColour(0x6B6B6B)));
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawCircle(size.x / 2, size.x / 2, radius);
+
+ if (m_cols.size() > 1) {
+ int left = FromDIP(0);
+ float total_width = size.x;
+ int gwidth = std::round(total_width / (m_cols.size() - 1));
+
+ for (int i = 0; i < m_cols.size() - 1; i++) {
+
+ if ((left + gwidth) > (size.x)) {
+ gwidth = size.x - left;
+ }
+
+ auto rect = wxRect(left, 0, gwidth, size.y);
+ dc.GradientFillLinear(rect, m_cols[i], m_cols[i + 1], wxEAST);
+ left += gwidth;
+ }
+ dc.DrawBitmap(m_bitmap_border, wxPoint(0, 0));
+ }
}
}
diff --git a/src/slic3r/GUI/AMSMaterialsSetting.hpp b/src/slic3r/GUI/AMSMaterialsSetting.hpp
index d5eaf8535..572324d5a 100644
--- a/src/slic3r/GUI/AMSMaterialsSetting.hpp
+++ b/src/slic3r/GUI/AMSMaterialsSetting.hpp
@@ -31,7 +31,9 @@ namespace Slic3r { namespace GUI {
class ColorPicker : public wxWindow
{
public:
+ wxBitmap m_bitmap_border;
wxColour m_colour;
+ std::vector m_cols;
bool m_selected{false};
bool m_show_full{false};
@@ -39,6 +41,7 @@ public:
~ColorPicker();
void set_color(wxColour col);
+ void set_colors(std::vector cols);
void set_selected(bool sel) {m_selected = sel;Refresh();};
void set_show_full(bool full) {m_show_full = full;Refresh();};
@@ -92,6 +95,7 @@ public:
void post_select_event();
void set_color(wxColour color);
+ void set_colors(std::vector colors);
void on_picker_color(wxCommandEvent& color);
MachineObject* obj{ nullptr };
diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp
index 3d85d412c..8b69ea1ff 100644
--- a/src/slic3r/GUI/StatusPanel.cpp
+++ b/src/slic3r/GUI/StatusPanel.cpp
@@ -2763,6 +2763,14 @@ void StatusPanel::on_filament_edit(wxCommandEvent &event)
n_val = wxString::Format("%.3f", tray_it->second->n);
wxColor color = AmsTray::decode_color(tray_it->second->color);
m_filament_setting_dlg->set_color(color);
+
+ std::vector cols;
+ for (auto col : tray_it->second->cols) {
+ cols.push_back( AmsTray::decode_color(col));
+ }
+
+ m_filament_setting_dlg->set_colors(cols);
+
m_filament_setting_dlg->ams_filament_id = tray_it->second->setting_id;
m_filament_setting_dlg->m_is_third = !MachineObject::is_bbl_filament(tray_it->second->tag_uid);
if (!m_filament_setting_dlg->m_is_third) {
diff --git a/src/slic3r/GUI/Widgets/AMSControl.cpp b/src/slic3r/GUI/Widgets/AMSControl.cpp
index 7ad7d5f82..f966cd8c0 100644
--- a/src/slic3r/GUI/Widgets/AMSControl.cpp
+++ b/src/slic3r/GUI/Widgets/AMSControl.cpp
@@ -1374,7 +1374,31 @@ void AMSItem::doRender(wxDC &dc)
dc.SetBrush(AMS_CONTROL_DISABLE_COLOUR);
}
- dc.DrawRoundedRectangle(left, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, AMS_ITEM_CUBE_SIZE.x, AMS_ITEM_CUBE_SIZE.y, 2);
+ if (iter->material_cols.size() > 1) {
+ int fleft = left;
+ float total_width = AMS_ITEM_CUBE_SIZE.x;
+ int gwidth = std::round(total_width / (iter->material_cols.size() - 1));
+
+ for (int i = 0; i < iter->material_cols.size() - 1; i++) {
+
+ if ((fleft + gwidth) > (AMS_ITEM_CUBE_SIZE.x)) {
+ gwidth = (fleft + AMS_ITEM_CUBE_SIZE.x) - fleft;
+ }
+
+ auto rect = wxRect(fleft, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, gwidth, AMS_ITEM_CUBE_SIZE.y);
+ dc.GradientFillLinear(rect, iter->material_cols[i], iter->material_cols[i + 1], wxEAST);
+ fleft += gwidth;
+ }
+
+ dc.SetPen(wxPen(StateColor::darkModeColorFor(m_background_colour)));
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ dc.DrawRoundedRectangle(left - 1, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2 - 1, AMS_ITEM_CUBE_SIZE.x + 2, AMS_ITEM_CUBE_SIZE.y + 2, 2);
+
+ }else {
+ dc.DrawRoundedRectangle(left, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, AMS_ITEM_CUBE_SIZE.x, AMS_ITEM_CUBE_SIZE.y, 2);
+ }
+
+
left += AMS_ITEM_CUBE_SIZE.x;
left += m_space;
}