FabGL
ESP32 VGA Controller and Graphics Library
vgacontroller.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 Fabrizio Di Vittorio.
4  All rights reserved.
5 
6  This file is part of FabGL Library.
7 
8  FabGL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  FabGL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with FabGL. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #pragma once
24 
25 
26 
34 #include <stdint.h>
35 #include <stddef.h>
36 #include <atomic>
37 
38 #include "rom/lldesc.h"
39 #include "driver/gpio.h"
40 
41 #include "freertos/FreeRTOS.h"
42 #include "freertos/queue.h"
43 
44 #include "fabglconf.h"
45 #include "fabutils.h"
46 
47 
48 
49 
50 namespace fabgl {
51 
52 
53 
54 
55 
61  Sync,
64 };
65 
66 
68 struct Timings {
69  char label[22];
70  int frequency;
71  int16_t HVisibleArea;
72  int16_t HFrontPorch;
73  int16_t HSyncPulse;
74  int16_t HBackPorch;
75  int16_t VVisibleArea;
76  int16_t VFrontPorch;
77  int16_t VSyncPulse;
78  int16_t VBackPorch;
79  char HSyncLogic;
80  char VSyncLogic;
81  uint8_t scanCount;
82  uint8_t multiScanBlack;
84 };
85 
86 
87 
88 /*
89  Notes:
90  - all positions can have negative and outofbound coordinates. Shapes are always clipped correctly.
91 */
92 enum PrimitiveCmd {
93  // Set current pen color
94  // params: color
95  SetPenColor,
96 
97  // Set current brush color
98  // params: color
99  SetBrushColor,
100 
101  // Paint a pixel at specified coordinates, using current pen color
102  // params: color
103  SetPixel,
104 
105  // Paint a pixel at specified coordinates using the specified color
106  // params: pixelDesc
107  SetPixelAt,
108 
109  // Move current position to the specified one
110  // params: point
111  MoveTo,
112 
113  // Draw a line from current position to the specified one, using current pen color. Update current position.
114  // params: point
115  LineTo,
116 
117  // Fill a rectangle using current brush color
118  // params: rect
119  FillRect,
120 
121  // Draw a rectangle using current pen color
122  // params: rect
123  DrawRect,
124 
125  // Fill an ellipse, current position is the center, using current brush color
126  // params: size
127  FillEllipse,
128 
129  // Draw an ellipse, current position is the center, using current pen color
130  // params: size
131  DrawEllipse,
132 
133  // Fill viewport with brush color
134  // params: none
135  Clear,
136 
137  // Scroll vertically without copying buffers
138  // params: ivalue (scroll amount, can be negative)
139  VScroll,
140 
141  // Scroll horizontally (time consuming operation!)
142  // params: ivalue (scroll amount, can be negative)
143  HScroll,
144 
145  // Draw a glyph (BW image)
146  // params: glyph
147  DrawGlyph,
148 
149  // Set paint options
150  // params: glyphOptions
151  SetGlyphOptions,
152 
153  // Set gluph options
154  // params: paintOptions
155  SetPaintOptions,
156 
157  // Invert a rectangle
158  // params: rect
159  InvertRect,
160 
161  // Copy (overlapping) rectangle to current position
162  // params: rect (source rectangle)
163  CopyRect,
164 
165  // Set scrolling region
166  // params: rect
167  SetScrollingRegion,
168 
169  // Swap foreground (pen) and background (brush) colors of all pixels inside the specified rectangles. Other colors remain untaltered.
170  // params: rect
171  SwapFGBG,
172 
173  // Render glyphs buffer
174  // params: glyphsBufferRenderInfo
175  RenderGlyphsBuffer,
176 
177  // Draw a bitmap
178  // params: bitmapDrawingInfo
179  DrawBitmap,
180 
181  // Refresh sprites
182  // no params
183  RefreshSprites,
184 
185  // Swap buffers (m_doubleBuffered must be True)
186  SwapBuffers,
187 
188  // Fill a path, using current brush color
189  // params: path
190  FillPath,
191 
192  // Draw a path, using current pen color
193  // params: path
194  DrawPath,
195 
196  // Set axis origin
197  // params: point
198  SetOrigin,
199 
200  // Set clipping rectangle
201  // params: rect
202  SetClippingRect,
203 };
204 
205 
206 
212 enum Color {
214  Red,
229 };
230 
231 
232 
239 struct RGB {
240  uint8_t R : 2;
241  uint8_t G : 2;
242  uint8_t B : 2;
244  RGB() : R(0), G(0), B(0) { }
245  RGB(Color color);
246  RGB(uint8_t red, uint8_t green, uint8_t blue) : R(red), G(green), B(blue) { }
247 };
248 
249 
250 inline bool operator==(RGB const& lhs, RGB const& rhs)
251 {
252  return lhs.R == rhs.R && lhs.G == rhs.G && lhs.B == rhs.B;
253 }
254 
255 
256 inline bool operator!=(RGB const& lhs, RGB const& rhs)
257 {
258  return lhs.R != rhs.R || lhs.G != rhs.G || lhs.B == rhs.B;
259 }
260 
261 
262 
268 struct Glyph {
269  int16_t X;
270  int16_t Y;
271  int16_t width;
272  int16_t height;
273  uint8_t const * data;
275  Glyph() : X(0), Y(0), width(0), height(0), data(nullptr) { }
276  Glyph(int X_, int Y_, int width_, int height_, uint8_t const * data_) : X(X_), Y(Y_), width(width_), height(height_), data(data_) { }
277 };
278 
279 
280 
285  struct {
286  uint16_t fillBackground : 1;
287  uint16_t bold : 1;
288  uint16_t reduceLuminosity : 1;
289  uint16_t italic : 1;
290  uint16_t invert : 1;
291  uint16_t blank : 1;
292  uint16_t underline : 1;
293  uint16_t doubleWidth : 2;
294  uint16_t userOpt1 : 1;
295  uint16_t userOpt2 : 1;
296  };
297  uint16_t value;
298 
300  GlyphOptions & FillBackground(bool value) { fillBackground = value; return *this; }
301 
303  GlyphOptions & Bold(bool value) { bold = value; return *this; }
304 
306  GlyphOptions & Italic(bool value) { italic = value; return *this; }
307 
309  GlyphOptions & Underline(bool value) { underline = value; return *this; }
310 
312  GlyphOptions & DoubleWidth(uint8_t value) { doubleWidth = value; return *this; }
313 
315  GlyphOptions & Invert(uint8_t value) { invert = value; return *this; }
316 };
317 
318 
319 
320 // GlyphsBuffer.map support functions
321 // 0 .. 7 : index
322 // 8 .. 11 : BG color (Color)
323 // 12 .. 15 : FG color (Color)
324 // 16 .. 31 : options (GlyphOptions)
325 // note: volatile pointer to avoid optimizer to get less than 32 bit from 32 bit access only memory
326 #define GLYPHMAP_INDEX_BIT 0
327 #define GLYPHMAP_BGCOLOR_BIT 8
328 #define GLYPHMAP_FGCOLOR_BIT 12
329 #define GLYPHMAP_OPTIONS_BIT 16
330 #define GLYPHMAP_ITEM_MAKE(index, bgColor, fgColor, options) (((uint32_t)(index) << GLYPHMAP_INDEX_BIT) | ((uint32_t)(bgColor) << GLYPHMAP_BGCOLOR_BIT) | ((uint32_t)(fgColor) << GLYPHMAP_FGCOLOR_BIT) | ((uint32_t)((options).value) << GLYPHMAP_OPTIONS_BIT))
331 inline uint8_t glyphMapItem_getIndex(uint32_t const volatile * mapItem) { return *mapItem >> GLYPHMAP_INDEX_BIT & 0xFF; }
332 inline Color glyphMapItem_getBGColor(uint32_t const volatile * mapItem) { return (Color)(*mapItem >> GLYPHMAP_BGCOLOR_BIT & 0x0F); }
333 inline Color glyphMapItem_getFGColor(uint32_t const volatile * mapItem) { return (Color)(*mapItem >> GLYPHMAP_FGCOLOR_BIT & 0x0F); }
334 inline GlyphOptions glyphMapItem_getOptions(uint32_t const volatile * mapItem) { return (GlyphOptions){.value = (uint16_t)(*mapItem >> GLYPHMAP_OPTIONS_BIT & 0xFFFF)}; }
335 inline void glyphMapItem_setOptions(uint32_t volatile * mapItem, GlyphOptions const & options) { *mapItem = (*mapItem & ~((uint32_t)0xFFFF << GLYPHMAP_OPTIONS_BIT)) | ((uint32_t)(options.value) << GLYPHMAP_OPTIONS_BIT); }
336 
337 struct GlyphsBuffer {
338  int16_t glyphsWidth;
339  int16_t glyphsHeight;
340  uint8_t const * glyphsData;
341  int16_t columns;
342  int16_t rows;
343  uint32_t * map; // look at glyphMapItem_... inlined functions
344 };
345 
346 
347 struct GlyphsBufferRenderInfo {
348  int16_t itemX; // starts from 0
349  int16_t itemY; // starts from 0
350  GlyphsBuffer const * glyphsBuffer;
351 
352  GlyphsBufferRenderInfo(int itemX_, int itemY_, GlyphsBuffer const * glyphsBuffer_) : itemX(itemX_), itemY(itemY_), glyphsBuffer(glyphsBuffer_) { }
353 };
354 
355 
367 struct Bitmap {
368  int16_t width;
369  int16_t height;
370  uint8_t const * data;
373  Bitmap() : width(0), height(0), data(nullptr), dataAllocated(false) { }
374  Bitmap(int width_, int height_, void const * data_, bool copy = false);
375  Bitmap(int width_, int height_, void const * data_, int bitsPerPixel, RGB foregroundColor, bool copy = false);
376  ~Bitmap();
377 };
378 
379 
380 struct BitmapDrawingInfo {
381  int16_t X;
382  int16_t Y;
383  Bitmap const * bitmap;
384 
385  BitmapDrawingInfo(int X_, int Y_, Bitmap const * bitmap_) : X(X_), Y(Y_), bitmap(bitmap_) { }
386 };
387 
388 
392 enum CursorName : uint8_t {
412 };
413 
414 
418 struct Cursor {
419  int16_t hotspotX;
420  int16_t hotspotY;
422 };
423 
424 
425 struct QuadTreeObject;
426 
427 
436 struct Sprite {
437  volatile int16_t x;
438  volatile int16_t y;
439  Bitmap const * * frames; // array of pointer to Bitmap
440  int16_t framesCount;
441  int16_t currentFrame;
442  int16_t savedX;
443  int16_t savedY;
444  int16_t savedBackgroundWidth;
445  int16_t savedBackgroundHeight;
446  uint8_t * savedBackground;
447  QuadTreeObject * collisionDetectorObject;
448  struct {
449  uint8_t visible: 1;
450  // A static sprite should be positioned before dynamic sprites.
451  // It is never re-rendered unless allowDraw is 1. Static sprites always sets allowDraw=0 after drawings.
452  uint8_t isStatic: 1;
453  // This is always '1' for dynamic sprites and always '0' for static sprites.
454  uint8_t allowDraw: 1;
455  };
456 
457  Sprite();
458  ~Sprite();
459  Bitmap const * getFrame() { return frames ? frames[currentFrame] : nullptr; }
460  int getFrameIndex() { return currentFrame; }
461  void nextFrame() { ++currentFrame; if (currentFrame >= framesCount) currentFrame = 0; }
462  Sprite * setFrame(int frame) { currentFrame = frame; return this; }
463  Sprite * addBitmap(Bitmap const * bitmap);
464  Sprite * addBitmap(Bitmap const * bitmap[], int count);
465  void clearBitmaps();
466  int getWidth() { return frames[currentFrame]->width; }
467  int getHeight() { return frames[currentFrame]->height; }
468  void allocRequiredBackgroundBuffer();
469  Sprite * move(int offsetX, int offsetY, bool wrapAround = true);
470  Sprite * moveTo(int x, int y);
471 };
472 
473 
474 struct Path {
475  Point const * points;
476  int pointsCount;
477 };
478 
479 
483 struct PaintOptions {
484  uint8_t swapFGBG : 1;
485  uint8_t NOT : 1;
487  PaintOptions() : swapFGBG(false), NOT(false) { }
488 };
489 
490 
491 struct PixelDesc {
492  Point pos;
493  RGB color;
494 };
495 
496 
497 struct Primitive {
498  PrimitiveCmd cmd;
499  union {
500  int16_t ivalue;
501  RGB color;
502  Point position;
503  Size size;
504  Glyph glyph;
505  Rect rect;
506  GlyphOptions glyphOptions;
507  PaintOptions paintOptions;
508  GlyphsBufferRenderInfo glyphsBufferRenderInfo;
509  BitmapDrawingInfo bitmapDrawingInfo;
510  Path path;
511  PixelDesc pixelDesc;
512  };
513 
514  Primitive() { }
515 };
516 
517 
518 struct PaintState {
519  RGB penColor;
520  RGB brushColor;
521  Point position; // value already traslated to "origin"
522  GlyphOptions glyphOptions;
523  PaintOptions paintOptions;
524  Rect scrollingRegion;
525  Point origin;
526  Rect clippingRect; // relative clipping rectangle
527  Rect absClippingRect; // actual absolute clipping rectangle (calculated when setting "origin" or "clippingRect")
528 };
529 
530 
553 
554 public:
555 
572  void begin(gpio_num_t redGPIO, gpio_num_t greenGPIO, gpio_num_t blueGPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO);
573 
593  void begin(gpio_num_t red1GPIO, gpio_num_t red0GPIO, gpio_num_t green1GPIO, gpio_num_t green0GPIO, gpio_num_t blue1GPIO, gpio_num_t blue0GPIO, gpio_num_t HSyncGPIO, gpio_num_t VSyncGPIO);
594 
605  void begin();
606 
614  uint8_t getBitsPerChannel() { return m_bitsPerChannel; }
615 
643  void setResolution(char const * modeline, int viewPortWidth = -1, int viewPortHeight = -1, bool doubleBuffered = false);
644 
645  void setResolution(Timings const& timings, int viewPortWidth = -1, int viewPortHeight = -1, bool doubleBuffered = false);
646 
647  Timings * getResolutionTimings() { return &m_timings; }
648 
654  int getScreenWidth() { return m_timings.HVisibleArea; }
655 
661  int getScreenHeight() { return m_timings.VVisibleArea; }
662 
668  int getViewPortCol() { return m_viewPortCol; }
669 
675  int getViewPortRow() { return m_viewPortRow; }
676 
682  int getViewPortWidth() { return m_viewPortWidth; }
683 
689  int getViewPortHeight() { return m_viewPortHeight; }
690 
691  void addPrimitive(Primitive const & primitive);
692 
693  void primitivesExecutionWait();
694 
706  void enableBackgroundPrimitiveExecution(bool value);
707 
717 
724 
731  void processPrimitives();
732 
746  void moveScreen(int offsetX, int offsetY);
747 
762  void shrinkScreen(int shrinkX, int shrinkY);
763 
787  template <typename T>
788  void setSprites(T * sprites, int count) {
789  setSprites(sprites, count, sizeof(T));
790  }
791 
797  void removeSprites() { setSprites(nullptr, 0, 0); }
798 
807  void refreshSprites();
808 
814  bool isDoubleBuffered() { return m_doubleBuffered; }
815 
821  void setMouseCursor(Cursor const * cursor);
822 
832  void setMouseCursor(CursorName cursorName);
833 
840  void setMouseCursorPos(int X, int Y);
841 
868  void readScreen(Rect const & rect, RGB * destBuf);
869 
896  void writeScreen(Rect const & rect, RGB * srcBuf);
897 
898 private:
899 
900  void init(gpio_num_t VSyncGPIO);
901 
902  uint8_t packHVSync(bool HSync = false, bool VSync = false);
903  uint8_t preparePixel(RGB rgb, bool HSync = false, bool VSync = false);
904 
905  void freeBuffers();
906  void fillHorizBuffers(int offsetX);
907  void fillVertBuffers(int offsetY);
908  int fill(uint8_t volatile * buffer, int startPos, int length, uint8_t red, uint8_t green, uint8_t blue, bool hsync, bool vsync);
909  void allocateViewPort();
910  void freeViewPort();
911  int calcRequiredDMABuffersCount(int viewPortHeight);
912 
913  void execPrimitive(Primitive const & prim);
914 
915  void execSetPixel(Point const & position);
916  void execSetPixelAt(PixelDesc const & pixelDesc);
917  void execLineTo(Point const & position);
918  void execFillRect(Rect const & rect);
919  void execDrawRect(Rect const & rect);
920  void execFillEllipse(Size const & size);
921  void execDrawEllipse(Size const & size);
922  void execClear();
923  void execVScroll(int scroll);
924  void execHScroll(int scroll);
925  void execDrawGlyph(Glyph const & glyph, GlyphOptions glyphOptions, RGB penColor, RGB brushColor);
926  void execDrawGlyph_full(Glyph const & glyph, GlyphOptions glyphOptions, RGB penColor, RGB brushColor);
927  void execDrawGlyph_light(Glyph const & glyph, GlyphOptions glyphOptions, RGB penColor, RGB brushColor);
928  void execInvertRect(Rect const & rect);
929  void execCopyRect(Rect const & source);
930  void execSwapFGBG(Rect const & rect);
931  void execRenderGlyphsBuffer(GlyphsBufferRenderInfo const & glyphsBufferRenderInfo);
932  void execDrawBitmap(BitmapDrawingInfo const & bitmapDrawingInfo);
933  void execSwapBuffers();
934  void execDrawPath(Path const & path);
935  void execFillPath(Path const & path);
936 
937  void updateAbsoluteClippingRect();
938 
939  void drawBitmap(int destX, int destY, Bitmap const * bitmap, uint8_t * saveBackground, bool ignoreClippingRect);
940 
941  void fillRow(int y, int x1, int x2, uint8_t pattern);
942  void swapRows(int yA, int yB, int x1, int x2);
943 
944  void drawLine(int X1, int Y1, int X2, int Y2, uint8_t pattern);
945 
946  void hideSprites();
947  void showSprites();
948 
949  void setSprites(Sprite * sprites, int count, int spriteSize);
950 
951  static void VSyncInterrupt();
952 
953  static void setupGPIO(gpio_num_t gpio, int bit, gpio_mode_t mode);
954 
955  // DMA related methods
956  bool setDMABuffersCount(int buffersCount);
957  void setDMABufferBlank(int index, void volatile * address, int length);
958  void setDMABufferView(int index, int row, int scan, volatile uint8_t * * viewPort, bool onVisibleDMA);
959  void setDMABufferView(int index, int row, int scan);
960  void volatile * getDMABuffer(int index, int * length);
961 
962  int m_bitsPerChannel; // 1 = 8 colors, 2 = 64 colors, set by begin()
963  Timings m_timings;
964  int16_t m_linesCount;
965  volatile int16_t m_maxVSyncISRTime; // Maximum us VSync interrupt routine can run
966 
967  // These buffers contains a full line, with FrontPorch, Sync, BackPorch and blank visible area, in the
968  // order specified by timings.HStartingBlock
969  volatile uint8_t * m_HBlankLine_withVSync;
970  volatile uint8_t * m_HBlankLine;
971  int16_t m_HLineSize;
972 
973  bool m_doubleBuffered;
974 
975  volatile int16_t m_viewPortCol;
976  volatile int16_t m_viewPortRow;
977  volatile int16_t m_viewPortWidth;
978  volatile int16_t m_viewPortHeight;
979 
980  // when double buffer is enabled the "drawing" view port is always m_viewPort, while the "visible" view port is always m_viewPortVisible
981  // when double buffer is not enabled then m_viewPort = m_viewPortVisible
982  volatile uint8_t * * m_viewPort;
983  volatile uint8_t * * m_viewPortVisible;
984 
985  uint8_t * m_viewPortMemoryPool[FABGLIB_VIEWPORT_MEMORY_POOL_COUNT + 1]; // last allocated pool is nullptr
986 
987  volatile QueueHandle_t m_execQueue;
988  PaintState m_paintState;
989 
990  // when double buffer is enabled the running DMA buffer is always m_DMABuffersRunning
991  // when double buffer is not enabled then m_DMABuffers = m_DMABuffersRunning
992  lldesc_t volatile * m_DMABuffersHead;
993  lldesc_t volatile * m_DMABuffers;
994  lldesc_t volatile * m_DMABuffersVisible;
995 
996  int m_DMABuffersCount;
997 
998  gpio_num_t m_VSyncGPIO;
999  int m_VSyncInterruptSuspended; // 0 = enabled, >0 suspended
1000  bool m_backgroundPrimitiveExecutionEnabled; // when False primitives are execute immediately
1001 
1002  void * m_sprites; // pointer to array of sprite structures
1003  int m_spriteSize; // size of sprite structure
1004  int m_spritesCount; // number of sprites in m_sprites array
1005 
1006  bool m_spritesHidden; // true between hideSprites() and showSprites()
1007 
1008  // mouse cursor (mouse pointer) support
1009  Sprite m_mouseCursor;
1010  int16_t m_mouseHotspotX;
1011  int16_t m_mouseHotspotY;
1012 
1013 };
1014 
1015 
1016 
1017 } // end of namespace
1018 
1019 
1020 extern fabgl::VGAControllerClass VGAController;
1021 
1022 
1023 
1024 
Definition: vgacontroller.h:404
int16_t height
Definition: vgacontroller.h:369
uint16_t blank
Definition: vgacontroller.h:291
Definition: vgacontroller.h:393
Definition: vgacontroller.h:394
Defines a cursor.
Definition: vgacontroller.h:418
Represents an RGB color.
Definition: vgacontroller.h:239
Definition: vgacontroller.h:222
uint8_t R
Definition: vgacontroller.h:240
Represents a sprite.
Definition: vgacontroller.h:436
Definition: vgacontroller.h:213
Definition: vgacontroller.h:225
int getViewPortWidth()
Determines horizontal size of the viewport.
Definition: vgacontroller.h:682
Definition: vgacontroller.h:219
Definition: vgacontroller.h:228
int getViewPortHeight()
Determines vertical size of the viewport.
Definition: vgacontroller.h:689
uint16_t italic
Definition: vgacontroller.h:289
Color
This enum defines named colors.
Definition: vgacontroller.h:212
Definition: vgacontroller.h:218
int getViewPortRow()
Determines vertical position of the viewport.
Definition: vgacontroller.h:675
void setMouseCursorPos(int X, int Y)
Sets mouse cursor position.
Definition: vgacontroller.cpp:2261
void processPrimitives()
Draws immediately all primitives in the queue.
Definition: vgacontroller.cpp:807
GlyphOptions & Bold(bool value)
Helper method to set or reset bold.
Definition: vgacontroller.h:303
void shrinkScreen(int shrinkX, int shrinkY)
Reduces or expands screen size by the specified horizontal and vertical offset.
Definition: vgacontroller.cpp:600
GlyphOptions & FillBackground(bool value)
Helper method to set or reset fillBackground.
Definition: vgacontroller.h:300
Definition: vgacontroller.h:216
int16_t width
Definition: vgacontroller.h:368
Definition: vgacontroller.h:217
int16_t HSyncPulse
Definition: vgacontroller.h:73
Definition: vgacontroller.h:63
uint8_t NOT
Definition: vgacontroller.h:485
uint16_t invert
Definition: vgacontroller.h:290
uint8_t const * data
Definition: vgacontroller.h:273
uint8_t const * data
Definition: vgacontroller.h:370
GlyphOptions & Invert(uint8_t value)
Helper method to set or reset foreground and background swapping.
Definition: vgacontroller.h:315
uint16_t doubleWidth
Definition: vgacontroller.h:293
int frequency
Definition: vgacontroller.h:70
int getViewPortCol()
Determines horizontal position of the viewport.
Definition: vgacontroller.h:668
void setMouseCursor(Cursor const *cursor)
Sets mouse cursor and make it visible.
Definition: vgacontroller.cpp:2232
Definition: vgacontroller.h:406
void moveScreen(int offsetX, int offsetY)
Moves screen by specified horizontal and vertical offset.
Definition: vgacontroller.cpp:591
Definition: vgacontroller.h:60
Definition: vgacontroller.h:61
void begin()
This is the 64 colors (8 GPIOs) initializer using default pinout.
Definition: vgacontroller.cpp:175
void enableBackgroundPrimitiveExecution(bool value)
Enables or disables drawings inside vertical retracing time.
Definition: vgacontroller.cpp:751
ScreenBlock
Represents one of the four blocks of horizontal or vertical line.
Definition: vgacontroller.h:59
Represents a glyph position, size and binary data.
Definition: vgacontroller.h:268
Definition: vgacontroller.h:409
GlyphOptions & Underline(bool value)
Helper method to set or reset underlined.
Definition: vgacontroller.h:309
Represents the coordinate of a point.
Definition: fabutils.h:125
Represents an image with 64 colors image and transparency.
Definition: vgacontroller.h:367
Definition: vgacontroller.h:224
Definition: vgacontroller.h:220
This file contains some utility classes and functions.
int16_t VSyncPulse
Definition: vgacontroller.h:77
Definition: canvas.cpp:47
CursorName
This enum defines a set of predefined mouse cursors.
Definition: vgacontroller.h:392
Definition: vgacontroller.h:215
uint16_t bold
Definition: vgacontroller.h:287
char VSyncLogic
Definition: vgacontroller.h:80
int16_t hotspotX
Definition: vgacontroller.h:419
void setResolution(char const *modeline, int viewPortWidth=-1, int viewPortHeight=-1, bool doubleBuffered=false)
Sets current resolution using linux-like modeline.
Definition: vgacontroller.cpp:286
int16_t HBackPorch
Definition: vgacontroller.h:74
Represents the VGA controller.
Definition: vgacontroller.h:552
Specifies various glyph painting options.
Definition: vgacontroller.h:284
Represents a rectangle.
Definition: fabutils.h:158
uint8_t getBitsPerChannel()
Gets number of bits allocated for each channel.
Definition: vgacontroller.h:614
ScreenBlock HStartingBlock
Definition: vgacontroller.h:83
GlyphOptions & Italic(bool value)
Helper method to set or reset italic.
Definition: vgacontroller.h:306
Definition: vgacontroller.h:221
Definition: vgacontroller.h:395
void refreshSprites()
Forces the sprites to be updated.
Definition: vgacontroller.cpp:2053
char HSyncLogic
Definition: vgacontroller.h:79
void setSprites(T *sprites, int count)
Sets the list of active sprites.
Definition: vgacontroller.h:788
int16_t X
Definition: vgacontroller.h:269
Definition: vgacontroller.h:396
Definition: vgacontroller.h:398
int16_t HFrontPorch
Definition: vgacontroller.h:72
int16_t VVisibleArea
Definition: vgacontroller.h:75
Definition: vgacontroller.h:411
void removeSprites()
Empties the list of active sprites.
Definition: vgacontroller.h:797
int16_t width
Definition: vgacontroller.h:271
This file contains FabGL library configuration settings, like number of supported colors...
uint8_t scanCount
Definition: vgacontroller.h:81
int16_t VFrontPorch
Definition: vgacontroller.h:76
int getScreenHeight()
Determines the screen height in pixels.
Definition: vgacontroller.h:661
Definition: vgacontroller.h:62
Represents a bidimensional size.
Definition: fabutils.h:143
Definition: vgacontroller.h:407
int getScreenWidth()
Determines the screen width in pixels.
Definition: vgacontroller.h:654
void readScreen(Rect const &rect, RGB *destBuf)
Reads pixels inside the specified rectangle.
Definition: vgacontroller.cpp:1937
Definition: vgacontroller.h:214
GlyphOptions & DoubleWidth(uint8_t value)
Helper method to set or reset doubleWidth.
Definition: vgacontroller.h:312
int16_t Y
Definition: vgacontroller.h:270
Definition: vgacontroller.h:410
Specifies the VGA timings. This is a modeline decoded.
Definition: vgacontroller.h:68
Definition: vgacontroller.h:226
uint16_t fillBackground
Definition: vgacontroller.h:286
uint8_t multiScanBlack
Definition: vgacontroller.h:82
uint8_t B
Definition: vgacontroller.h:242
void suspendBackgroundPrimitiveExecution()
Suspends drawings.
Definition: vgacontroller.cpp:769
uint16_t reduceLuminosity
Definition: vgacontroller.h:288
Definition: vgacontroller.h:227
uint16_t userOpt2
Definition: vgacontroller.h:295
Definition: vgacontroller.h:397
uint8_t G
Definition: vgacontroller.h:241
Definition: vgacontroller.h:405
Definition: vgacontroller.h:223
Definition: vgacontroller.h:399
Definition: vgacontroller.h:408
uint16_t userOpt1
Definition: vgacontroller.h:294
#define FABGLIB_VIEWPORT_MEMORY_POOL_COUNT
Definition: fabglconf.h:111
Definition: vgacontroller.h:402
Definition: vgacontroller.h:403
void writeScreen(Rect const &rect, RGB *srcBuf)
Writes pixels inside the specified rectangle.
Definition: vgacontroller.cpp:1949
uint16_t underline
Definition: vgacontroller.h:292
int16_t VBackPorch
Definition: vgacontroller.h:78
Specifies general paint options.
Definition: vgacontroller.h:483
char label[22]
Definition: vgacontroller.h:69
int16_t HVisibleArea
Definition: vgacontroller.h:71
uint8_t swapFGBG
Definition: vgacontroller.h:484
void resumeBackgroundPrimitiveExecution()
Resumes drawings after suspendBackgroundPrimitiveExecution().
Definition: vgacontroller.cpp:779
Bitmap bitmap
Definition: vgacontroller.h:421
Definition: vgacontroller.h:401
int16_t height
Definition: vgacontroller.h:272
bool dataAllocated
Definition: vgacontroller.h:371
bool isDoubleBuffered()
Determines whether VGAControllerClass is on double buffered mode.
Definition: vgacontroller.h:814
Definition: vgacontroller.h:400
int16_t hotspotY
Definition: vgacontroller.h:420