canvas.h 661 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Canvas header
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #ifndef DORAYME_CANVAS_H
  10. #define DORAYME_CANVAS_H
  11. #include <stdint.h>
  12. #include <colour.h>
  13. class Canvas
  14. {
  15. private:
  16. uint8_t *bitmap;
  17. uint32_t stride;
  18. public:
  19. uint32_t width, height;
  20. Canvas(uint32_t width, uint32_t height);
  21. Canvas(const Canvas *c);
  22. Canvas(const Canvas &c);
  23. Canvas(const char *imgfile);
  24. ~Canvas();
  25. void putPixel(uint32_t x, uint32_t y, Tuple c);
  26. Colour getPixel(uint32_t x, uint32_t y);
  27. bool SaveAsPNG(const char *filename);
  28. };
  29. #endif /* DORAYME_CANVAS_H */