[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / drivers / display_canvas.h
blobe70ee1c96ee1784a07f5e86237b9de663c89e565
1 /*
2 * This file is part of Cleanflight, Betaflight and INAV.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
24 * @author Alberto Garcia Hierro <alberto@garciahierro.com>
27 #pragma once
29 #include <stdbool.h>
30 #include <stdint.h>
32 typedef enum {
33 DISPLAY_CANVAS_BITMAP_OPT_INVERT_COLORS = 1 << 0,
34 DISPLAY_CANVAS_BITMAP_OPT_SOLID_BACKGROUND = 1 << 1,
35 DISPLAY_CANVAS_BITMAP_OPT_ERASE_TRANSPARENT = 1 << 2,
36 } displayCanvasBitmapOption_t;
38 typedef enum {
39 DISPLAY_CANVAS_COLOR_BLACK = 0,
40 DISPLAY_CANVAS_COLOR_TRANSPARENT = 1,
41 DISPLAY_CANVAS_COLOR_WHITE = 2,
42 DISPLAY_CANVAS_COLOR_GRAY = 3,
43 } displayCanvasColor_e;
45 typedef enum {
46 DISPLAY_CANVAS_OUTLINE_TYPE_NONE = 0,
47 DISPLAY_CANVAS_OUTLINE_TYPE_TOP = 1 << 0,
48 DISPLAY_CANVAS_OUTLINE_TYPE_RIGHT = 1 << 1,
49 DISPLAY_CANVAS_OUTLINE_TYPE_BOTTOM = 1 << 2,
50 DISPLAY_CANVAS_OUTLINE_TYPE_LEFT = 1 << 3,
51 } displayCanvasOutlineType_e;
53 struct displayCanvasVTable_s;
55 typedef struct displayCanvas_s {
56 const struct displayCanvasVTable_s *vTable;
57 void *device;
58 uint16_t width;
59 uint16_t height;
60 uint8_t gridElementWidth;
61 uint8_t gridElementHeight;
62 } displayCanvas_t;
64 typedef struct displayCanvasVTable_s {
65 void (*setStrokeColor)(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
66 void (*setFillColor)(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
67 void (*setStrokeAndFillColor)(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
68 void (*setColorInversion)(displayCanvas_t *displayCanvas, bool inverted);
69 void (*setPixel)(displayCanvas_t *displayCanvas, int x, int y, displayCanvasColor_e color);
70 void (*setPixelToStrokeColor)(displayCanvas_t *displayCanvas, int x, int y);
71 void (*setPixelToFillColor)(displayCanvas_t *displayCanvas, int x, int y);
72 void (*setStrokeWidth)(displayCanvas_t *displayCanvas, unsigned w);
73 void (*setLineOutlineType)(displayCanvas_t *displayCanvas, displayCanvasOutlineType_e outlineType);
74 void (*setLineOutlineColor)(displayCanvas_t *displayCanvas, displayCanvasColor_e outlineColor);
76 void (*clipToRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
77 void (*clearRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
78 void (*resetDrawingState)(displayCanvas_t *displayCanvas);
79 void (*drawCharacter)(displayCanvas_t *displayCanvas, int x, int y, uint16_t chr, displayCanvasBitmapOption_t opts);
80 void (*drawCharacterMask)(displayCanvas_t *displayCanvas, int x, int y, uint16_t chr, displayCanvasColor_e color, displayCanvasBitmapOption_t opts);
81 void (*drawString)(displayCanvas_t *displayCanvas, int x, int y, const char *s, displayCanvasBitmapOption_t opts);
82 void (*drawStringMask)(displayCanvas_t *displayCanvas, int x, int y, const char *s, displayCanvasColor_e color, displayCanvasBitmapOption_t opts);
83 void (*moveToPoint)(displayCanvas_t *displayCanvas, int x, int y);
84 void (*strokeLineToPoint)(displayCanvas_t *displayCanvas, int x, int y);
85 void (*strokeTriangle)(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
86 void (*fillTriangle)(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
87 void (*fillStrokeTriangle)(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
88 void (*strokeRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
89 void (*fillRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
90 void (*fillStrokeRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
91 void (*strokeEllipseInRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
92 void (*fillEllipseInRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
93 void (*fillStrokeEllipseInRect)(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
95 void (*ctmReset)(displayCanvas_t *displayCanvas);
96 void (*ctmSet)(displayCanvas_t *displayCanvas, float m11, float m12, float m21, float m22, float m31, float m32);
97 void (*ctmTranslate)(displayCanvas_t *displayCanvas, float tx, float ty);
98 void (*ctmScale)(displayCanvas_t *displayCanvas, float sx, float sy);
99 void (*ctmRotate)(displayCanvas_t *displayCanvas, float r);
101 void (*contextPush)(displayCanvas_t *displayCanvas);
102 void (*contextPop)(displayCanvas_t *displayCanvas);
103 } displayCanvasVTable_t;
106 void displayCanvasSetStrokeColor(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
107 void displayCanvasSetFillColor(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
108 void displayCanvasSetStrokeAndFillColor(displayCanvas_t *displayCanvas, displayCanvasColor_e color);
109 void displayCanvasSetColorInversion(displayCanvas_t *displayCanvas, bool inverted);
110 void displayCanvasSetPixel(displayCanvas_t *displayCanvas, int x, int y, displayCanvasColor_e);
111 void displayCanvasSetPixelToStrokeColor(displayCanvas_t *displayCanvas, int x, int y);
112 void displayCanvasSetPixelToFillColor(displayCanvas_t *displayCanvas, int x, int y);
113 void displayCanvasSetStrokeWidth(displayCanvas_t *displayCanvas, unsigned w);
114 void displayCanvasSetLineOutlineType(displayCanvas_t *displayCanvas, displayCanvasOutlineType_e outlineType);
115 void displayCanvasSetLineOutlineColor(displayCanvas_t *displayCanvas, displayCanvasColor_e outlineColor);
117 void displayCanvasClipToRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
118 void displayCanvasClearRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
119 void displayCanvasResetDrawingState(displayCanvas_t *displayCanvas);
120 void displayCanvasDrawCharacter(displayCanvas_t *displayCanvas, int x, int y, uint16_t chr, displayCanvasBitmapOption_t opts);
121 void displayCanvasDrawCharacterMask(displayCanvas_t *displayCanvas, int x, int y, uint16_t chr, displayCanvasColor_e color, displayCanvasBitmapOption_t opts);
122 void displayCanvasDrawString(displayCanvas_t *displayCanvas, int x, int y, const char *s, displayCanvasBitmapOption_t opts);
123 void displayCanvasDrawStringMask(displayCanvas_t *displayCanvas, int x, int y, const char *s, displayCanvasColor_e color, displayCanvasBitmapOption_t opts);
124 void displayCanvasMoveToPoint(displayCanvas_t *displayCanvas, int x, int y);
125 void displayCanvasStrokeLineToPoint(displayCanvas_t *displayCanvas, int x, int y);
126 void displayCanvasStrokeTriangle(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
127 void displayCanvasFillTriangle(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
128 void displayCanvasFillStrokeTriangle(displayCanvas_t *displayCanvas, int x1, int y1, int x2, int y2, int x3, int y3);
129 void displayCanvasStrokeRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
130 void displayCanvasFillRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
131 void displayCanvasFillStrokeRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
132 void displayCanvasStrokeEllipseInRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
133 void displayCanvasFillEllipseInRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
134 void displayCanvasFillStrokeEllipseInRect(displayCanvas_t *displayCanvas, int x, int y, int w, int h);
136 void displayCanvasCtmReset(displayCanvas_t *displayCanvas);
137 void displayCanvasCtmSet(displayCanvas_t *displayCanvas, float m11, float m12, float m21, float m22, float m31, float m32);
138 void displayCanvasCtmTranslate(displayCanvas_t *displayCanvas, float tx, float ty);
139 void displayCanvasCtmScale(displayCanvas_t *displayCanvas, float sx, float sy);
140 void displayCanvasCtmRotate(displayCanvas_t *displayCanvas, float r);
142 void displayCanvasContextPush(displayCanvas_t *displayCanvas);
143 void displayCanvasContextPop(displayCanvas_t *displayCanvas);