epdpaint.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /**
  2. * @filename : epdpaint.h
  3. * @brief : Header file for epdpaint.cpp
  4. * @author : Yehui from Waveshare
  5. *
  6. * Copyright (C) Waveshare July 28 2017
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a copy
  9. * of this software and associated documnetation files (the "Software"), to deal
  10. * in the Software without restriction, including without limitation the rights
  11. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  12. * copies of the Software, and to permit persons to whom the Software is
  13. * furished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included in
  16. * all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  21. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  22. * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  24. * THE SOFTWARE.
  25. */
  26. #ifndef EPDPAINT_H
  27. #define EPDPAINT_H
  28. // Display orientation
  29. #define ROTATE_0 0
  30. #define ROTATE_90 1
  31. #define ROTATE_180 2
  32. #define ROTATE_270 3
  33. // Color inverse. 1 or 0 = set or reset a bit if set a colored pixel
  34. #define IF_INVERT_COLOR 1
  35. #define LUAT_EINK_SPI_DEVICE 255
  36. #include "u8g2.h"
  37. typedef struct Paint_t {
  38. unsigned char* image;
  39. uint16_t width;
  40. uint16_t height;
  41. uint16_t rotate;
  42. uint16_t inited;
  43. } Paint;
  44. void Paint_Init(Paint* paint, unsigned char* image, int width, int height);
  45. void Paint_Clear(Paint* paint, int colored);
  46. int Paint_GetWidth(Paint* paint);
  47. void Paint_SetWidth(Paint* paint, int width);
  48. int Paint_GetHeight(Paint* paint);
  49. void Paint_SetHeight(Paint* paint, int height);
  50. int Paint_GetRotate(Paint* paint);
  51. void Paint_SetRotate(Paint* paint, int rotate);
  52. unsigned char* Paint_GetImage(Paint* paint);
  53. void Paint_DrawAbsolutePixel(Paint* paint, int x, int y, int colored);
  54. void Paint_DrawPixel(Paint* paint, int x, int y, int colored);
  55. void Paint_DrawLine(Paint* paint, int x0, int y0, int x1, int y1, int colored);
  56. void Paint_DrawHorizontalLine(Paint* paint, int x, int y, int width, int colored);
  57. void Paint_DrawVerticalLine(Paint* paint, int x, int y, int height, int colored);
  58. void Paint_DrawRectangle(Paint* paint, int x0, int y0, int x1, int y1, int colored);
  59. void Paint_DrawFilledRectangle(Paint* paint, int x0, int y0, int x1, int y1, int colored);
  60. void Paint_DrawCircle(Paint* paint, int x, int y, int radius, int colored);
  61. void Paint_DrawFilledCircle(Paint* paint, int x, int y, int radius, int colored);
  62. #endif
  63. /* END OF FILE */