Bitmap.h 705 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. namespace msdfgen {
  3. /// A floating-point RGB pixel.
  4. struct FloatRGB {
  5. float r, g, b;
  6. };
  7. /// A 2D image bitmap.
  8. template <typename T>
  9. class Bitmap {
  10. public:
  11. Bitmap();
  12. Bitmap(int width, int height);
  13. Bitmap(const Bitmap<T> &orig);
  14. #ifdef MSDFGEN_USE_CPP11
  15. Bitmap(Bitmap<T> &&orig);
  16. #endif
  17. ~Bitmap();
  18. Bitmap<T> & operator=(const Bitmap<T> &orig);
  19. #ifdef MSDFGEN_USE_CPP11
  20. Bitmap<T> & operator=(Bitmap<T> &&orig);
  21. #endif
  22. /// Bitmap width in pixels.
  23. int width() const;
  24. /// Bitmap height in pixels.
  25. int height() const;
  26. T & operator()(int x, int y);
  27. const T & operator()(int x, int y) const;
  28. private:
  29. T *content;
  30. int w, h;
  31. };
  32. }