Debian Codegraph @

bitmap/NewBitmap.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Descent Developers
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef DESCENT3_NEWBITMAP_H
20 #define DESCENT3_NEWBITMAP_Hcxx . . $ `bitmap/NewBitmap.h:20:9`!
21
22 #include <cstdint>
23 #include <memory>
24
25 enum class PixelDataFormatcxx . . $ PixelDataFormat# {
26 Unknowncxx . . $ PixelDataFormat#Unknown.,
27 RGBA32cxx . . $ PixelDataFormat#RGBA32.
28 };
29
30 class NewBitmapcxx . . $ NewBitmap# {
31 private:
32 uint32_tcxx . . $ uint32_t# _wcxx . . $ NewBitmap#_w., _hcxx . . $ NewBitmap#_h.;
33 PixelDataFormatcxx . . $ PixelDataFormat# _formatcxx . . $ NewBitmap#_format.;
34 bool _flippedYcxx . . $ NewBitmap#_flippedY.;
35 stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<uint8_tcxx . . $ uint8_t#[]> _datacxx . . $ NewBitmap#_data.;
36
37 static stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<uint8_tcxx . . $ uint8_t#[]> allocateDatacxx . . $ NewBitmap#allocateData(5310126d2cce5494).(uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, PixelDataFormatcxx . . $ PixelDataFormat# format);
38
39 [[nodiscard]] uint32_tcxx . . $ uint32_t# getStridecxx . . $ NewBitmap#getStride(ddd8539a2fcdd4ce).() const;
40
41 public:
42 /// Creates a new bitmap of size "w * h" and the specified format. Will allocate enough memory to store it.
43 NewBitmapcxx . . $ NewBitmap#NewBitmap(3853f9d062b56d84).(uint32_tcxx . . $ uint32_t# w, uint32_tcxx . . $ uint32_t# h, PixelDataFormatcxx . . $ PixelDataFormat# format, bool flippedY = false);
44
45 void getSizecxx . . $ NewBitmap#getSize(aa87d7b5cf3e960a).(uint32_tcxx . . $ uint32_t# &w, uint32_tcxx . . $ uint32_t# &h) const {
46 w = _wcxx . . $ NewBitmap#_w.;
47 h = _hcxx . . $ NewBitmap#_h.;
48 }
49
50 /// @returns raw pointer to image data
51 [[nodiscard]] uint8_tcxx . . $ uint8_t# *getDatacxx . . $ NewBitmap#getData(707a43c27767d44a).() const { return _datacxx . . $ NewBitmap#_data..getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).(); }
52
53 /// @returns number of components for the bitmap format (i.e. 4 for "RGBA")
54 [[nodiscard]] uint32_tcxx . . $ uint32_t# getNumComponentscxx . . $ NewBitmap#getNumComponents(ddd8539a2fcdd4ce).() const;
55
56 /// @returns true on success, false otherwise
57 bool saveAsPNGcxx . . $ NewBitmap#saveAsPNG(c5f7da30cbc0f4e9).(const char* filePath);
58 };
59
60 #endif // DESCENT3_NEWBITMAP_H