SayoriOS  0.3.3
basics.c
1 #include <common.h>
2 #include "io/screen.h"
3 
4 void fill_screen(const uint32_t color) {
5  const size_t w = getScreenWidth();
6  const size_t h = getScreenHeight();
7 
8  for(int i = 0; i < h; i++) {
9  for(int j = 0; j < w; j++) {
10  set_pixel(j, i, color);
11  }
12  }
13 }
14 
15 void draw_rectangle(const uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint32_t color) {
16  for(size_t i = x, to = x+w; i < to; i++) {
17  set_pixel(i, y, color);
18  set_pixel(i, y+h, color);
19  }
20 
21  for(size_t j = y, to2 = y+h; j < to2; j++) {
22  set_pixel(x, j, color);
23  set_pixel(x+w, j, color);
24  }
25 
26 }
27 
28 void draw_filled_rectangle(size_t x, size_t y, size_t w, size_t h, const uint32_t fill) {
29  for(register int i = 0; i < h; i++) {
30  for(register int j = 0; j < w; j++) {
31  set_pixel(x+j, y+i, fill);
32  }
33  }
34 }
Основные определения ядра