libg15render
libg15render.h
Go to the documentation of this file.
1 #ifndef LIBG15RENDER_H_
2 #define LIBG15RENDER_H_
3 
4 #ifdef __cplusplus
5 extern "C"
6 {
7 #endif
8 
9 #include <string.h>
10 
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14 
15 #ifdef TTF_SUPPORT
16 #include <ft2build.h>
17 #include FT_FREETYPE_H
18 #include FT_BITMAP_H
19 #endif
20 
21 #define BYTE_SIZE 8
22 #define G15_BUFFER_LEN 1048
23 #define G15_LCD_OFFSET 32
24 #define G15_LCD_HEIGHT 43
25 #define G15_LCD_WIDTH 160
26 #define G15_COLOR_WHITE 0
27 #define G15_COLOR_BLACK 1
28 #define G15_TEXT_SMALL 0
29 #define G15_TEXT_MED 1
30 #define G15_TEXT_LARGE 2
31 #define G15_PIXEL_NOFILL 0
32 #define G15_PIXEL_FILL 1
33 #define G15_MAX_FACE 5
34 
36  typedef struct g15canvas
37  {
39  unsigned char buffer[G15_BUFFER_LEN];
41  int mode_xor;
46 #ifdef TTF_SUPPORT
47  FT_Library ftLib;
48  FT_Face ttf_face[G15_MAX_FACE][sizeof (FT_Face)];
50 #endif
51  } g15canvas;
52 
54  void g15r_pixelReverseFill (g15canvas * canvas, int x1, int y1, int x2,
55  int y2, int fill, int color);
57  void g15r_pixelOverlay (g15canvas * canvas, int x1, int y1, int width,
58  int height, short colormap[]);
60  void g15r_drawLine (g15canvas * canvas, int px1, int py1, int px2, int py2,
61  const int color);
63  void g15r_pixelBox (g15canvas * canvas, int x1, int y1, int x2, int y2,
64  int color, int thick, int fill);
66  void g15r_drawCircle (g15canvas * canvas, int x, int y, int r, int fill,
67  int color);
69  void g15r_drawRoundBox (g15canvas * canvas, int x1, int y1, int x2, int y2,
70  int fill, int color);
72  void g15r_drawBar (g15canvas * canvas, int x1, int y1, int x2, int y2,
73  int color, int num, int max, int type);
75 int g15r_loadWbmpSplash(g15canvas *canvas, char *filename);
77 void g15r_drawIcon(g15canvas *canvas, char *buf, int my_x, int my_y, int width, int height);
79 void g15r_drawSprite(g15canvas *canvas, char *buf, int my_x, int my_y, int width, int height, int start_x, int start_y, int total_width);
81 char *g15r_loadWbmpToBuf(char *filename, int *img_width, int *img_height);
83 void g15r_drawBigNum (g15canvas * canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num);
84 
86  int g15r_getPixel (g15canvas * canvas, unsigned int x, unsigned int y);
88  void g15r_setPixel (g15canvas * canvas, unsigned int x, unsigned int y,
89  int val);
91  void g15r_clearScreen (g15canvas * canvas, int color);
93  void g15r_initCanvas (g15canvas * canvas);
94 
96  extern unsigned char fontdata_8x8[];
98  extern unsigned char fontdata_7x5[];
100  extern unsigned char fontdata_6x4[];
101 
103  void g15r_renderCharacterLarge (g15canvas * canvas, int x, int y,
104  unsigned char character, unsigned int sx,
105  unsigned int sy);
107  void g15r_renderCharacterMedium (g15canvas * canvas, int x, int y,
108  unsigned char character, unsigned int sx,
109  unsigned int sy);
111  void g15r_renderCharacterSmall (g15canvas * canvas, int x, int y,
112  unsigned char character, unsigned int sx,
113  unsigned int sy);
115  void g15r_renderString (g15canvas * canvas, unsigned char stringOut[],
116  int row, int size, unsigned int sx,
117  unsigned int sy);
118 
119 #ifdef TTF_SUPPORT
120 
121  void g15r_ttfLoad (g15canvas * canvas, char *fontname, int fontsize,
122  int face_num);
124  void g15r_ttfPrint (g15canvas * canvas, int x, int y, int fontsize,
125  int face_num, int color, int center,
126  char *print_string);
127 #endif
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif /*LIBG15RENDER_H_ */