epdpaint.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include "fonts.h"
  36. class Paint {
  37. public:
  38. Paint(unsigned char* image, int width, int height);
  39. ~Paint();
  40. void Clear(int colored);
  41. int GetWidth(void);
  42. void SetWidth(int width);
  43. int GetHeight(void);
  44. void SetHeight(int height);
  45. int GetRotate(void);
  46. void SetRotate(int rotate);
  47. unsigned char* GetImage(void);
  48. void DrawAbsolutePixel(int x, int y, int colored);
  49. void DrawPixel(int x, int y, int colored);
  50. void DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored);
  51. void DrawStringAt(int x, int y, const char* text, sFONT* font, int colored);
  52. void DrawLine(int x0, int y0, int x1, int y1, int colored);
  53. void DrawHorizontalLine(int x, int y, int width, int colored);
  54. void DrawVerticalLine(int x, int y, int height, int colored);
  55. void DrawRectangle(int x0, int y0, int x1, int y1, int colored);
  56. void DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored);
  57. void DrawCircle(int x, int y, int radius, int colored);
  58. void DrawFilledCircle(int x, int y, int radius, int colored);
  59. private:
  60. unsigned char* image;
  61. int width;
  62. int height;
  63. int rotate;
  64. };
  65. #endif
  66. /* END OF FILE */