| 
									
										
										
										
											2023-06-20 16:32:17 -04:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2023, Lucas Chollet <lucas.chollet@serenityos.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Error.h>
 | 
					
						
							|  |  |  | #include <LibGfx/Forward.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Gfx { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-02 00:00:40 -04:00
										 |  |  | struct JPEGEncoderOptions { | 
					
						
							| 
									
										
										
										
											2024-01-26 09:37:13 -05:00
										 |  |  |     Optional<ReadonlyBytes> icc_data; | 
					
						
							| 
									
										
										
										
											2023-07-02 00:00:40 -04:00
										 |  |  |     u8 quality { 75 }; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-20 16:32:17 -04:00
										 |  |  | class JPEGWriter { | 
					
						
							|  |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-07-02 00:00:40 -04:00
										 |  |  |     using Options = JPEGEncoderOptions; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     static ErrorOr<void> encode(Stream&, Bitmap const&, Options const& = {}); | 
					
						
							| 
									
										
										
										
											2023-06-20 16:32:17 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     JPEGWriter() = delete; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |