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
|
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2016 Toomas Some <tsoome@me.com>
*/
#ifndef _GFX_FB_H
#define _GFX_FB_H
/*
* Graphics support for loader emulation.
*/
#include <sys/visual_io.h>
#include <pnglite.h>
#ifdef __cplusplus
extern "C" {
#endif
struct framebuffer {
struct vis_identifier ident;
int fd; /* frame buffer device descriptor */
uint8_t *fb_addr; /* mapped framebuffer */
int fb_height; /* in pixels */
int fb_width; /* in pixels */
int fb_depth; /* bits per pixel */
int fb_bpp; /* bytes per pixel */
int fb_size; /* total size in bytes */
int fb_pitch; /* bytes per scanline */
uint16_t terminal_origin_x;
uint16_t terminal_origin_y;
uint16_t font_width;
uint16_t font_height;
uint8_t red_mask_size;
uint8_t red_field_position;
uint8_t green_mask_size;
uint8_t green_field_position;
uint8_t blue_mask_size;
uint8_t blue_field_position;
};
extern struct framebuffer fb;
void gfx_framework_init(void);
void gfx_framework_fini(void);
void gfx_fb_setpixel(uint32_t, uint32_t);
void gfx_fb_drawrect(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
void gfx_term_drawrect(uint32_t, uint32_t, uint32_t, uint32_t);
void gfx_fb_line(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
void gfx_fb_bezier(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t,
uint32_t);
int gfx_fb_putimage(png_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t);
#ifdef __cplusplus
}
#endif
#endif /* _GFX_FB_H */
|