Add gbs.conf
[profile/ivi/psplash.git] / psplash-fb.h
1 /* 
2  *  pslash - a lightweight framebuffer splashscreen for embedded devices. 
3  *
4  *  Copyright (c) 2006 Matthew Allum <mallum@o-hand.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  */
17
18 #ifndef _HAVE_PSPLASH_FB_H
19 #define _HAVE_PSPLASH_FB_H
20
21 enum RGBMode {
22     RGB565,
23     BGR565,
24     RGB888,
25     BGR888,
26     GENERIC,
27 };
28
29 typedef struct PSplashFB
30 {
31   int            fd;                    
32   struct termios save_termios;          
33   int            type;                  
34   int            visual;                
35   int            width, height;
36   int            bpp;
37   int            stride;
38   char          *data;
39   char          *base;
40
41   int            angle;
42   int            real_width, real_height;
43
44   enum RGBMode   rgbmode;
45   int            red_offset;
46   int            red_length;
47   int            green_offset;
48   int            green_length;
49   int            blue_offset;
50   int            blue_length;
51 }
52 PSplashFB;
53
54 void
55 psplash_fb_destroy (PSplashFB *fb);
56
57 PSplashFB*
58 psplash_fb_new (int angle);
59
60 inline void
61 psplash_fb_plot_pixel (PSplashFB    *fb, 
62                        int          x, 
63                        int          y, 
64                        uint8        red,
65                        uint8        green,
66                        uint8        blue);
67
68 void
69 psplash_fb_draw_rect (PSplashFB    *fb, 
70                       int          x, 
71                       int          y, 
72                       int          width, 
73                       int          height,
74                       uint8        red,
75                       uint8        green,
76                       uint8        blue);
77
78 void
79 psplash_fb_draw_image (PSplashFB    *fb, 
80                        int          x, 
81                        int          y, 
82                        int          img_width, 
83                        int          img_height,
84                        int          img_bytes_pre_pixel,
85                        uint8       *rle_data);
86
87 void
88 psplash_fb_text_size (PSplashFB          *fb,
89                       int                *width, 
90                       int                *height,
91                       const PSplashFont  *font,
92                       const char         *text);
93
94 void
95 psplash_fb_draw_text (PSplashFB         *fb, 
96                       int                x, 
97                       int                y, 
98                       uint8              red,
99                       uint8              green,
100                       uint8              blue,
101                       const PSplashFont *font,
102                       const char        *text);
103
104
105 #endif