Xyris  0.5
graphics.hpp
Go to the documentation of this file.
1 /**
2  * @file graphics.cpp
3  * @author Keeton Feavel ([email protected])
4  * @author Michel (JMallone) Gomes ([email protected])
5  * @brief Graphics management and control
6  * @version 0.2
7  * @date 2021-07-24
8  *
9  * @copyright Copyright the Xyris Contributors (c) 2021
10  *
11  * References:
12  * https://wiki.osdev.org/Double_Buffering
13  */
14 #pragma once
15 #include <stdint.h>
17 
18 namespace Graphics {
19 
20 /**
21  * @brief Initializes the framebuffer (if available)
22  *
23  */
24 void init(Framebuffer* fb);
25 
26 /**
27  * @brief Draws a pixel at a given coordinate.
28  *
29  * @param x X-axis coordinate
30  * @param y Y-axis coordinate
31  * @param color Hex color
32  */
33 void pixel(uint32_t x, uint32_t y, uint32_t color);
34 
35 /**
36  * @brief Draws and fills a rectangle of a given width and height, and color
37  * at the provided coordinates.
38  *
39  * @param x X-axis coordinate
40  * @param y Y-axis coordinate
41  * @param w Width
42  * @param h Height
43  * @param color Hex color
44  */
45 void putrect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color);
46 
47 /**
48  * @brief Fill the backbuffer with '0'.
49  *
50  */
51 void resetDoubleBuffer();
52 
53 /**
54  * @brief Swap the data on backbuffer to memory video buffer
55  * and show in the screen.
56  *
57  */
58 void swap();
59 
60 }; // !namespace graphics
Graphics::pixel
void pixel(uint32_t x, uint32_t y, uint32_t color)
Draws a pixel at a given coordinate.
Definition: graphics.cpp:53
framebuffer.hpp
Graphics::swap
void swap()
Swap the data on backbuffer to memory video buffer and show in the screen.
Definition: graphics.cpp:93
Graphics::resetDoubleBuffer
void resetDoubleBuffer()
Fill the backbuffer with '0'.
Definition: graphics.cpp:86
Graphics
Definition: font.cpp:17
Graphics::putrect
void putrect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color)
Draws and fills a rectangle of a given width and height, and color at the provided coordinates.
Definition: graphics.cpp:71
Graphics::init
void init(Framebuffer *fb)
Initializes the framebuffer (if available)
Definition: graphics.cpp:32