trunk 20080912
[gitenigma.git] / boot / bootmenue / my_fb.h
blob24cbf5b50ae337b161c2057710ee613c59d02ae8
1 #ifndef __FB_H__
2 #define __FB_H__
4 #include <crypt.h>
5 #include <dbox/fp.h>
6 #include <signal.h>
7 #include <unistd.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <fcntl.h>
11 #include <memory.h>
12 #include <sys/ioctl.h>
13 #include <sys/mman.h>
14 #include <linux/kd.h>
15 #include <linux/fb.h>
16 #include <errno.h>
17 #include <string>
19 #define USEFREETYPEFB
20 #define FB_DEV "/dev/fb/0"
22 #ifdef USEFREETYPEFB
23 #include <ft2build.h>
24 #include FT_FREETYPE_H
25 #include FT_CACHE_H
26 #include FT_CACHE_SMALL_BITMAPS_H
27 #define FONT "/share/fonts/pakenham.ttf"
28 #endif
31 class fbClass
33 #ifdef USEFREETYPEFB
34 FT_Library library;
35 FTC_Manager manager;
36 FTC_SBitCache cache;
37 FTC_SBit sbit;
38 #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0
39 FTC_ImageDesc desc;
40 #else
41 FTC_ImageTypeRec desc;
42 #endif
43 FT_Face face;
44 FT_UInt prev_glyphindex;
45 int use_kerning;
46 int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int r, int g, int b);
47 int GetStringLen(unsigned char *string);
48 #endif
49 int fd, available;
50 unsigned int xRes, yRes, stride, bpp;
51 unsigned long x_stride;
52 struct fb_var_screeninfo screeninfo, oldscreen;
53 unsigned short red[256], green[256], blue[256], trans[256];
55 static fbClass *instance;
56 int showConsole(int state);
58 void blit2FB(void *fbbuff,unsigned char *alpha,unsigned int pic_xs,unsigned int pic_ys,unsigned int scr_xs,unsigned int scr_ys, unsigned int xp, unsigned int yp,unsigned int xoffs, unsigned int yoffs,int cpp);
60 void make332map();
61 void make8map();
62 void palette();
64 void PaintPixel(int x, int y, int r, int g, int b);
66 unsigned char *lfb;
67 unsigned char* c_rect_buffer;
68 int c_rect_buffer_cpp;
70 public:
71 enum {LEFT, CENTER, RIGHT};
72 static fbClass *getInstance();
73 fbClass();
74 ~fbClass();
76 int SetSAA(int value);//setzt den saa
77 int SetMode(unsigned int nxRes, unsigned int nyRes, unsigned int nbpp);//setzt den Framebuffer
78 #ifdef USEFREETYPEFB
79 FT_Error FTC_Face_Requester(FTC_FaceID face_id, FT_Face* aface);
80 void RenderString(std::string word, int sx, int sy, int maxwidth, int layout, int size, int r, int g, int b);
81 #else
82 int DrawString( int xpos, int ypos, int height, const char *msg, int r,int g, int b);
83 #endif
84 void FillRect(int x, int y, int width, int height, int r, int g, int b);
85 void DrawRect( int x, int y, int width, int height, int r, int g, int b);
86 void DrawVLine(int x, int y, int sy, int r, int g, int b);
87 void DrawHLine(int x, int y, int sx, int r, int g, int b);
88 void RenderCircle(int sx, int sy, int r, int g, int b);
89 void fb_display(unsigned char *rgbbuff,unsigned char * alpha,int x_size,int y_size,int x_pan,int y_pan,int x_offs,int y_offs);//für Bilder
90 void W_buffer(int sx, int sy, int width, int height); //stellt den Bildausschnitt wieder her
91 void Fill_buffer(int sx, int sy, int width, int height);//merkt sich einen Bildausschnitt
94 #endif //__FB_H__