FabGL
ESP32 Display Controller and Graphics Library
cvbs16controller.h
Go to the documentation of this file.
1/*
2 Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - <http://www.fabgl.com>
3 Copyright (c) 2019-2022 Fabrizio Di Vittorio.
4 All rights reserved.
5
6
7* Please contact fdivitto2013@gmail.com if you need a commercial license.
8
9
10* This library and related software is available under GPL v3.
11
12 FabGL is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 3 of the License, or
15 (at your option) any later version.
16
17 FabGL is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with FabGL. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26
27#pragma once
28
29
30
38#include <stdint.h>
39#include <stddef.h>
40#include <atomic>
41
42#include "freertos/FreeRTOS.h"
43#include "freertos/queue.h"
44
45#include "fabglconf.h"
46#include "fabutils.h"
48
49
50
51namespace fabgl {
52
53
54
55class CVBS16Controller : public CVBSPalettedController {
56
57public:
58
59 CVBS16Controller();
60
61 // unwanted methods
62 CVBS16Controller(CVBS16Controller const&) = delete;
63 void operator=(CVBS16Controller const&) = delete;
64
65 static CVBS16Controller * instance() { return s_instance; }
66
67 void readScreen(Rect const & rect, RGB888 * destBuf);
68
69 void setPaletteItem(int index, RGB888 const & color);
70
71 void setMonochrome(bool value);
72 bool monochrome() { return m_monochrome; }
73
74
75protected:
76
77 void setupDefaultPalette();
78 void checkViewPortSize();
79 void allocateViewPort();
80
81
82private:
83
84
85 // abstract method of BitmappedDisplayController
86 void setPixelAt(PixelDesc const & pixelDesc, Rect & updateRect);
87
88 // abstract method of BitmappedDisplayController
89 void drawEllipse(Size const & size, Rect & updateRect);
90
91 // abstract method of BitmappedDisplayController
92 void clear(Rect & updateRect);
93
94 // abstract method of BitmappedDisplayController
95 void VScroll(int scroll, Rect & updateRect);
96
97 // abstract method of BitmappedDisplayController
98 void HScroll(int scroll, Rect & updateRect);
99
100 // abstract method of BitmappedDisplayController
101 void drawGlyph(Glyph const & glyph, GlyphOptions glyphOptions, RGB888 penColor, RGB888 brushColor, Rect & updateRect);
102
103 // abstract method of BitmappedDisplayController
104 void invertRect(Rect const & rect, Rect & updateRect);
105
106 // abstract method of BitmappedDisplayController
107 void copyRect(Rect const & source, Rect & updateRect);
108
109 // abstract method of BitmappedDisplayController
110 void swapFGBG(Rect const & rect, Rect & updateRect);
111
112 // abstract method of BitmappedDisplayController
113 void rawDrawBitmap_Native(int destX, int destY, Bitmap const * bitmap, int X1, int Y1, int XCount, int YCount);
114
115 // abstract method of BitmappedDisplayController
116 void rawDrawBitmap_Mask(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
117
118 // abstract method of BitmappedDisplayController
119 void rawDrawBitmap_RGBA2222(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
120
121 // abstract method of BitmappedDisplayController
122 void rawDrawBitmap_RGBA8888(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
123
124 // abstract method of BitmappedDisplayController
125 void rawFillRow(int y, int x1, int x2, RGB888 color);
126 void rawFillRow(int y, int x1, int x2, uint8_t colorIndex);
127
128 void rawInvertRow(int y, int x1, int x2);
129
130 void rawCopyRow(int x1, int x2, int srcY, int dstY);
131
132 void swapRows(int yA, int yB, int x1, int x2);
133
134 // abstract method of BitmappedDisplayController
135 void absDrawLine(int X1, int Y1, int X2, int Y2, RGB888 color);
136
137 // abstract method of BitmappedDisplayController
138 int getBitmapSavePixelSize() { return 1; }
139
140 static void drawScanlineX1(void * arg, uint16_t * dest, int destSample, int scanLine);
141 static void drawScanlineX2(void * arg, uint16_t * dest, int destSample, int scanLine);
142 static void drawScanlineX3(void * arg, uint16_t * dest, int destSample, int scanLine);
143
144
145 static CVBS16Controller * s_instance;
146
147 static volatile uint16_t * * s_paletteToRawPixel[2];
148
149 bool m_monochrome;
150
151};
152
153
154
155} // end of namespace
156
157
158
159
160
161
162
This file contains fabgl::CVBSPalettedController definition.
uint8_t swapFGBG
This file contains FabGL library configuration settings, like number of supported colors,...
int16_t X1
Definition: fabutils.h:0
int16_t Y2
Definition: fabutils.h:3
int16_t X2
Definition: fabutils.h:2
int16_t Y1
Definition: fabutils.h:1
This file contains some utility classes and functions.