aboutsummaryrefslogtreecommitdiff
path: root/lib/gdi/fb.h
blob: d0ad6fed0bc5e970b847c843e46324b02d843b70 (plain)
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
#ifndef __FB_H
#define __FB_H

#include <linux/fb.h>
#include <lib/base/eerror.h>

class fbClass
{
	int fd;
	unsigned int xRes, yRes, stride, bpp;
	int available;
	struct fb_var_screeninfo screeninfo, oldscreen;
	fb_cmap cmap;
	__u16 red[256], green[256], blue[256], trans[256];
	static fbClass *instance;
	
	int locked;
public:
	unsigned char *lfb;
	int showConsole(int state);
	int SetMode(unsigned int xRes, unsigned int yRes, unsigned int bpp);
	int Available() { return available; }
	unsigned int Stride() { return stride; }
	fb_cmap *CMAP() { return &cmap; }

	fbClass(const char *fb="/dev/fb/0");
	~fbClass();
	
	static fbClass *getInstance();

				// low level gfx stuff
	int PutCMAP();

				// gfx stuff (colors are 8bit!)
	void Box(int x, int y, int width, int height, int color, int backcolor=0);
	void NBox(int x, int y, int width, int height, int color);
	void VLine(int x, int y, int sy, int color);
	
	int lock();
	void unlock();
};

#endif