1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* graphics_adapter.c
*
* Created on: Sep 24, 2017
* Author: Roy
*/
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include "graphics_adapter.h"
#include "grlib/grlib.h"
#include "drivers/frame.h"
#include "drivers/kentec320x240x16_ssd2119.h"
void init_graphics(uint32_t ui32SysClock)
{
// Initialize the display driver.
Kentec320x240x16_SSD2119Init(ui32SysClock);
// Initialize the graphics context.
GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);
}
void draw_image(uint8_t* data)
{
GrImageDraw(&g_sContext, data, 0, 0);
}
void draw_string(char* data, size_t length)
{
tRectangle backRect;
backRect.i16XMin = 100;
backRect.i16XMax = 300;
backRect.i16YMin = 100;
backRect.i16YMax = 80;
GrContextForegroundSet(&g_sContext, ClrBlack);
GrRectFill(&g_sContext, &backRect);
GrContextFontSet(&g_sContext, TEXT_FONT);
GrContextForegroundSet(&g_sContext, ClrWhite);
GrStringDraw(&g_sContext, data, length, 150, 80, true);
}
|