The Graphics module provides functions to draw text and bitmaps on graphics displays. The module currently supports 128x64 TIANMA Graphics LCD. The Graphics module has support for displaying strings using various fonts and size.
The following example draws a ball represented as a bitmap and draws a text using 8x8 font.
Listing 9.1. GLCD Hello World
#include <board.h>
#include <delay.h>
#include <gfx.h>
#define BALL_WIDTH 7
#define BALL_HEIGHT 7
static __code uint8_t ball[] = {
0x1c, /* ...###.. */
0x3e, /* ..#####. */
0x73, /* .###..## */
0x7b, /* .####.## */
0x7f, /* .####### */
0x3e, /* ..#####. */
0x1c /* ...###.. */
};
int main()
{
board_init();
gfx_init();
delay_init();
/* Bitmap Demo: Draws a ball at location 50, 50 */
gfx_blit_bmp(50, 50, ball, BALL_WIDTH, BALL_HEIGHT);
gfx_update();
mdelay(1000);
/*
* Font Demo: Draws the string "ZDev Library" at 20,10 using
* 8x8 bitmap font.
*/
gfx_clear();
gfx_set_font(FONT_8x8);
gfx_draw_string(20, 10, "ZDev Library", 1);
gfx_update();
return 0;
}