-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.hpp
31 lines (24 loc) · 938 Bytes
/
graphics.hpp
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
#ifndef INCLUDED_GRAPHICS_HPP
#define INCLUDED_GRAPHICS_HPP
#include "video.hpp"
struct VGAGraphics {
VGAVideo *video = 0;
// LUT to translate ABCDEFGH to AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH
uint32_t pattern_mask[256];
void compute_pattern_mask();
void draw_char(uint8_t ch, uint8_t co, int x, int y);
void draw_string(int x, int y, uint8_t co, uint8_t *str, int len);
void plot_pixel(int x, int y, uint8_t color);
void and_pixel(int x, int y, uint8_t color);
void or_pixel(int x, int y, uint8_t color);
void mix_pixel(int x, int y, uint8_t mask, uint8_t color);
int read_pixel(int x, int y);
void clear_area(int x, int y, uint8_t color, int w);
void draw_line(int x, int y, uint8_t color, int w);
void copy_area(int sx, int sy, int dx, int dy, int w, int h);
VGAGraphics(VGAVideo *v) {
video = v;
compute_pattern_mask();
}
};
#endif