FabGL
ESP32 Display Controller and Graphics Library
vga16controller.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 "driver/gpio.h"
43
44#include "freertos/FreeRTOS.h"
45#include "freertos/queue.h"
46
47#include "fabglconf.h"
48#include "fabutils.h"
50#include "displaycontroller.h"
52
53
54
55#define VGA16_LinesCount 4
56
57
58
59
60namespace fabgl {
61
62
63
83
84public:
85
87
88 // unwanted methods
89 VGA16Controller(VGA16Controller const&) = delete;
90 void operator=(VGA16Controller const&) = delete;
91
92
98 static VGA16Controller * instance() { return s_instance; }
99
100 void readScreen(Rect const & rect, RGB888 * destBuf);
101
113 void setPaletteItem(int index, RGB888 const & color);
114
115
116protected:
117
118 void setupDefaultPalette();
119
120
121private:
122
123
124 // abstract method of BitmappedDisplayController
125 void setPixelAt(PixelDesc const & pixelDesc, Rect & updateRect);
126
127 // abstract method of BitmappedDisplayController
128 void drawEllipse(Size const & size, Rect & updateRect);
129
130 // abstract method of BitmappedDisplayController
131 void clear(Rect & updateRect);
132
133 // abstract method of BitmappedDisplayController
134 void VScroll(int scroll, Rect & updateRect);
135
136 // abstract method of BitmappedDisplayController
137 void HScroll(int scroll, Rect & updateRect);
138
139 // abstract method of BitmappedDisplayController
140 void drawGlyph(Glyph const & glyph, GlyphOptions glyphOptions, RGB888 penColor, RGB888 brushColor, Rect & updateRect);
141
142 // abstract method of BitmappedDisplayController
143 void invertRect(Rect const & rect, Rect & updateRect);
144
145 // abstract method of BitmappedDisplayController
146 void copyRect(Rect const & source, Rect & updateRect);
147
148 // abstract method of BitmappedDisplayController
149 void swapFGBG(Rect const & rect, Rect & updateRect);
150
151 // abstract method of BitmappedDisplayController
152 void rawDrawBitmap_Native(int destX, int destY, Bitmap const * bitmap, int X1, int Y1, int XCount, int YCount);
153
154 // abstract method of BitmappedDisplayController
155 void rawDrawBitmap_Mask(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
156
157 // abstract method of BitmappedDisplayController
158 void rawDrawBitmap_RGBA2222(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
159
160 // abstract method of BitmappedDisplayController
161 void rawDrawBitmap_RGBA8888(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
162
163 // abstract method of BitmappedDisplayController
164 void rawFillRow(int y, int x1, int x2, RGB888 color);
165 void rawFillRow(int y, int x1, int x2, uint8_t colorIndex);
166
167 void rawInvertRow(int y, int x1, int x2);
168
169 void rawCopyRow(int x1, int x2, int srcY, int dstY);
170
171 void swapRows(int yA, int yB, int x1, int x2);
172
173 // abstract method of BitmappedDisplayController
174 void absDrawLine(int X1, int Y1, int X2, int Y2, RGB888 color);
175
176 // abstract method of BitmappedDisplayController
177 int getBitmapSavePixelSize() { return 1; }
178
179 static void ISRHandler(void * arg);
180
181
182 static VGA16Controller * s_instance;
183
184 volatile uint16_t m_packedPaletteIndexPair_to_signals[256];
185
186};
187
188
189
190} // end of namespace
191
192
193
194
195
196
197
void setPaletteItem(int index, RGB888 const &color)
Determines color of specified palette item.
static VGA16Controller * instance()
Returns the singleton instance of VGA16Controller class.
Represents the VGA 16 colors bitmapped controller.
Represents the base class for paletted bitmapped controllers like VGA16Controller,...
This file contains fabgl::BitmappedDisplayController definition.
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.
Represents an image.
Represents a glyph position, size and binary data.
Represents a 24 bit RGB color.
Represents a rectangle.
Definition: fabutils.h:248
Represents a bidimensional size.
Definition: fabutils.h:231
This file contains fabgl::GPIOStream definition.
Specifies various glyph painting options.
This file contains fabgl::VGAPalettedController definition.