1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2016 <contributor>
14 */
15
16 #ifndef _GFX_FB_H
17 #define _GFX_FB_H
18
19 /*
20 * Graphics support for loader emulation.
21 */
22 #include <sys/visual_io.h>
23 #include <pnglite.h>
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 struct framebuffer {
30 struct vis_identifier ident;
31 int fd; /* frame buffer device descriptor */
32 uint8_t *fb_addr; /* mapped framebuffer */
33
34 int fb_height; /* in pixels */
35 int fb_width; /* in pixels */
36 int fb_depth; /* bits per pixel */
37 int fb_bpp; /* bytes per pixel */
38 int fb_size; /* total size in bytes */
39 int fb_pitch; /* bytes per scanline */
40 uint16_t terminal_origin_x;
41 uint16_t terminal_origin_y;
42 uint16_t font_width;
43 uint16_t font_height;
44 uint8_t red_mask_size;
45 uint8_t red_field_position;
46 uint8_t green_mask_size;
47 uint8_t green_field_position;
48 uint8_t blue_mask_size;
49 uint8_t blue_field_position;
50 };
51
52 extern struct framebuffer fb;
53
54 void gfx_framework_init(void);
55 void gfx_framework_fini(void);
56 void gfx_fb_setpixel(int x, int y);
57 void gfx_fb_drawrect(int x1, int y1, int x2, int y2, int fill);
58 void gfx_term_drawrect(int row1, int col1, int row2, int col2);
59 void gfx_fb_line(int x0, int y0, int x1, int y1, int width);
60 void gfx_fb_bezier(int x0, int y0, int x1, int y1, int x2, int y2, int width);
61 int gfx_fb_putimage(png_t *);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* _GFX_FB_H */