-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasicGraphics.h
74 lines (65 loc) · 2.29 KB
/
basicGraphics.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
74
/*
* basicGraphics.h
*
* Created on: Dec 18, 2018
* Author: Ronald Susa
*/
#ifndef __BASIC_GRAPHICS_H__
#define __BASIC_GRAPHICS_H__
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include "stdbool.h"
#include "Fonts/gfxfont.h"
#include "displayDriver.h"
/**
* this is the justification of a text
*/
typedef enum {
Text_Left = 0,
Text_Right,
Text_Center,
Text_LeftCenter,
Text_RightCenter,
Text_LeftTop,
Text_RightTop,
} GraphicsTextPostEnumType;
/**
* defines the data structure for working out the a string bound based on a given font
*/
typedef struct {
uint32_t x; ///< x start position of the string
uint32_t y; ///< x start position of the string
uint32_t width; ///< the complete string width
uint32_t height; ///< the complete string height
} basicStringBoundType;
/**
* Defines the standard graphics functuion return types.
*/
typedef enum GraphicsReturnType {
BasicGReturned_OK = 0,
BasicGReturned_Error,
RBasicGReturned_InvalidPointer
} GraphicsReturnType;
/**
* defines our simple graphics structure
*/
typedef struct SimpleGraphcisType {
void (*Init) (DisplayInterfaceType * driver, const GFXfont * font);
void (*Destroy) (void);
void (*Reset) (uint_fast8_t resetBuffer);
void (*Clear)(void);
void (*Flush)(void);
void (*WriteString)(uint8_t * text, uint32_t xPos, uint32_t yPos, uint_fast8_t colour, const GFXfont * fontToUse);
void (*GetStringBounds)(uint8_t * text, GFXfont * font, basicStringBoundType * bounds);
void (*getStringJustificationPos)(basicStringBoundType * TextBounds, GraphicsTextPostEnumType justification, uint32_t containerWidth, uint32_t containerHeight);
void (*drawLine)(int32_t xStart, int32_t yStart, int32_t xEnd, int32_t yEnd, uint_fast8_t colour);
void (*drawCircle)(int32_t x0, int32_t y0, int32_t radius, uint_fast8_t colour, uint_fast8_t fill);
void (*drawRectagle)(int32_t xStart, int32_t yStart, int32_t xEnd, int32_t yEnd, uint_fast8_t colour, uint_fast8_t fill);
void (*drawFullScreen)(uint8_t *source);
void (*drawIcon) (int32_t x, int32_t y, uint32_t height, uint32_t width, uint_fast8_t colour, uint32_t *source);
void (*Fill)(uint8_t value);
void (*Update)(void);
} SimpleGraphcisType;
extern SimpleGraphcisType GraphicsInstance;
#endif /* __BASIC_GRAPHICS_H__ */