forked from tano-systems/psplash-tn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsplash-fb.h
115 lines (97 loc) · 2.45 KB
/
psplash-fb.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* pslash - a lightweight framebuffer splashscreen for embedded devices.
*
* Copyright (c) 2006 Matthew Allum <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _HAVE_PSPLASH_FB_H
#define _HAVE_PSPLASH_FB_H
typedef struct PSplashColor
{
uint8 red;
uint8 green;
uint8 blue;
} PSplashColor;
static inline PSplashColor psplash_color_make(
uint8 red,
uint8 green,
uint8 blue
)
{
PSplashColor color = { .red = red, .green = green, .blue = blue };
return color;
}
enum RGBMode
{
RGB565,
BGR565,
RGB888,
BGR888,
GENERIC,
};
typedef struct PSplashFB
{
int fd;
struct fb_var_screeninfo fb_var;
struct termios save_termios;
int type;
int visual;
int width, height;
int bpp;
int stride;
char * data;
char * base;
int angle, fbdev_id;
int real_width, real_height;
/* Support for double buffering */
int double_buffering;
char *bdata;
char *fdata;
enum RGBMode rgbmode;
int red_offset;
int red_length;
int green_offset;
int green_length;
int blue_offset;
int blue_length;
} PSplashFB;
void psplash_fb_destroy(PSplashFB *fb);
PSplashFB *psplash_fb_new(int angle, int fbdev_id);
void psplash_fb_plot_pixel(
PSplashFB *fb, int x, int y, PSplashColor color);
void psplash_fb_draw_box(
PSplashFB *fb,
int x,
int y,
int width,
int height,
int thickness,
PSplashColor color);
void psplash_fb_draw_img(
PSplashImage *image,
PSplashFB *fb,
int x,
int y
);
void psplash_fb_draw_rect(
PSplashFB *fb, int x, int y, int width, int height, PSplashColor color);
void psplash_fb_text_size(int *width, int *height, const PSplashFont *font, const char *text);
void psplash_fb_draw_text(
PSplashFB * fb,
int x,
int y,
PSplashColor color,
const PSplashFont *font,
const char * text);
void psplash_fb_flip(PSplashFB *fb, int sync);
#endif