Library for Waveshare 2.7" tri-colour e-Paper display.
epdpaint.h@0:9e6a8e3cd8de, 2019-12-06 (annotated)
- Committer:
- mdroberts1243
- Date:
- Fri Dec 06 23:24:50 2019 +0000
- Revision:
- 0:9e6a8e3cd8de
First commit of code modified from Kanjia examples for 2.13" Waveshare example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mdroberts1243 | 0:9e6a8e3cd8de | 1 | /** |
mdroberts1243 | 0:9e6a8e3cd8de | 2 | * @filename : epdpaint.h |
mdroberts1243 | 0:9e6a8e3cd8de | 3 | * @brief : Header file for epdpaint.cpp |
mdroberts1243 | 0:9e6a8e3cd8de | 4 | * @author : Yehui from Waveshare |
mdroberts1243 | 0:9e6a8e3cd8de | 5 | * |
mdroberts1243 | 0:9e6a8e3cd8de | 6 | * Copyright (C) Waveshare July 28 2017 |
mdroberts1243 | 0:9e6a8e3cd8de | 7 | * |
mdroberts1243 | 0:9e6a8e3cd8de | 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
mdroberts1243 | 0:9e6a8e3cd8de | 9 | * of this software and associated documnetation files (the "Software"), to deal |
mdroberts1243 | 0:9e6a8e3cd8de | 10 | * in the Software without restriction, including without limitation the rights |
mdroberts1243 | 0:9e6a8e3cd8de | 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
mdroberts1243 | 0:9e6a8e3cd8de | 12 | * copies of the Software, and to permit persons to whom the Software is |
mdroberts1243 | 0:9e6a8e3cd8de | 13 | * furished to do so, subject to the following conditions: |
mdroberts1243 | 0:9e6a8e3cd8de | 14 | * |
mdroberts1243 | 0:9e6a8e3cd8de | 15 | * The above copyright notice and this permission notice shall be included in |
mdroberts1243 | 0:9e6a8e3cd8de | 16 | * all copies or substantial portions of the Software. |
mdroberts1243 | 0:9e6a8e3cd8de | 17 | * |
mdroberts1243 | 0:9e6a8e3cd8de | 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
mdroberts1243 | 0:9e6a8e3cd8de | 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
mdroberts1243 | 0:9e6a8e3cd8de | 20 | * FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
mdroberts1243 | 0:9e6a8e3cd8de | 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
mdroberts1243 | 0:9e6a8e3cd8de | 22 | * LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
mdroberts1243 | 0:9e6a8e3cd8de | 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
mdroberts1243 | 0:9e6a8e3cd8de | 24 | * THE SOFTWARE. |
mdroberts1243 | 0:9e6a8e3cd8de | 25 | */ |
mdroberts1243 | 0:9e6a8e3cd8de | 26 | |
mdroberts1243 | 0:9e6a8e3cd8de | 27 | #ifndef EPDPAINT_H |
mdroberts1243 | 0:9e6a8e3cd8de | 28 | #define EPDPAINT_H |
mdroberts1243 | 0:9e6a8e3cd8de | 29 | |
mdroberts1243 | 0:9e6a8e3cd8de | 30 | // Display orientation |
mdroberts1243 | 0:9e6a8e3cd8de | 31 | #define ROTATE_0 0 |
mdroberts1243 | 0:9e6a8e3cd8de | 32 | #define ROTATE_90 1 |
mdroberts1243 | 0:9e6a8e3cd8de | 33 | #define ROTATE_180 2 |
mdroberts1243 | 0:9e6a8e3cd8de | 34 | #define ROTATE_270 3 |
mdroberts1243 | 0:9e6a8e3cd8de | 35 | |
mdroberts1243 | 0:9e6a8e3cd8de | 36 | // Color inverse. 1 or 0 = set or reset a bit if set a colored pixel |
mdroberts1243 | 0:9e6a8e3cd8de | 37 | #define IF_INVERT_COLOR 0 |
mdroberts1243 | 0:9e6a8e3cd8de | 38 | |
mdroberts1243 | 0:9e6a8e3cd8de | 39 | #include "fonts.h" |
mdroberts1243 | 0:9e6a8e3cd8de | 40 | |
mdroberts1243 | 0:9e6a8e3cd8de | 41 | class Paint |
mdroberts1243 | 0:9e6a8e3cd8de | 42 | { |
mdroberts1243 | 0:9e6a8e3cd8de | 43 | public: |
mdroberts1243 | 0:9e6a8e3cd8de | 44 | Paint(unsigned char* image, int width, int height); |
mdroberts1243 | 0:9e6a8e3cd8de | 45 | ~Paint(); |
mdroberts1243 | 0:9e6a8e3cd8de | 46 | void Clear(int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 47 | int GetWidth(void); |
mdroberts1243 | 0:9e6a8e3cd8de | 48 | void SetWidth(int width); |
mdroberts1243 | 0:9e6a8e3cd8de | 49 | int GetHeight(void); |
mdroberts1243 | 0:9e6a8e3cd8de | 50 | void SetHeight(int height); |
mdroberts1243 | 0:9e6a8e3cd8de | 51 | int GetRotate(void); |
mdroberts1243 | 0:9e6a8e3cd8de | 52 | void SetRotate(int rotate); |
mdroberts1243 | 0:9e6a8e3cd8de | 53 | unsigned char* GetImage(void); |
mdroberts1243 | 0:9e6a8e3cd8de | 54 | void DrawAbsolutePixel(int x, int y, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 55 | void DrawPixel(int x, int y, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 56 | void DrawCharAt(int x, int y, char ascii_char, sFONT* font, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 57 | void DrawStringAt(int x, int y, const char* text, sFONT* font, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 58 | void DrawLine(int x0, int y0, int x1, int y1, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 59 | void DrawHorizontalLine(int x, int y, int width, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 60 | void DrawVerticalLine(int x, int y, int height, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 61 | void DrawRectangle(int x0, int y0, int x1, int y1, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 62 | void DrawFilledRectangle(int x0, int y0, int x1, int y1, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 63 | void DrawCircle(int x, int y, int radius, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 64 | void DrawFilledCircle(int x, int y, int radius, int colored); |
mdroberts1243 | 0:9e6a8e3cd8de | 65 | |
mdroberts1243 | 0:9e6a8e3cd8de | 66 | private: |
mdroberts1243 | 0:9e6a8e3cd8de | 67 | unsigned char* image; |
mdroberts1243 | 0:9e6a8e3cd8de | 68 | int width; |
mdroberts1243 | 0:9e6a8e3cd8de | 69 | int height; |
mdroberts1243 | 0:9e6a8e3cd8de | 70 | int rotate; |
mdroberts1243 | 0:9e6a8e3cd8de | 71 | }; |
mdroberts1243 | 0:9e6a8e3cd8de | 72 | |
mdroberts1243 | 0:9e6a8e3cd8de | 73 | #endif |
mdroberts1243 | 0:9e6a8e3cd8de | 74 | |
mdroberts1243 | 0:9e6a8e3cd8de | 75 | /* END OF FILE */ |
mdroberts1243 | 0:9e6a8e3cd8de | 76 |