-
Notifications
You must be signed in to change notification settings - Fork 0
/
text_fb.h
73 lines (67 loc) · 1.65 KB
/
text_fb.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* @file text_fb.h
* @author Lukas Nejezchleb ([email protected])
* @brief Module for drawing text to frame buffer
* @version 0.1
* @date 2021-05-04
*
* @copyright Copyright (c) 2021
*
*/
#ifndef TEXT_FB_H
#define TEXT_FB_H
#include "data_structures.h"
#include "font_types.h"
/**
* @brief Draws the character to the frame buffer. Left upper corner is at x,y and the char is scale times bigger than the bitmap in font
*
* @param frame
* @param letter
* @param x
* @param y
* @param scale
* @param font
* @param color
*/
void draw_char(fb_data *frame, char letter, int x, int y, int scale, font_descriptor_t *font, uint16_t color);
/**
* @brief Returns the lenght of given char
*
* @param fdes
* @param letter
* @return int
*/
int char_width(font_descriptor_t *fdes, int letter);
/**
* @brief Returns offset of given char in bitmap data
*
* @param fdes
* @param letter
* @return uint32_t
*/
uint32_t char_offset(font_descriptor_t *fdes, char letter);
/**
* @brief Draws text to the frame buffer, x,y are the coordinates of the left upper edge
*
* @param frame
* @param text
* @param x
* @param y
* @param scale
* @param font
* @param color
*/
void draw_text(fb_data *frame, char *text, int x, int y, int scale, font_descriptor_t *font, uint16_t color);
/**
* @brief Draws the text centered around x,y
*
* @param frame
* @param text
* @param x
* @param y
* @param scale
* @param font
* @param color
*/
void draw_text_center(fb_data *frame, char *text, int x, int y, int scale, font_descriptor_t *font, uint16_t color);
#endif