diff options
author | K. S. Ernest (iFire) Lee <fire@users.noreply.github.com> | 2021-08-27 08:51:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 08:51:37 -0700 |
commit | 90a35dac489bcbe39de35af661367519b411cb98 (patch) | |
tree | 8b6b4535556be521f9fbbadaebdea04e5316582c /thirdparty/msdfgen/core/Bitmap.h | |
parent | ca4f20529c0b6588464f88fc0b0680a8df0fc77f (diff) | |
parent | 4c3f7d1290311456519ca2416590c7e62465b7f2 (diff) |
Merge pull request #51908 from bruvzg/msdf_fonts2
Make FontData importable resource. Add multi-channel SDF font rendering.
Diffstat (limited to 'thirdparty/msdfgen/core/Bitmap.h')
-rw-r--r-- | thirdparty/msdfgen/core/Bitmap.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/thirdparty/msdfgen/core/Bitmap.h b/thirdparty/msdfgen/core/Bitmap.h new file mode 100644 index 0000000000..14407d6c34 --- /dev/null +++ b/thirdparty/msdfgen/core/Bitmap.h @@ -0,0 +1,50 @@ + +#pragma once + +#include "BitmapRef.hpp" + +namespace msdfgen { + +/// A 2D image bitmap with N channels of type T. Pixel memory is managed by the class. +template <typename T, int N = 1> +class Bitmap { + +public: + Bitmap(); + Bitmap(int width, int height); + Bitmap(const BitmapConstRef<T, N> &orig); + Bitmap(const Bitmap<T, N> &orig); +#ifdef MSDFGEN_USE_CPP11 + Bitmap(Bitmap<T, N> &&orig); +#endif + ~Bitmap(); + Bitmap<T, N> & operator=(const BitmapConstRef<T, N> &orig); + Bitmap<T, N> & operator=(const Bitmap<T, N> &orig); +#ifdef MSDFGEN_USE_CPP11 + Bitmap<T, N> & operator=(Bitmap<T, N> &&orig); +#endif + /// Bitmap width in pixels. + int width() const; + /// Bitmap height in pixels. + int height() const; + T * operator()(int x, int y); + const T * operator()(int x, int y) const; +#ifdef MSDFGEN_USE_CPP11 + explicit operator T *(); + explicit operator const T *() const; +#else + operator T *(); + operator const T *() const; +#endif + operator BitmapRef<T, N>(); + operator BitmapConstRef<T, N>() const; + +private: + T *pixels; + int w, h; + +}; + +} + +#include "Bitmap.hpp" |