#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 class Bitmap { public: Bitmap(); Bitmap(int width, int height); Bitmap(const BitmapConstRef &orig); Bitmap(const Bitmap &orig); #ifdef MSDFGEN_USE_CPP11 Bitmap(Bitmap &&orig); #endif ~Bitmap(); Bitmap & operator=(const BitmapConstRef &orig); Bitmap & operator=(const Bitmap &orig); #ifdef MSDFGEN_USE_CPP11 Bitmap & operator=(Bitmap &&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(); operator BitmapConstRef() const; private: T *pixels; int w, h; }; } #include "Bitmap.hpp"