mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	Merge branch 'master' of https://github.com/Prusa3d/PrusaSlicer
This commit is contained in:
		
						commit
						819a58579e
					
				
					 3 changed files with 29 additions and 5 deletions
				
			
		|  | @ -338,7 +338,7 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //we make scaled solid bitmaps only for the cases, when its will be used with scaled SVG icon in one output bitmap
 | //we make scaled solid bitmaps only for the cases, when its will be used with scaled SVG icon in one output bitmap
 | ||||||
| wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling/* = false*/) | wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling/* = false*/, size_t border_width /*= 0*/) | ||||||
| { | { | ||||||
|     double scale = suppress_scaling ? 1.0f : m_scale; |     double scale = suppress_scaling ? 1.0f : m_scale; | ||||||
|     width  *= scale; |     width  *= scale; | ||||||
|  | @ -354,6 +354,30 @@ wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsi | ||||||
|         *imgdata ++ = b; |         *imgdata ++ = b; | ||||||
|         *imgalpha ++ = transparency; |         *imgalpha ++ = transparency; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     // Add border, make white/light spools easier to see
 | ||||||
|  |     if (border_width > 0) { | ||||||
|  | 
 | ||||||
|  |         // Restrict to width of image
 | ||||||
|  |         if (border_width > height) border_width = height - 1; | ||||||
|  |         if (border_width > width) border_width = width - 1; | ||||||
|  | 
 | ||||||
|  |         auto px_data = (uint8_t*)image.GetData(); | ||||||
|  |         auto a_data = (uint8_t*)image.GetAlpha(); | ||||||
|  | 
 | ||||||
|  |         for (size_t x = 0; x < width; ++x) { | ||||||
|  |             for (size_t y = 0; y < height; ++y) { | ||||||
|  |                 if (x < border_width || y < border_width || | ||||||
|  |                     x >= (width - border_width) || y >= (height - border_width)) { | ||||||
|  |                     const size_t idx = (x + y * width); | ||||||
|  |                     const size_t idx_rgb = (x + y * width) * 3; | ||||||
|  |                     px_data[idx_rgb] = px_data[idx_rgb + 1] = px_data[idx_rgb + 2] = 0u; | ||||||
|  |                     a_data[idx] = 255u; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     return wxImage_to_wxBitmap_with_alpha(std::move(image), scale); |     return wxImage_to_wxBitmap_with_alpha(std::move(image), scale); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,8 +35,8 @@ public: | ||||||
| 	// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
 | 	// Load svg from resources/icons. bitmap_key is given without the .svg suffix. SVG will be rasterized to provided height/width.
 | ||||||
|     wxBitmap* 		load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false); |     wxBitmap* 		load_svg(const std::string &bitmap_key, unsigned width = 0, unsigned height = 0, const bool grayscale = false, const bool dark_mode = false); | ||||||
| 
 | 
 | ||||||
| 	wxBitmap 		mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling = false); | 	wxBitmap 		mksolid(size_t width, size_t height, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, bool suppress_scaling = false, size_t border_width = 0); | ||||||
| 	wxBitmap 		mksolid(size_t width, size_t height, const unsigned char rgb[3], bool suppress_scaling = false) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE, suppress_scaling); } | 	wxBitmap 		mksolid(size_t width, size_t height, const unsigned char rgb[3], bool suppress_scaling = false, size_t border_width = 0) { return mksolid(width, height, rgb[0], rgb[1], rgb[2], wxALPHA_OPAQUE, suppress_scaling, border_width); } | ||||||
| 	wxBitmap 		mkclear(size_t width, size_t height) { return mksolid(width, height, 0, 0, 0, wxALPHA_TRANSPARENT); } | 	wxBitmap 		mkclear(size_t width, size_t height) { return mksolid(width, height, 0, 0, 0, wxALPHA_TRANSPARENT); } | ||||||
| 
 | 
 | ||||||
| 	static bool     parse_color(const std::string& scolor, unsigned char* rgb_out); | 	static bool     parse_color(const std::string& scolor, unsigned char* rgb_out); | ||||||
|  |  | ||||||
|  | @ -427,10 +427,10 @@ wxBitmap* PresetComboBox::get_bmp(  std::string bitmap_key, bool wide_icons, con | ||||||
|             unsigned char rgb[3]; |             unsigned char rgb[3]; | ||||||
|             // Paint the color bars.
 |             // Paint the color bars.
 | ||||||
|             bitmap_cache().parse_color(filament_rgb, rgb); |             bitmap_cache().parse_color(filament_rgb, rgb); | ||||||
|             bmps.emplace_back(bitmap_cache().mksolid(is_single_bar ? wide_icon_width : norm_icon_width, icon_height, rgb)); |             bmps.emplace_back(bitmap_cache().mksolid(is_single_bar ? wide_icon_width : norm_icon_width, icon_height, rgb, false, 1)); | ||||||
|             if (!is_single_bar) { |             if (!is_single_bar) { | ||||||
|                 bitmap_cache().parse_color(extruder_rgb, rgb); |                 bitmap_cache().parse_color(extruder_rgb, rgb); | ||||||
|                 bmps.emplace_back(bitmap_cache().mksolid(thin_icon_width, icon_height, rgb)); |                 bmps.emplace_back(bitmap_cache().mksolid(thin_icon_width, icon_height, rgb, false, 1)); | ||||||
|             } |             } | ||||||
|             // Paint a lock at the system presets.
 |             // Paint a lock at the system presets.
 | ||||||
|             bmps.emplace_back(bitmap_cache().mkclear(space_icon_width, icon_height)); |             bmps.emplace_back(bitmap_cache().mkclear(space_icon_width, icon_height)); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vojtech Bubnik
						Vojtech Bubnik