Project

General

Profile

Revision 174

refactored graph

View differences:

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

  
7
#define GET_ALP(n)          (0xFF & ((n) >> 24))
7
/// MACROS
8
//#define GET_ALP(n)          (0xFF & ((n) >> 24))
8 9
#define GET_RED(n)          (0xFF & ((n) >> 16))
9 10
#define GET_GRE(n)          (0xFF & ((n) >>  8))
10 11
#define GET_BLU(n)          (0xFF & (n      ))
11
#define SET_ALP(n)          (((n)&0xFF) << 24)
12
//#define SET_ALP(n)          (((n)&0xFF) << 24)
12 13
#define SET_RED(n)          (((n)&0xFF) << 16)
13 14
#define SET_GRE(n)          (((n)&0xFF) <<  8)
14 15
#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))
16
#define SET_RGB(r,g,b)      (SET_RED(r) | SET_GRE(g) | SET_BLU(b))
18 17

  
19
typedef struct __attribute__((packed)) {
18
/// PUBLIC GET
19
uint16_t   (graph_get_XRes)         (void);
20
uint16_t   (graph_get_YRes)         (void);
20 21

  
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         ;
22
/// INIT
23
int (graph_init)(uint16_t mode);
27 24

  
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 (graph_init)(uint16_t mode);
25
/// CLEANUP
42 26
int (graph_cleanup)(void);
43 27

  
44
int (vbe_get_mode_information)(uint16_t mode);
28
/// PIXEL DRAWING
29
int (graph_set_pixel)      (uint16_t x, uint16_t y, uint32_t color);
30
int (graph_set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha);
45 31

  
46
int (vbe_get_controller_information)(vg_vbe_contr_info_t *info_p);
32
/// SCREEN
33
int (graph_clear_screen)(void);
47 34

  
48
phys_bytes (graph_get_phys_addr)    (void);
49
unsigned   (graph_get_vram_size)    (void);
50
uint16_t   (graph_get_XRes)         (void);
51
uint16_t   (graph_get_YRes)         (void);
52
uint16_t   (graph_get_bits_pixel)   (void);
53
uint16_t   (graph_get_bytes_pixel)  (void);
54
uint16_t   (graph_get_RedMaskSize)  (void);
55
uint16_t   (graph_get_GreenMaskSize)(void);
56
uint16_t   (graph_get_BlueMaskSize) (void);
35
/// DRAW
36
int (graph_draw)(void);
57 37

  
58
int (graph_map_vram)(void);
59 38

  
60
int (graph_free_memory)(void);
61 39

  
62
int (graph_set_pixel)      (uint16_t x, uint16_t y, uint32_t color);
63
int (graph_set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha);
40
/// RECTANGLE
64 41

  
65
/**
66
 * @brief
67
 * @param mode
68
 * @return
69
 */
70
int (graph_set_mode)(uint16_t mode);
71 42

  
72 43
int (graph_draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color);
73

  
74 44
int (graph_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color);
75 45

  
76
int (graph_paint_screen)(uint32_t color);
77

  
78
int (graph_clear_screen)(void);
79

  
80
int (graph_draw)(void);
81

  
82 46
#endif /* end of include guard: GRAPH_H_INCLUDED */

Also available in: Unified diff