Project

General

Profile

Statistics
| Revision:

root / proj / graphics.h @ 166

History | View | Annotate | Download (2.51 KB)

1
#ifndef GRAPHICS_H_INCLUDED
2
#define GRAPHICS_H_INCLUDED
3

    
4
#include <lcom/lcf.h>
5
#include <stdint.h>
6

    
7
#define GET_ALP(n)          (0xFF & ((n) >> 24))
8
#define GET_RED(n)          (0xFF & ((n) >> 16))
9
#define GET_GRE(n)          (0xFF & ((n) >>  8))
10
#define GET_BLU(n)          (0xFF & (n      ))
11
#define SET_ALP(n)          (((n)&0xFF) << 24)
12
#define SET_RED(n)          (((n)&0xFF) << 16)
13
#define SET_GRE(n)          (((n)&0xFF) <<  8)
14
#define SET_BLU(n)          (((n)&0xFF)      )
15
#define SET_RGB(r,g,b)      (             SET_RED(r) | SET_GRE(g) | SET_BLU(b))
16
#define SET_ARGB(a,r,g,b)   (SET_ALP(a) | SET_RED(r) | SET_GRE(g) | SET_BLU(b))
17
#define FAR2PHYS(n)         ((((n)>>12) & 0xFFFFFFF0) + ((n) & 0x0000FFFF))
18

    
19
typedef struct __attribute__((packed)) {
20

    
21
    char        VbeSignature[4]     ;
22
    uint16_t    VbeVersion          ;
23
    uint32_t    OemStringPtr        ;
24
    uint8_t     Capabilities[4]     ;
25
    uint32_t    VideoModePtr        ;
26
    uint16_t    TotalMemory         ;
27

    
28
    uint16_t    OemSoftwareRev      ;
29
    uint32_t    OemVendorNamePtr    ;
30
    uint32_t    OemProductNamePtr   ;
31
    uint32_t    OemProductRevPtr    ;
32
    char        Reserved[222]       ;
33

    
34
    char        OemData[256]        ;
35
} VbeInfoBlock;
36

    
37
int (get_permission)(unsigned int base_addr, unsigned int size);
38

    
39
//int (get_permissions_first_mbyte)(void);
40

    
41
int (vbe_get_mode_information)(uint16_t mode);
42

    
43
int (vbe_get_controller_information)(vg_vbe_contr_info_t *info_p);
44

    
45
phys_bytes (graph_get_phys_addr)    (void);
46
unsigned   (graph_get_vram_size)    (void);
47
uint16_t   (graph_get_XRes)         (void);
48
uint16_t   (graph_get_YRes)         (void);
49
uint16_t   (graph_get_bits_pixel)   (void);
50
uint16_t   (graph_get_bytes_pixel)  (void);
51
uint16_t   (graph_get_RedMaskSize)  (void);
52
uint16_t   (graph_get_GreenMaskSize)(void);
53
uint16_t   (graph_get_BlueMaskSize) (void);
54

    
55
int (graph_map_vram)(void);
56

    
57
int (graph_free_memory_map)(void);
58

    
59
int (graph_set_pixel)      (uint16_t x, uint16_t y, uint32_t color);
60
int (graph_set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha);
61

    
62
/**
63
 * @brief
64
 * @param mode
65
 * @return
66
 */
67
int (graph_set_mode)(uint16_t mode);
68

    
69
int (graph_draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color);
70

    
71
int (graph_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color);
72

    
73
int (graph_paint_screen)(uint32_t color);
74

    
75
int (graph_clear_screen)(void);
76

    
77
int (graph_draw)(void);
78

    
79
#endif /* end of include guard: GRAPHICS_H_INCLUDED */