Advertisement
Alienguard

Bitmap.h

Jun 19th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #ifndef BITMAP_H
  2. #define BITMAP_H
  3.  
  4. #include <string>
  5. #include <cstdint>
  6. #include <memory>
  7.  
  8. //Short for cave of programming. Since this is a tutorial I am following in there
  9. namespace cop
  10. {
  11.     class Bitmap
  12.     {
  13.     private:
  14.         int m_width{ 0 };
  15.         int m_height{ 0 };
  16.         std::unique_ptr<uint8_t[]> m_pPixel{nullptr}; //Here I have the unique pointer
  17.  
  18.     public:
  19.         Bitmap(int witdh, int height);
  20.  
  21.         //Set a pixel to a color
  22.         void setPixel(int x, int y, uint8_t red, uint8_t green, uint8_t blue);
  23.  
  24.         //Check whether we can or can't write a file to disk
  25.         bool write(std::string filename);
  26.         ~Bitmap();
  27.     };
  28. }
  29. #endif //BITMAP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement