summaryrefslogtreecommitdiff
path: root/kernel/include/graphics.h
blob: e9747815e7968806d023ba128dada7ceb743145e (plain)
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
#ifndef GRAPHICS_H
#define GRAPHICS_H

#include <types.h>

struct fb_t {
	uint64_t addr;
	uint32_t pitch;
	uint32_t width;
	uint32_t height;
	uint8_t bpp;
	uint8_t type;
} __attribute__((packed, aligned(8)));
typedef struct fb_t fb_t;

extern fb_t main_fb;

#define RED 	0x00ff0000
#define GREEN	0x0000ff00
#define BLUE	0x000000ff
#define YELLOW	0x00ffff00
#define PURPLE	0x00ff00ff
#define WHITE	0x00ffffff
#define BLACK	0x00000000

uint32_t* pixel_offset(fb_t fb, uint32_t x, uint32_t y);
void fb_draw_pixel(fb_t fb, int32_t x, int32_t y, uint32_t col);
void fb_draw_line_low(fb_t fb, int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t col);
void fb_draw_line_high(fb_t fb, int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t col);
void fb_draw_line(fb_t fb, int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t col);
void fb_draw_character(fb_t fb, char c, int32_t x, int32_t y, uint32_t char_col, uint32_t bg_col);
void fb_draw_string(fb_t fb, const char* str, int32_t x, int32_t y, uint32_t char_col, uint32_t bg_col);

#endif