trunk 20080912
[gitenigma.git] / boot / bootmenue / my_lcd.h
blob9784baf54cdf79236f481fdb31b8e3fc50bf749f
1 #ifndef __my_lcd__
2 #define __my_lcd__
4 #include <dbox/lcd-ks0713.h>
5 #include <string>
7 #define USEFREETYPELCD
8 #define LCD_DEV "/dev/dbox/lcd0"
11 #include <ft2build.h>
12 #include FT_FREETYPE_H
13 #include FT_CACHE_H
14 #include FT_CACHE_SMALL_BITMAPS_H
15 #define FONT "/share/fonts/pakenham.ttf"
18 typedef unsigned char raw_display_t[LCD_ROWS*8][LCD_COLS];
20 class CLCDDisplay
22 #ifdef USEFREETYPELCD
23 FT_Library library;
24 FTC_Manager manager;
25 FTC_SBitCache cache;
26 FTC_SBit sbit;
27 #if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0
28 FTC_ImageDesc desc;
29 #else
30 FTC_ImageTypeRec desc;
31 #endif
32 FT_Face face;
33 FT_UInt prev_glyphindex;
34 int use_kerning;
35 int RenderChar(FT_ULong currentchar, int sx, int sy, int ex, int state);
36 int GetStringLen(unsigned char *string);
37 #endif
38 raw_display_t raw;
39 unsigned char lcd[LCD_ROWS][LCD_COLS];
40 int fd;
41 bool available;
42 void draw_point(const int x, const int y, const int state);
43 int invalid_col(int x);
44 int invalid_row(int y);
45 void convert_data();
47 public:
48 enum {PIXEL_ON = LCD_PIXEL_ON, PIXEL_OFF = LCD_PIXEL_OFF, PIXEL_INV = LCD_PIXEL_INV };
49 enum {LEFT, CENTER, RIGHT};
51 CLCDDisplay();
52 ~CLCDDisplay();
54 #ifdef USEFREETYPELCD
55 FT_Error FTC_Face_Requester(FTC_FaceID face_id, FT_Face* aface);
56 void RenderString(std::string word, int sx, int sy, int maxwidth, int layout, int size, int state);
57 #else
58 void draw_char(int x, int y, char c);
59 void draw_string(int x, int y, const char *string);
60 #endif
62 void clear();
63 void update();
64 void draw_line(const int x1, const int y1, const int x2, const int y2, int state);
65 void draw_fill_rect (int left,int top,int right,int bottom, int state);
66 bool load_png(const char * const filename);
69 #endif