ENH:change filament icon to rect

jira: STUDIO-10344
Change-Id: Ie71f83b7c78b4784e1824c52e61485e8f4d36e1e
This commit is contained in:
Mack 2025-02-12 20:46:55 +08:00 committed by lane.wei
parent 05365a7a3f
commit 964a6c8320
3 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="2.5" y="2.5" width="19" height="19" fill="#00AE42" stroke="#909090"/>
</svg>

After

Width:  |  Height:  |  Size: 182 B

View File

@ -0,0 +1,16 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.9999 2H17.9812V5.5H21.9999V2Z" fill="#D9D9D9"/>
<path d="M14.056 2H10.0374V5.5H14.056V2Z" fill="#D9D9D9"/>
<path d="M6.01869 17.8998H2V21.9998H6.01869V17.8998Z" fill="#D9D9D9"/>
<path d="M14.056 17.8998H10.0374V21.9998H14.056V17.8998Z" fill="#D9D9D9"/>
<path d="M21.9999 17.8998H17.9812V21.9998H21.9999V17.8998Z" fill="#D9D9D9"/>
<path d="M6.01869 2H2V5.5H6.01869V2Z" fill="#D9D9D9"/>
<path d="M10.0375 13.7997H6.0188V17.8997H10.0375V13.7997Z" fill="#D9D9D9"/>
<path d="M17.9813 13.7997H13.9626V17.8997H17.9813V13.7997Z" fill="#D9D9D9"/>
<path d="M21.9999 9.59973H17.9812V13.6997H21.9999V9.59973Z" fill="#D9D9D9"/>
<path d="M14.056 9.59973H10.0374V13.6997H14.056V9.59973Z" fill="#D9D9D9"/>
<path d="M6.01869 9.59973H2V13.6997H6.01869V9.59973Z" fill="#D9D9D9"/>
<path d="M10.0375 5.50031H6.0188V9.60031H10.0375V5.50031Z" fill="#D9D9D9"/>
<path d="M17.9813 5.50031H13.9626V9.60031H17.9813V5.50031Z" fill="#D9D9D9"/>
<rect x="2.5" y="2.5" width="19" height="19" stroke="#ACACAC"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -2931,9 +2931,9 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
unsigned char rgba[4];
rgba[3] = 0xff;
Slic3r::GUI::BitmapCache::parse_color4(hex_color, rgba);
std::string svg_path = "/images/filament_green.svg";
std::string svg_path = "/images/outlined_rect.svg";
if (rgba[3] == 0x00) {
svg_path = "/images/filament_transparent2.svg";
svg_path = "/images/outlined_rect_transparent.svg";
}
BitmapCache::load_from_svg_file_change_color(Slic3r::resources_dir() + svg_path, img_size.x, img_size.y, transparent, hex_color);
ImGui::BeginGroup();
@ -2943,7 +2943,7 @@ void ImGuiWrapper::filament_group(const std::string& filament_type, const char*
// image border test
// draw_list->AddRect(cursor_pos, {cursor_pos.x + img_size.x, cursor_pos.y + img_size.y}, IM_COL32(0, 0, 0, 255));
ImVec2 current_cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos({ current_cursor.x + (img_size.x - id_text_size.x) * 0.5f + 2, current_cursor.y + (img_size.y - id_text_size.y) * 0.5f - 2 });
ImGui::SetCursorPos({ current_cursor.x + (img_size.x - id_text_size.x) * 0.5f, current_cursor.y + (img_size.y - id_text_size.y) * 0.5f - 7 });
float gray = 0.299 * rgba[0] + 0.587 * rgba[1] + 0.114 * rgba[2];
ImVec4 text_color = gray < 80 ? ImVec4(1.0f, 1.0f, 1.0f, 1.0f) : ImVec4(0, 0, 0, 1.0f);