summaryrefslogtreecommitdiff
path: root/include/mercury/kernel/framebuffer.hpp
blob: 677a42ae5ec856b350933b207ccb66a35338ce3b (plain) (blame)
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
#ifndef MERCURY_KERNEL_FRAMEBUFFER_HPP
#define MERCURY_KERNEL_FRAMEBUFFER_HPP

#include <cstdint>

namespace mercury::kernel::framebuffer {

  extern uint32_t *vaddr;
  extern int width;
  extern int height;
  extern int dword_pitch;

  void init_framebuffer(uint64_t vaddr, uint64_t width, uint64_t height, uint64_t pitch);

  typedef uint32_t color;
  color encode_color(uint8_t r, uint8_t g, uint8_t b);

  void set_pixel(int x, int y, color c);

  //[from_start_x, from_end_x) x [from_start_y, from_end_y) -> [to_start_x, ...) x [to_start_y, ...)
  //we assume from_start_x < from_end_x and from_start_y < from_end_y
  void move_region(int from_start_x, int from_start_y, int from_end_x, int from_end_y, int to_start_x, int to_start_y);

  //[start_x, end_x) x [start_y, end_y)
  void fill_region(int start_x, int start_y, int end_x, int end_y, color c);

}

#endif