00001 #ifndef LIBG15RENDER_H_
00002 #define LIBG15RENDER_H_
00003
00004 #ifdef __cplusplus
00005 extern "C"
00006 {
00007 #endif
00008
00009 #include <string.h>
00010
00011 #ifdef HAVE_CONFIG_H
00012 #include "config.h"
00013 #endif
00014
00015 #ifdef TTF_SUPPORT
00016 #include <ft2build.h>
00017 #include FT_FREETYPE_H
00018 #include FT_BITMAP_H
00019 #endif
00020
00021 #define BYTE_SIZE 8
00022 #define G15_BUFFER_LEN 1048
00023 #define G15_LCD_OFFSET 32
00024 #define G15_LCD_HEIGHT 43
00025 #define G15_LCD_WIDTH 160
00026 #define G15_COLOR_WHITE 0
00027 #define G15_COLOR_BLACK 1
00028 #define G15_TEXT_SMALL 0
00029 #define G15_TEXT_MED 1
00030 #define G15_TEXT_LARGE 2
00031 #define G15_PIXEL_NOFILL 0
00032 #define G15_PIXEL_FILL 1
00033 #define G15_MAX_FACE 5
00034
00036 typedef struct g15canvas
00037 {
00039 unsigned char buffer[G15_BUFFER_LEN];
00041 int mode_xor;
00043 int mode_cache;
00045 int mode_reverse;
00046 #ifdef TTF_SUPPORT
00047 FT_Library ftLib;
00048 FT_Face ttf_face[G15_MAX_FACE][sizeof (FT_Face)];
00049 int ttf_fontsize[G15_MAX_FACE];
00050 #endif
00051 } g15canvas;
00052
00054 void g15r_pixelReverseFill (g15canvas * canvas, int x1, int y1, int x2,
00055 int y2, int fill, int color);
00057 void g15r_pixelOverlay (g15canvas * canvas, int x1, int y1, int width,
00058 int height, short colormap[]);
00060 void g15r_drawLine (g15canvas * canvas, int px1, int py1, int px2, int py2,
00061 const int color);
00063 void g15r_pixelBox (g15canvas * canvas, int x1, int y1, int x2, int y2,
00064 int color, int thick, int fill);
00066 void g15r_drawCircle (g15canvas * canvas, int x, int y, int r, int fill,
00067 int color);
00069 void g15r_drawRoundBox (g15canvas * canvas, int x1, int y1, int x2, int y2,
00070 int fill, int color);
00072 void g15r_drawBar (g15canvas * canvas, int x1, int y1, int x2, int y2,
00073 int color, int num, int max, int type);
00075 int g15r_loadWbmpSplash(g15canvas *canvas, char *filename);
00077 void g15r_drawIcon(g15canvas *canvas, char *buf, int my_x, int my_y, int width, int height);
00079 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);
00081 char *g15r_loadWbmpToBuf(char *filename, int *img_width, int *img_height);
00083 void g15r_drawBigNum (g15canvas * canvas, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, int color, int num);
00084
00086 int g15r_getPixel (g15canvas * canvas, unsigned int x, unsigned int y);
00088 void g15r_setPixel (g15canvas * canvas, unsigned int x, unsigned int y,
00089 int val);
00091 void g15r_clearScreen (g15canvas * canvas, int color);
00093 void g15r_initCanvas (g15canvas * canvas);
00094
00096 extern unsigned char fontdata_8x8[];
00098 extern unsigned char fontdata_7x5[];
00100 extern unsigned char fontdata_6x4[];
00101
00103 void g15r_renderCharacterLarge (g15canvas * canvas, int x, int y,
00104 unsigned char character, unsigned int sx,
00105 unsigned int sy);
00107 void g15r_renderCharacterMedium (g15canvas * canvas, int x, int y,
00108 unsigned char character, unsigned int sx,
00109 unsigned int sy);
00111 void g15r_renderCharacterSmall (g15canvas * canvas, int x, int y,
00112 unsigned char character, unsigned int sx,
00113 unsigned int sy);
00115 void g15r_renderString (g15canvas * canvas, unsigned char stringOut[],
00116 int row, int size, unsigned int sx,
00117 unsigned int sy);
00118
00119 #ifdef TTF_SUPPORT
00120
00121 void g15r_ttfLoad (g15canvas * canvas, char *fontname, int fontsize,
00122 int face_num);
00124 void g15r_ttfPrint (g15canvas * canvas, int x, int y, int fontsize,
00125 int face_num, int color, int center,
00126 char *print_string);
00127 #endif
00128
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132
00133 #endif