BaseImage.hh 756 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef BASEIMAGE_HH
  2. #define BASEIMAGE_HH
  3. #include "gl_vec.hh"
  4. #include <cstdint>
  5. namespace openmsx {
  6. class OutputSurface;
  7. class BaseImage
  8. {
  9. public:
  10. /**
  11. * Performs a sanity check on image size.
  12. * Throws MSXException if width or height is excessively large.
  13. * Negative image sizes are valid and flip the image.
  14. */
  15. static void checkSize(gl::ivec2 size);
  16. virtual ~BaseImage() = default;
  17. virtual void draw(OutputSurface& output, gl::ivec2 pos,
  18. uint8_t r, uint8_t g, uint8_t b, uint8_t alpha) = 0;
  19. gl::ivec2 getSize() const { return size; }
  20. void draw(OutputSurface& output, gl::ivec2 pos, uint8_t alpha = 255) {
  21. draw(output, pos, 255, 255, 255, alpha);
  22. }
  23. protected:
  24. gl::ivec2 size;
  25. };
  26. } // namespace openmsx
  27. #endif