forked from apps-cs/apps-lcd-opencv-simul
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph_struct.hpp
More file actions
157 lines (118 loc) · 2.83 KB
/
Copy pathgraph_struct.hpp
File metadata and controls
157 lines (118 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// **************************************************************************
//
// Demo program for labs
//
// Subject: Computer Architectures and Parallel systems
// Author: Petr Olivka, petr.olivka@vsb.cz, 09/2019
// Organization: Department of Computer Science, FEECS,
// VSB-Technical University of Ostrava, CZ
//
// File: OpenCV simulator of LCD
//
// **************************************************************************
#include "lcd_lib.h"
// Simple graphic interface
struct Point2D
{
int32_t x, y;
};
struct RGB
{
uint8_t r, g, b;
};
struct Pixel
{
// Position of Pixel
Point2D m_pos;
// foreground and background color
RGB m_fg_color, m_bg_color;
};
struct Circle
{
// Center of circle
Point2D m_center;
// Radius of circle
int32_t m_radius;
// foreground and background color
RGB m_fg_color, m_bg_color;
};
struct Character
{
// position of character
Point2D m_pos;
// character
char m_character;
// foreground and background color
RGB m_fg_color, m_bg_color;
};
struct Line
{
// the first and the last point of line
Point2D m_pos1, m_pos2;
// foreground and background color
RGB m_fg_color, m_bg_color;
};
// IMPLEMENT!
uint16_t convert_RGB888_to_RGB565( RGB t_color ) { return 0x07E0; /* green color */ }
// swap foreground and backgroud colors
void pixel_swap_fg_bg_color( Pixel *t_pixel )
{ // IMPLEMENT!
}
// draw pixel
void pixel_draw( Pixel *t_pixel )
{
lcd_put_pixel( t_pixel->m_pos.x, t_pixel->m_pos.y,
convert_RGB888_to_RGB565( t_pixel->m_fg_color ) );
}
// hide pixel
void pixel_hide( Pixel *t_pixel )
{
pixel_swap_fg_bg_color( t_pixel );
pixel_draw( t_pixel );
pixel_swap_fg_bg_color( t_pixel );
}
// swap foreground and backgroud colors
void circle_swap_fg_bg_color( Circle *t_circle )
{ // IMPLEMENT!
}
// draw circle
void circle_draw( Circle *t_circle )
{ // IMPLEMENT!
}
// hide circle
void circle_hide( Circle *t_circle )
{
circle_swap_fg_bg_color( t_circle );
circle_draw( t_circle );
circle_swap_fg_bg_color( t_circle );
}
// swap foreground and backgroud colors
void character_swap_fg_bg_color( Character *t_character )
{ // IMPLEMENT!
}
// draw character
void character_draw( Character *t_character )
{ // IMPLEMENT!
}
// hide character
void character_hide( Character *t_character )
{
character_swap_fg_bg_color( t_character );
character_draw( t_character );
character_swap_fg_bg_color( t_character );
}
// swap foreground and backgroud colors
void line_swap_fg_bg_color( Line *t_line )
{ // IMPLEMENT!
}
// draw line
void line_draw( Line *t_line )
{ // IMPLEMENT!
}
// hide line
void line_hide( Line *t_line )
{
line_swap_fg_bg_color( t_line );
line_draw( t_line );
line_swap_fg_bg_color( t_line );
}