Bitmap.h 642 B

1234567891011121314151617181920212223242526272829303132333435
  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(int w, int h, int bytesPerPixel)
  10. : width(w)
  11. , height(h)
  12. , data(new unsigned char[width * height * bytesPerPixel]) {
  13. }
  14. virtual ~Bitmap() {
  15. delete [] data;
  16. }
  17. Point2<int> GetSize() const { return Point2<int>(width, height); }
  18. int GetArea() const { return width * height; }
  19. int GetBitmapWidth() const { return width; }
  20. int GetBitmapHeight() const { return height; }
  21. const unsigned char *GetRawData() const { return data; }
  22. };
  23. }