| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2024-11-09 02:36:31 +01:00
										 |  |  |  * Copyright (c) 2023-2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  | #include <AK/NonnullOwnPtr.h>
 | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | #include <AK/RefCounted.h>
 | 
					
						
							|  |  |  | #include <LibGfx/Bitmap.h>
 | 
					
						
							|  |  |  | #include <LibGfx/Forward.h>
 | 
					
						
							|  |  |  | #include <LibGfx/Rect.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  | class SkImage; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | namespace Gfx { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  | struct ImmutableBitmapImpl; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | class ImmutableBitmap final : public RefCounted<ImmutableBitmap> { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     static NonnullRefPtr<ImmutableBitmap> create(NonnullRefPtr<Bitmap> bitmap); | 
					
						
							| 
									
										
										
										
											2024-11-09 06:47:16 +01:00
										 |  |  |     static NonnullRefPtr<ImmutableBitmap> create_snapshot_from_painting_surface(NonnullRefPtr<PaintingSurface>); | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     ~ImmutableBitmap(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int width() const; | 
					
						
							|  |  |  |     int height() const; | 
					
						
							|  |  |  |     IntRect rect() const; | 
					
						
							|  |  |  |     IntSize size() const; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Gfx::AlphaType alpha_type() const; | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     SkImage const* sk_image() const; | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     Color get_pixel(int x, int y) const; | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     RefPtr<Bitmap const> bitmap() const; | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     NonnullOwnPtr<ImmutableBitmapImpl> m_impl; | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-09 05:48:17 +01:00
										 |  |  |     explicit ImmutableBitmap(NonnullOwnPtr<ImmutableBitmapImpl> bitmap); | 
					
						
							| 
									
										
										
										
											2023-11-24 14:45:45 +01:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |