4.2inch e-Paper HAT (C) made by WAVESHARE

Dependents:   ePD_4R2inch_test_program_on_nRF52

Committer:
kenjiArai
Date:
Wed Aug 28 23:35:01 2019 +0000
Revision:
1:b1aa1d6a96bc
Parent:
0:825022100d0f
for 4.2inch e-Paper

Who changed what in which revision?

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