mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	FIX: color is not correct after sync ams
Change-Id: Ib681f84c3b2d8267fa832072a32d1f49c21145fd
This commit is contained in:
		
							parent
							
								
									c351ac54aa
								
							
						
					
					
						commit
						65ea350f01
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		|  | @ -430,6 +430,14 @@ wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsi | |||
| 
 | ||||
| bool BitmapCache::parse_color(const std::string& scolor, unsigned char* rgb_out) | ||||
| { | ||||
|     if (scolor.size() == 9) { | ||||
|         unsigned char rgba[4]; | ||||
|         parse_color4(scolor, rgba); | ||||
|         rgb_out[0] = rgba[0]; | ||||
|         rgb_out[1] = rgba[1]; | ||||
|         rgb_out[2] = rgba[2]; | ||||
|         return true; | ||||
|     } | ||||
|     rgb_out[0] = rgb_out[1] = rgb_out[2] = 0; | ||||
|     if (scolor.size() != 7 || scolor.front() != '#') | ||||
|         return false; | ||||
|  |  | |||
|  | @ -103,6 +103,16 @@ static std::array<float, 4> decode_color(const std::string& color) { | |||
|             ret[j] = float(digit1 * 16 + digit2) * INV_255; | ||||
|         } | ||||
|     } | ||||
|     else if (color.size() == 9 && color.front() == '#') { | ||||
|         for (size_t j = 0; j < 4; ++j) { | ||||
|             int digit1 = hex_digit_to_int(*c++); | ||||
|             int digit2 = hex_digit_to_int(*c++); | ||||
|             if (digit1 == -1 || digit2 == -1) | ||||
|                 break; | ||||
| 
 | ||||
|             ret[j] = float(digit1 * 16 + digit2) * INV_255; | ||||
|         } | ||||
|     } | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 zhimin.zeng
						zhimin.zeng