| 
									
										
										
										
											2024-03-03 09:21:30 -05:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2024, Nico Weber <thakis@chromium.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/MemoryStream.h>
 | 
					
						
							|  |  |  | #include <AK/OwnPtr.h>
 | 
					
						
							|  |  |  | #include <LibGfx/ImageFormats/ImageDecoder.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Gfx { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct JBIG2LoadingContext; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class JBIG2ImageDecoderPlugin : public ImageDecoderPlugin { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     static bool sniff(ReadonlyBytes); | 
					
						
							|  |  |  |     static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual ~JBIG2ImageDecoderPlugin() override = default; | 
					
						
							| 
									
										
										
										
											2024-03-03 20:05:21 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     virtual IntSize size() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-03 21:54:00 -05:00
										 |  |  |     static ErrorOr<ByteBuffer> decode_embedded(Vector<ReadonlyBytes>); | 
					
						
							| 
									
										
										
										
											2024-03-03 21:05:53 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-03 20:05:21 -05:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-03-03 21:54:00 -05:00
										 |  |  |     JBIG2ImageDecoderPlugin(); | 
					
						
							| 
									
										
										
										
											2024-03-03 20:05:21 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     OwnPtr<JBIG2LoadingContext> m_context; | 
					
						
							| 
									
										
										
										
											2024-03-03 09:21:30 -05:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |