2
0

GUI_Paint.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include "DEV_Config.h"
  29. // Display orientation
  30. #define ROTATE_0 0
  31. #define ROTATE_90 1
  32. #define ROTATE_180 2
  33. #define ROTATE_270 3
  34. // Color inverse. 1 or 0 = set or reset a bit if set a colored pixel
  35. #define IF_INVERT_COLOR 1
  36. #include "fonts.h"
  37. class Paint {
  38. public:
  39. Paint(unsigned char* image, int width, int height);
  40. ~Paint();
  41. void Clear(int colored);
  42. int GetWidth(void);
  43. void SetWidth(int width);
  44. int GetHeight(void);
  45. void SetHeight(int height);
  46. int GetRotate(void);
  47. void SetRotate(int rotate);
  48. unsigned char* GetImage(void);
  49. void DrawAbsolutePixel(int x, int y, int colored);
  50. void DrawPixel(int x, int y, int colored);
  51. void DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored);
  52. void DrawStringAt(int x, int y, const char* text, sFONT* font, int colored);
  53. void DrawLine(int x0, int y0, int x1, int y1, int colored);
  54. void DrawHorizontalLine(int x, int y, int width, int colored);
  55. void DrawVerticalLine(int x, int y, int height, int colored);
  56. void DrawRectangle(int x0, int y0, int x1, int y1, int colored);
  57. void DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored);
  58. void DrawCircle(int x, int y, int radius, int colored);
  59. void DrawFilledCircle(int x, int y, int radius, int colored);
  60. private:
  61. unsigned char* image;
  62. int width;
  63. int height;
  64. int rotate;
  65. };
  66. #endif
  67. /* END OF FILE */