Debian Codegraph @

thirdparty/msdfgen/core/Bitmap.h

raw symbols SCIP
1
2 #pragma once
3
4 #include "YAxisOrientation.h"
5 #include "BitmapRef.hpp"
6
7 namespace msdfgen {
8
9 /// A 2D image bitmap with N channels of type T. Pixel memory is managed by the class.
10 template <typename T, int N = 1>
11 class Bitmap {
12
13 public:
14 Bitmap();
15 Bitmap(int width, int height, YAxisOrientation yOrientation = MSDFGEN_Y_AXIS_DEFAULT_ORIENTATION);
16 explicit Bitmap(const BitmapConstRef<T, N> &orig);
17 explicit Bitmap(const BitmapConstSection<T, N> &orig);
18 Bitmap(const Bitmap<T, N> &orig);
19 #ifdef MSDFGEN_USE_CPP11
20 Bitmap(Bitmap<T, N> &&orig);
21 #endif
22 ~Bitmap();
23 Bitmap<T, N> &operator=(const BitmapConstRef<T, N> &orig);
24 Bitmap<T, N> &operator=(const BitmapConstSection<T, N> &orig);
25 Bitmap<T, N> &operator=(const Bitmap<T, N> &orig);
26 #ifdef MSDFGEN_USE_CPP11
27 Bitmap<T, N> &operator=(Bitmap<T, N> &&orig);
28 #endif
29 /// Bitmap width in pixels.
30 int width() const;
31 /// Bitmap height in pixels.
32 int height() const;
33 T *operator()(int x, int y);
34 const T *operator()(int x, int y) const;
35 #ifdef MSDFGEN_USE_CPP11
36 explicit operator T *();
37 explicit operator const T *() const;
38 #else
39 operator T *();
40 operator const T *() const;
41 #endif
42 operator BitmapRef<T, N>();
43 operator BitmapConstRef<T, N>() const;
44 operator BitmapSection<T, N>();
45 operator BitmapConstSection<T, N>() const;
46 /// Returns a reference to a rectangular section of the bitmap specified by bounds (excluding xMax, yMax).
47 BitmapSection<T, N> getSection(int xMin, int yMin, int xMax, int yMax);
48 /// Returns a constant reference to a rectangular section of the bitmap specified by bounds (excluding xMax, yMax).
49 BitmapConstSection<T, N> getConstSection(int xMin, int yMin, int xMax, int yMax) const;
50
51 private:
52 T *pixels;
53 int w, h;
54 YAxisOrientation yOrientation;
55
56 };
57
58 }
59
60 #include "Bitmap.hpp"