2008-05-27 Robert Bragg <bob@o-hand.com>
[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 typedef struct PSplashFB
22 {
23   int            fd;                    
24   struct termios save_termios;          
25   int            type;                  
26   int            visual;                
27   int            width, height;
28   int            bpp;
29   int            stride;
30   char          *data;
31   char          *base;
32
33   int            angle;
34   int            real_width, real_height;
35 }
36 PSplashFB;
37
38 void
39 psplash_fb_destroy (PSplashFB *fb);
40
41 PSplashFB*
42 psplash_fb_new (int angle);
43
44 inline void
45 psplash_fb_plot_pixel (PSplashFB    *fb, 
46                        int          x, 
47                        int          y, 
48                        uint8        red,
49                        uint8        green,
50                        uint8        blue);
51
52 void
53 psplash_fb_draw_rect (PSplashFB    *fb, 
54                       int          x, 
55                       int          y, 
56                       int          width, 
57                       int          height,
58                       uint8        red,
59                       uint8        green,
60                       uint8        blue);
61
62 void
63 psplash_fb_draw_image (PSplashFB    *fb, 
64                        int          x, 
65                        int          y, 
66                        int          img_width, 
67                        int          img_height,
68                        int          img_bytes_pre_pixel,
69                        uint8       *rle_data);
70
71 void
72 psplash_fb_text_size (PSplashFB          *fb,
73                       int                *width, 
74                       int                *height,
75                       const PSplashFont  *font,
76                       const char         *text);
77
78 void
79 psplash_fb_draw_text (PSplashFB         *fb, 
80                       int                x, 
81                       int                y, 
82                       uint8              red,
83                       uint8              green,
84                       uint8              blue,
85                       const PSplashFont *font,
86                       const char        *text);
87
88
89 #endif