mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 04:10:06 +00:00 
			
		
		
		
	Properly use rgba32f_pixel_t
This commit is contained in:
		
							parent
							
								
									c7023f9cd2
								
							
						
					
					
						commit
						7659ef0906
					
				
					 3 changed files with 23 additions and 4 deletions
				
			
		|  | @ -118,7 +118,7 @@ public: | ||||||
|       { |       { | ||||||
|          lineColor_.emplace( |          lineColor_.emplace( | ||||||
|             alertActive, |             alertActive, | ||||||
|             util::color::ToRgba8PixelT( |             util::color::ToRgba32fPixelT( | ||||||
|                paletteSettings.alert_color(phenomenon_, alertActive) |                paletteSettings.alert_color(phenomenon_, alertActive) | ||||||
|                   .GetValue())); |                   .GetValue())); | ||||||
|       } |       } | ||||||
|  | @ -144,7 +144,7 @@ public: | ||||||
|    static void |    static void | ||||||
|    AddLines(std::shared_ptr<gl::draw::GeoLines>&   geoLines, |    AddLines(std::shared_ptr<gl::draw::GeoLines>&   geoLines, | ||||||
|             const std::vector<common::Coordinate>& coordinates, |             const std::vector<common::Coordinate>& coordinates, | ||||||
|             boost::gil::rgba32_pixel_t             color, |             boost::gil::rgba32f_pixel_t            color, | ||||||
|             float                                  width, |             float                                  width, | ||||||
|             std::chrono::system_clock::time_point  startTime, |             std::chrono::system_clock::time_point  startTime, | ||||||
|             std::chrono::system_clock::time_point  endTime, |             std::chrono::system_clock::time_point  endTime, | ||||||
|  | @ -156,7 +156,7 @@ public: | ||||||
| 
 | 
 | ||||||
|    std::unordered_map<bool, std::shared_ptr<gl::draw::GeoLines>> geoLines_; |    std::unordered_map<bool, std::shared_ptr<gl::draw::GeoLines>> geoLines_; | ||||||
| 
 | 
 | ||||||
|    std::unordered_map<bool, boost::gil::rgba8_pixel_t> lineColor_; |    std::unordered_map<bool, boost::gil::rgba32f_pixel_t> lineColor_; | ||||||
| 
 | 
 | ||||||
|    std::chrono::system_clock::time_point selectedTime_ {}; |    std::chrono::system_clock::time_point selectedTime_ {}; | ||||||
| }; | }; | ||||||
|  | @ -358,7 +358,7 @@ void AlertLayer::Impl::UpdateAlert( | ||||||
| void AlertLayer::Impl::AddLines( | void AlertLayer::Impl::AddLines( | ||||||
|    std::shared_ptr<gl::draw::GeoLines>&   geoLines, |    std::shared_ptr<gl::draw::GeoLines>&   geoLines, | ||||||
|    const std::vector<common::Coordinate>& coordinates, |    const std::vector<common::Coordinate>& coordinates, | ||||||
|    boost::gil::rgba32_pixel_t             color, |    boost::gil::rgba32f_pixel_t            color, | ||||||
|    float                                  width, |    float                                  width, | ||||||
|    std::chrono::system_clock::time_point  startTime, |    std::chrono::system_clock::time_point  startTime, | ||||||
|    std::chrono::system_clock::time_point  endTime, |    std::chrono::system_clock::time_point  endTime, | ||||||
|  |  | ||||||
|  | @ -29,6 +29,15 @@ boost::gil::rgba8_pixel_t ToRgba8PixelT(const std::string& argbString) | ||||||
|                                      static_cast<uint8_t>(qAlpha(color))}; |                                      static_cast<uint8_t>(qAlpha(color))}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | boost::gil::rgba32f_pixel_t ToRgba32fPixelT(const std::string& argbString) | ||||||
|  | { | ||||||
|  |    boost::gil::rgba8_pixel_t rgba8Pixel = ToRgba8PixelT(argbString); | ||||||
|  |    return boost::gil::rgba32f_pixel_t {rgba8Pixel[0] / 255.0f, | ||||||
|  |                                        rgba8Pixel[1] / 255.0f, | ||||||
|  |                                        rgba8Pixel[2] / 255.0f, | ||||||
|  |                                        rgba8Pixel[3] / 255.0f}; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| } // namespace color
 | } // namespace color
 | ||||||
| } // namespace util
 | } // namespace util
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
|  |  | ||||||
|  | @ -29,6 +29,16 @@ std::string ToArgbString(const boost::gil::rgba8_pixel_t& color); | ||||||
|  */ |  */ | ||||||
| boost::gil::rgba8_pixel_t ToRgba8PixelT(const std::string& argbString); | boost::gil::rgba8_pixel_t ToRgba8PixelT(const std::string& argbString); | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * Converts an ARGB string used by Qt libraries to a Boost.GIL 32-bit RGBA | ||||||
|  |  * floating point pixel. | ||||||
|  |  * | ||||||
|  |  * @param argbString ARGB string in the format #AARRGGBB | ||||||
|  |  * | ||||||
|  |  * @return RGBA32 floating point pixel | ||||||
|  |  */ | ||||||
|  | boost::gil::rgba32f_pixel_t ToRgba32fPixelT(const std::string& argbString); | ||||||
|  | 
 | ||||||
| } // namespace color
 | } // namespace color
 | ||||||
| } // namespace util
 | } // namespace util
 | ||||||
| } // namespace qt
 | } // namespace qt
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat