FabGL
ESP32 Display Controller and Graphics Library
vga8controller.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 VGA8_LinesCount 4
56
57
58
59
60namespace fabgl {
61
62
63
83
84public:
85
88
89 // unwanted methods
90 VGA8Controller(VGA8Controller const&) = delete;
91 void operator=(VGA8Controller const&) = delete;
92
93
99 static VGA8Controller * instance() { return s_instance; }
100
101 void readScreen(Rect const & rect, RGB888 * destBuf);
102
114 void setPaletteItem(int index, RGB888 const & color);
115
116 void directSetPixel(int x, int y, int value);
117
118
119protected:
120
121 void setupDefaultPalette();
122
123
124private:
125
126 // abstract method of BitmappedDisplayController
127 void setPixelAt(PixelDesc const & pixelDesc, Rect & updateRect);
128
129 // abstract method of BitmappedDisplayController
130 void drawEllipse(Size const & size, Rect & updateRect);
131
132 // abstract method of BitmappedDisplayController
133 void clear(Rect & updateRect);
134
135 // abstract method of BitmappedDisplayController
136 void VScroll(int scroll, Rect & updateRect);
137
138 // abstract method of BitmappedDisplayController
139 void HScroll(int scroll, Rect & updateRect);
140
141 // abstract method of BitmappedDisplayController
142 void drawGlyph(Glyph const & glyph, GlyphOptions glyphOptions, RGB888 penColor, RGB888 brushColor, Rect & updateRect);
143
144 // abstract method of BitmappedDisplayController
145 void invertRect(Rect const & rect, Rect & updateRect);
146
147 // abstract method of BitmappedDisplayController
148 void copyRect(Rect const & source, Rect & updateRect);
149
150 // abstract method of BitmappedDisplayController
151 void swapFGBG(Rect const & rect, Rect & updateRect);
152
153 // abstract method of BitmappedDisplayController
154 void rawDrawBitmap_Native(int destX, int destY, Bitmap const * bitmap, int X1, int Y1, int XCount, int YCount);
155
156 // abstract method of BitmappedDisplayController
157 void rawDrawBitmap_Mask(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
158
159 // abstract method of BitmappedDisplayController
160 void rawDrawBitmap_RGBA2222(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
161
162 // abstract method of BitmappedDisplayController
163 void rawDrawBitmap_RGBA8888(int destX, int destY, Bitmap const * bitmap, void * saveBackground, int X1, int Y1, int XCount, int YCount);
164
165 // abstract method of BitmappedDisplayController
166 void rawFillRow(int y, int x1, int x2, RGB888 color);
167 void rawFillRow(int y, int x1, int x2, uint8_t colorIndex);
168
169 void rawInvertRow(int y, int x1, int x2);
170
171 void rawCopyRow(int x1, int x2, int srcY, int dstY);
172
173 void swapRows(int yA, int yB, int x1, int x2);
174
175 // abstract method of BitmappedDisplayController
176 void absDrawLine(int X1, int Y1, int X2, int Y2, RGB888 color);
177
178 // abstract method of BitmappedDisplayController
179 int getBitmapSavePixelSize() { return 1; }
180
181 static void ISRHandler(void * arg);
182
183
184 static VGA8Controller * s_instance;
185
186 volatile uint16_t * m_packedPaletteIndexPair_to_signals;
187
188};
189
190
191
192} // end of namespace
193
194
195
196
197
198
199
void setPaletteItem(int index, RGB888 const &color)
Determines color of specified palette item.
static VGA8Controller * instance()
Returns the singleton instance of VGA8Controller class.
Represents the VGA 8 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.