/src/serenity/Userland/Libraries/LibGfx/ImmutableBitmap.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <AK/Forward.h> |
10 | | #include <AK/RefCounted.h> |
11 | | #include <LibGfx/Bitmap.h> |
12 | | #include <LibGfx/Forward.h> |
13 | | #include <LibGfx/Rect.h> |
14 | | |
15 | | namespace Gfx { |
16 | | |
17 | | class ImmutableBitmap final : public RefCounted<ImmutableBitmap> { |
18 | | public: |
19 | | static NonnullRefPtr<ImmutableBitmap> create(NonnullRefPtr<Bitmap> bitmap); |
20 | | |
21 | 0 | ~ImmutableBitmap() = default; |
22 | | |
23 | 0 | Bitmap const& bitmap() const { return *m_bitmap; } |
24 | | |
25 | 0 | size_t width() const { return m_bitmap->width(); } |
26 | 0 | size_t height() const { return m_bitmap->height(); } |
27 | | |
28 | 0 | IntRect rect() const { return m_bitmap->rect(); } |
29 | 0 | IntSize size() const { return m_bitmap->size(); } |
30 | | |
31 | 0 | size_t id() const { return m_id; } |
32 | | |
33 | | private: |
34 | | NonnullRefPtr<Bitmap> m_bitmap; |
35 | | size_t m_id; |
36 | | |
37 | | explicit ImmutableBitmap(NonnullRefPtr<Bitmap> bitmap); |
38 | | }; |
39 | | |
40 | | } |