00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef YFrameBuffer_h
00023 #define YFrameBuffer_h
00024
00025 class YFrameBuffer
00026 {
00027 public:
00028
00029 typedef unsigned short UINT16;
00030 typedef unsigned long UINT32;
00031 typedef UINT32 FBPixel;
00032
00036 YFrameBuffer( int screenWidth, int screenHeight, int bitDepth );
00037
00041 virtual ~YFrameBuffer();
00042
00046 void setPixel( int x, int y, FBPixel pixel );
00047
00051 FBPixel pixel( int x, int y );
00052
00056 bool valid() const { return _fb != 0; }
00057
00058 int width() const { return _width; }
00059 int height() const { return _height; }
00060 int depth() const { return _depth; }
00061 int bytesPerPixel() const { return _bytesPerPixel; }
00062
00063
00064 protected:
00065
00069 void mmapFB();
00070
00074 void munmapFB();
00075
00076
00077
00078
00079 int _width;
00080 int _height;
00081 int _depth;
00082
00083 void * _fb;
00084 int _fb_fd;
00085 UINT32 * _fb32;
00086 UINT16 * _fb16;
00087 size_t _fb_len;
00088 int _bytesPerPixel;
00089 };
00090
00091
00092 #endif // ifndef YFrameBuffer_h