qp_rgb565_surface.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2022 Nick Brassel (@tzarc)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #include "qp_internal.h"
  4. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  5. // Quantum Painter RGB565 surface configurables (add to your keyboard's config.h)
  6. #ifndef RGB565_SURFACE_NUM_DEVICES
  7. /**
  8. * @def This controls the maximum number of surface devices that Quantum Painter can use at any one time.
  9. * Increasing this number allows for multiple framebuffers to be used. Each requires its own RAM allocation.
  10. */
  11. # define RGB565_SURFACE_NUM_DEVICES 1
  12. #endif
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. // Forward declarations
  15. #ifdef QUANTUM_PAINTER_RGB565_SURFACE_ENABLE
  16. /**
  17. * Factory method for an RGB565 surface (aka framebuffer).
  18. *
  19. * @param panel_width[in] the width of the display panel
  20. * @param panel_height[in] the height of the display panel
  21. * @param buffer[in] pointer to a preallocated buffer of size `(sizeof(uint16_t) * panel_width * panel_height)`
  22. * @return the device handle used with all drawing routines in Quantum Painter
  23. */
  24. painter_device_t qp_rgb565_make_surface(uint16_t panel_width, uint16_t panel_height, void *buffer);
  25. /**
  26. * Helper method to draw the dirty contents of the framebuffer to the target device.
  27. *
  28. * After successful completion, the dirty area is reset.
  29. *
  30. * @param surface[in] the surface to copy from
  31. * @param display[in] the display to copy into
  32. * @param x[in] the x-location of the original position of the framebuffer
  33. * @param y[in] the y-location of the original position of the framebuffer
  34. * @return whether the draw operation completed successfully
  35. */
  36. bool qp_rgb565_surface_draw(painter_device_t surface, painter_device_t display, uint16_t x, uint16_t y);
  37. #endif // QUANTUM_PAINTER_RGB565_SURFACE_ENABLE