Bitmap.h 659 B

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include "Point2.h"
  3. namespace Javelin {
  4. class Bitmap {
  5. public:
  6. int width;
  7. int height;
  8. unsigned char *data;
  9. Bitmap() {}
  10. Bitmap(int w, int h, int bytesPerPixel)
  11. : width(w)
  12. , height(h)
  13. , data(new unsigned char[width * height * bytesPerPixel]) {
  14. }
  15. virtual ~Bitmap() {
  16. delete [] data;
  17. }
  18. Point2<int> GetSize() const { return Point2<int>(width, height); }
  19. int GetArea() const { return width * height; }
  20. int GetBitmapWidth() const { return width; }
  21. int GetBitmapHeight() const { return height; }
  22. const unsigned char *GetRawData() const { return data; }
  23. };
  24. }