]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/YFrameBuffer.h
- Don't create layouts with parent. Qt 4.x automatically reparents
[duncan/yast2-qt4.git] / src / YFrameBuffer.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQFrameBuffer.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YFrameBuffer_h
21 #define YFrameBuffer_h
22
23 class YFrameBuffer
24 {
25 public:
26
27     typedef unsigned short UINT16;
28     typedef unsigned long UINT32;
29     typedef UINT32 FBPixel;
30
31     /**
32      * Constructor
33      **/
34     YFrameBuffer( int screenWidth, int screenHeight, int bitDepth );
35
36     /**
37      * Destructor
38      **/
39     virtual ~YFrameBuffer();
40
41     /**
42      * Set the framebuffer pixel at (x, y)
43      **/
44     void setPixel( int x, int y, FBPixel pixel );
45
46     /**
47      * Get the framebuffer pixel value at (x, y)
48      **/
49     FBPixel pixel( int x, int y );
50
51     /**
52      * Returns 'true' if the framebuffer is valid, i.e. can be used.
53      **/
54     bool valid()        const { return _fb != 0; }
55
56     int width()         const { return _width;          }
57     int height()        const { return _height;         }
58     int depth()         const { return _depth;          }
59     int bytesPerPixel() const { return _bytesPerPixel;  }
60
61
62 protected:
63
64     /**
65      * mmap() the framebuffer device
66      **/
67     void mmapFB();
68
69     /**
70      * release the mmaped framebuffer
71      **/
72     void munmapFB();
73
74     
75     //
76     // Data members
77     //
78
79     int         _width;
80     int         _height;
81     int         _depth;
82
83     void *      _fb;
84     int         _fb_fd;
85     UINT32 *    _fb32;
86     UINT16 *    _fb16;
87     size_t      _fb_len;
88     int         _bytesPerPixel;
89 };
90
91
92 #endif // ifndef YFrameBuffer_h