diff options
author | supermerill <merill@free.fr> | 2022-09-06 21:02:38 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2022-09-16 17:20:43 +0300 |
commit | 2c379a2afdf565889116e660a6242367e93a2d49 (patch) | |
tree | 0f8d7c7192e476d3f3ecd9ca57ae50ec360a7a42 | |
parent | d6cbc5541880d176b17091e46f4d38efc4e96ef1 (diff) |
Fix icon splashscreen
supermerill/SuperSlicer#3135
-rw-r--r-- | resources/icons/Slic3r.svg | 141 | ||||
-rw-r--r-- | src/slic3r/GUI/GUI_App.cpp | 65 |
2 files changed, 38 insertions, 168 deletions
diff --git a/resources/icons/Slic3r.svg b/resources/icons/Slic3r.svg index 5bd5e7844..0cc87eb78 100644 --- a/resources/icons/Slic3r.svg +++ b/resources/icons/Slic3r.svg @@ -1,138 +1,5 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="800" - height="800" - viewBox="0 0 800 800" - version="1.1" - id="svg1299" - sodipodi:docname="Slic3r_logo.svg" - inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> - <metadata - id="metadata1305"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs1303"> - <linearGradient - inkscape:collect="always" - id="linearGradient1491"> - <stop - style="stop-color:#8f8f26;stop-opacity:1" - offset="0" - id="stop1487" /> - <stop - style="stop-color:#656511;stop-opacity:1" - offset="1" - id="stop1489" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient1485"> - <stop - style="stop-color:#8f8f26;stop-opacity:1" - offset="0" - id="stop1481" /> - <stop - style="stop-color:#656511;stop-opacity:1" - offset="1" - id="stop1483" /> - </linearGradient> - <linearGradient - inkscape:collect="always" - id="linearGradient1459"> - <stop - style="stop-color:#a9a965;stop-opacity:1" - offset="0" - id="stop1455" /> - <stop - style="stop-color:#666615;stop-opacity:1" - offset="1" - id="stop1457" /> - </linearGradient> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient1459" - id="radialGradient1461" - cx="494.49316" - cy="257.90402" - fx="494.49316" - fy="257.90402" - r="205.81538" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(-1.4582186,1.1029066,-0.77366241,-1.0229053,1386.9261,-161.49383)" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient1485" - id="radialGradient1471" - cx="407.91251" - cy="477.71249" - fx="407.91251" - fy="477.71249" - r="205.21249" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0.98248248,0.9808143,-1.0040731,1.0057809,486.80383,-402.84799)" /> - <radialGradient - inkscape:collect="always" - xlink:href="#linearGradient1491" - id="radialGradient1479" - cx="407.91251" - cy="477.71249" - fx="407.91251" - fy="477.71249" - r="205.21249" - gradientUnits="userSpaceOnUse" - gradientTransform="matrix(0.98248248,0.9808143,-1.0040731,1.0057809,486.80383,-402.84799)" /> - </defs> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1920" - inkscape:window-height="1025" - id="namedview1301" - showgrid="false" - inkscape:zoom="0.70003571" - inkscape:cx="367.55755" - inkscape:cy="339.20236" - inkscape:window-x="3840" - inkscape:window-y="1111" - inkscape:window-maximized="1" - inkscape:current-layer="svg1299" /> - <circle - cx="400" - cy="400" - r="400" - fill="#fff" - id="circle1293" /> - <path - d="m 599.3,186.8 c -93.9,-93.9 -246.1,-93.9 -340,0 -93.9,93.9 -93.9,246.1 0,340 z" - fill="#363636" - id="path1295" - style="mix-blend-mode:normal;fill:url(#radialGradient1461);fill-opacity:1;stroke-width:1.0015748;stroke-miterlimit:4;stroke-dasharray:none;stroke:#818148;stroke-opacity:1" /> - <path - d="M202.7,612.5c93.9,93.9,246.1,93.9,340,0s93.9-246.1,0-340" - transform="translate(0 0)" - fill="#eddc21" - id="path1297" - style="fill-opacity:1.0;fill:url(#radialGradient1471);stroke:url(#radialGradient1479)" /> +<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800" viewBox="0 0 800 800"> + <circle cx="400" cy="400" r="400" fill="#fff"/> + <path d="M599.3,186.8c-93.9-93.9-246.1-93.9-340,0s-93.9,246.1,0,340Z" transform="translate(0 0)" fill="#363636"/> + <path d="M202.7,612.5c93.9,93.9,246.1,93.9,340,0s93.9-246.1,0-340" transform="translate(0 0)" fill="#ebda21"/> </svg> diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 041c2d878..6c4b19cf7 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -147,7 +147,7 @@ public: m_action_font = m_constant_text.credits_font.Bold(); // draw logo and constant info text - Decorate(m_main_bitmap); + Decorate(); } void SetText(const wxString& text) @@ -160,7 +160,7 @@ public: memDC.SelectObject(bitmap); memDC.SetFont(m_action_font); -/// memDC.SetTextForeground(wxColour(237, 107, 33)); // ed6b21 + /// memDC.SetTextForeground(wxColour(237, 107, 33)); // ed6b21 uint32_t color = Slic3r::GUI::wxGetApp().app_config->create_color(0.86f, 0.93f); memDC.SetTextForeground(wxColour(color & 0xFF, (color & 0xFF00) >> 8, (color & 0xFF0000) >> 16)); memDC.DrawText(text, int(m_scale * 60), m_action_line_y_position); @@ -201,14 +201,14 @@ public: return new_bmp; } - void Decorate(wxBitmap& bmp) + void Decorate() { - if (!bmp.IsOk()) + if (!m_main_bitmap.IsOk()) return; // draw text to the box at the left of the splashscreen. // this box will be 2/5 of the weight of the bitmap, and be at the left. - int width = lround(bmp.GetWidth() * 0.4); + int width = lround(m_main_bitmap.GetWidth() * 0.4); // load bitmap for logo BitmapCache bmp_cache; @@ -218,11 +218,11 @@ public: wxCoord margin = int(m_scale * 20); - wxRect banner_rect(wxPoint(0, logo_size), wxPoint(width, bmp.GetHeight())); + wxRect banner_rect(wxPoint(0, logo_size), wxPoint(width, m_main_bitmap.GetHeight())); banner_rect.Deflate(margin, 2 * margin); // use a memory DC to draw directly onto the bitmap - wxMemoryDC memDc(bmp); + wxMemoryDC memDc(m_main_bitmap); // draw logo memDc.DrawBitmap(*logo_bmp, margin, margin, true); @@ -251,7 +251,7 @@ public: // calculate position for the dynamic text int logo_and_header_height = margin + logo_size + title_height + version_height; - m_action_line_y_position = logo_and_header_height + 0.5 * (bmp.GetHeight() - margin - credits_height - logo_and_header_height - text_height); + m_action_line_y_position = logo_and_header_height + 0.5 * (m_main_bitmap.GetHeight() - margin - credits_height - logo_and_header_height - text_height); } private: @@ -1180,20 +1180,23 @@ bool GUI_App::on_init_inner() std::string file_name = app_config->splashscreen(is_editor()); wxString artist; if (!file_name.empty()) { - wxString splash_screen_path = wxString::FromUTF8((boost::filesystem::path(Slic3r::resources_dir()) / "splashscreen" / file_name).string().c_str()); - // make a bitmap with dark grey banner on the left side - bmp = SplashScreen::MakeBitmap(wxBitmap(splash_screen_path, wxBITMAP_TYPE_JPEG)); - - - int result; - void** ifdArray = nullptr; - ExifTagNodeInfo* tag; - ifdArray = exif_createIfdTableArray(splash_screen_path.c_str(), &result); - if (result > 0 && ifdArray) { - tag = exif_getTagInfo(ifdArray, IFD_0TH, TAG_Artist); - if (tag) { - if (!tag->error) { - artist = (_L("Artwork model by") + " " + wxString::FromUTF8((char*)tag->byteData)); + boost::filesystem::path splash_screen_path = (boost::filesystem::path(Slic3r::resources_dir()) / "splashscreen" / file_name); + if (boost::filesystem::exists(splash_screen_path)) { + wxString path_str = wxString::FromUTF8((splash_screen_path).string().c_str()); + // make a bitmap with dark grey banner on the left side + bmp = SplashScreen::MakeBitmap(wxBitmap(path_str, wxBITMAP_TYPE_JPEG)); + + //get the artist name from metadata + int result; + void** ifdArray = nullptr; + ExifTagNodeInfo* tag; + ifdArray = exif_createIfdTableArray(path_str.c_str(), &result); + if (result > 0 && ifdArray) { + tag = exif_getTagInfo(ifdArray, IFD_0TH, TAG_Artist); + if (tag) { + if (!tag->error) { + artist = (_L("Artwork model by") + " " + wxString::FromUTF8((char*)tag->byteData)); + } } } } @@ -1216,18 +1219,18 @@ bool GUI_App::on_init_inner() get_app_config()->save(); } - // create splash screen with updated bmp - scrn = new SplashScreen(bmp.IsOk() ? bmp : create_scaled_bitmap(SLIC3R_APP_KEY, nullptr, 400), - wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, splashscreen_pos, artist); + // make a bitmap with dark grey banner on the left side + scrn = new SplashScreen(bmp.IsOk() ? bmp : SplashScreen::MakeBitmap(create_scaled_bitmap(SLIC3R_APP_KEY, nullptr, 600)), + wxSPLASH_CENTRE_ON_SCREEN | wxSPLASH_TIMEOUT, 4000, splashscreen_pos, artist); - if (!default_splashscreen_pos) - // revert "restore_win_position" value if application wasn't crashed - get_app_config()->set("restore_win_position", "1"); + if (!default_splashscreen_pos) + // revert "restore_win_position" value if application wasn't crashed + get_app_config()->set("restore_win_position", "1"); #ifndef __linux__ - wxYield(); + wxYield(); #endif - scrn->SetText(_L("Loading configuration")+ dots); - } + scrn->SetText(_L("Loading configuration") + dots); + } preset_bundle = new PresetBundle(); |