#pragma once #include #include #include #include class Bitmap { public: Bitmap(size_t w, size_t h); void clear(); void setpixel( size_t row, size_t col, uint8_t r, uint8_t g, uint8_t b ); void save(const char *filename) const; size_t get_width() const; size_t get_height() const; private: size_t width; size_t height; // Pixel data. // First is a vector of rows, // Second is a vector of pixels. // RGB format. std::vector< std::vector< std::tuple< uint8_t, uint8_t, uint8_t >> > data; static void dump_int_to_bytes( uint64_t a, uint8_t* bytes, size_t index, size_t num_bytes ); };