-
Notifications
You must be signed in to change notification settings - Fork 0
/
video_gr.h
88 lines (77 loc) · 2.83 KB
/
video_gr.h
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
#ifndef __VIDEO_GR_H
#define __VIDEO_GR_H
#include "structs.h"
/** @defgroup video_gr video_gr
* @{
*
* Functions for outputing data to screen in graphics mode
*/
/**
* @brief Initializes the video module in graphics mode
*
* Uses the VBE INT 0x10 interface to set the desired
* graphics mode, maps VRAM to the process' address space and
* initializes static global variables with the resolution of the screen,
* and the number of colors
*
* @param mode 16-bit VBE mode to set
* @return Virtual address VRAM was mapped to. NULL, upon failure.
*/
void * vg_init(unsigned long mode);
int vg_draw(const char * fpath, int height, int width, int x, int y);
int vg_draw_image(int height, int width, char *arr, int x, int y);
int vg_draw_all(deck *d, int x, int y);
//int vg_draw_cards(int n, image** cards, int x, int y);
/**
* @brief Fills the screen with the input color
*
* @param color color to fill the screen with
* @return 0 on success, non-zero upon failure
*/
int vg_fill(unsigned long color);
/**
* @brief Sets input pixel with input color
*
* Sets the color of the pixel at the specified position to the input value,
* by writing to the corresponding location in VRAM
*
* @param x horizontal coordinate, starts at 0 (leftmost pixel)
* @param y vertical coordinate, starts at 0 (top pixel)
* @param color color to set the pixel
* @return 0 on success, non-zero otherwise
*/
int vg_set_pixel(unsigned long x, unsigned long y, unsigned long color);
/**
* @brief Returns the color of the input pixel
*
* Returns the color of the pixel at the specified position,
* by reading to the corresponding location in VRAM
*
* @param x horizontal coordinate, starts at 0 (leftmost pixel)
* @param y vertical coordinate, starts at 0 (top pixel)
* @return color of the pixel at coordinates (x,y), or -1 if some input argument is not valid
*/
unsigned long vg_get_pixel(unsigned long x, unsigned long y);
/**
* @brief Draw line segment with specifed end points and color
*
* Draws a line segment with the specified end points and the input color,
* by writing to VRAM
*
* @param xi horizontal coordinate of "first" endpoint, starts at 0 (leftmost pixel)
* @param yi vertical coordinate of "first" endpoint, starts at 0 (top pixel)
* @param xf horizontal coordinate of "last" endpoint, starts at 0 (leftmost pixel)
* @param yf vertical coordinate of "last" endpoint, starts at 0 (top pixel)
* @param color color of the line segment to draw
* @return 0 upon success, non-zero upon failure
*/
int vg_draw_line(unsigned long xi, unsigned long yi,
unsigned long xf, unsigned long yf, unsigned long color);
/**
* @brief Returns to default Minix 3 text mode (0x03: 25 x 80, 16 colors)
*
* @return 0 upon success, non-zero upon failure
*/
int vg_exit(void);
/** @} end of video_gr */
#endif /* __VIDEO_GR_H */