hal_gfx_utils.h
Go to the documentation of this file.
1 
2 /** @addtogroup GRAPHICS_SDK Graphics
3  * @{
4  */
5 
6 /** @defgroup HAL_GFX_UTILS Hal gfx utils
7  * @brief graphics utils define
8  * @{
9  */
10 
11 
12 #ifndef HAL_GFX_UTILS_H_
13 #define HAL_GFX_UTILS_H_
14 
15 #include "hal_gfx_hal.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /** @addtogroup HAL_GFX_UTILS_STRUCT Structures
22  * @{
23  */
24 
25 /**
26  * @brief Image object defination
27  */
28 
29 typedef struct _img_obj_ {
30  hal_gfx_buffer_t bo; /**< Texture image info */
31  uint16_t w; /**< Texture image width */
32  uint16_t h; /**< Texture image high */
33  int stride; /**< Texture image stride */
34  uint32_t color; /**< Texture image color, default 0 */
35  uint8_t format; /**< Texture image rgb format */
36  uint8_t sampling_mode; /**< Texture image FILTER */
38 
39 /** @} */
40 
41 /** @addtogroup HAL_GFX_UTILS_FUNCTION Functions
42  * @{
43  */
44 
45 /**
46  *****************************************************************************************
47  * @brief Return system timestamp in second, need to porting
48  *
49  * @return timestamp in second
50  *****************************************************************************************
51  */
52 float hal_gfx_get_time(void);
53 
54 /**
55  *****************************************************************************************
56  * @brief Return system timestamp in millisecond, need to porting
57  *
58  * @return timestamp in millisecond
59  *****************************************************************************************
60  */
62 
63 /**
64  *****************************************************************************************
65  * @brief load file to buffer, need to porting
66  *
67  * @return the struct to save buffer
68  *****************************************************************************************
69  */
70 hal_gfx_buffer_t hal_gfx_load_file(const char *filename, int length, void *buffer);
71 
72 /**
73  *****************************************************************************************
74  * @brief save buffer to file, need to porting
75  *
76  * @return 0 - successful; other - fail
77  *****************************************************************************************
78  */
79 int hal_gfx_save_file(const char *filename, int length, void *buffer);
80 
81 /**
82  *****************************************************************************************
83  * @brief generate a random number, need to porting
84  *
85  * @return random number
86  *****************************************************************************************
87  */
88 unsigned int hal_gfx_rand(void);
89 
90 /**
91  *****************************************************************************************
92  * @brief calculate the fps, need to porting
93  *
94  * @return none
95  *****************************************************************************************
96  */
98 
99 /**
100  *****************************************************************************************
101  * @brief calculate the fps, need to porting
102  *
103  * @param[in] start_time: start timestamp in ms
104  * @param[in] frame: frame count from start_time
105  *
106  * @return fps
107  *****************************************************************************************
108  */
109 float hal_gfx_calculate_fps_ext(float start_time, uint32_t frame);
110 
111 /**
112  *****************************************************************************************
113  * @brief memcpy function, need to porting
114  *
115  * @param[in] destination: destination address
116  * @param[in] source: source address
117  * @param[in] num: copy data in bytes
118  *
119  * @return destination address
120  *****************************************************************************************
121  */
122 void * hal_gfx_memcpy ( void * destination, const void * source, size_t num );
123 
124 /** @} */
125 #ifdef __cplusplus
126 }
127 #endif
128 
129 #endif
130 
131 /** @} */
132 /** @} */
133 
hal_gfx_calculate_fps
void hal_gfx_calculate_fps(void)
calculate the fps, need to porting
hal_gfx_get_time
float hal_gfx_get_time(void)
Return system timestamp in second, need to porting.
_img_obj_::stride
int stride
Definition: hal_gfx_utils.h:33
_img_obj_::bo
hal_gfx_buffer_t bo
Definition: hal_gfx_utils.h:30
hal_gfx_load_file
hal_gfx_buffer_t hal_gfx_load_file(const char *filename, int length, void *buffer)
load file to buffer, need to porting
_img_obj_::format
uint8_t format
Definition: hal_gfx_utils.h:35
_img_obj_::sampling_mode
uint8_t sampling_mode
Definition: hal_gfx_utils.h:36
hal_gfx_buffer_t_
The base structure of gpu memory.
Definition: hal_gfx_hal.h:36
_img_obj_::color
uint32_t color
Definition: hal_gfx_utils.h:34
hal_gfx_rand
unsigned int hal_gfx_rand(void)
generate a random number, need to porting
_img_obj_::w
uint16_t w
Definition: hal_gfx_utils.h:31
hal_gfx_get_wall_time
float hal_gfx_get_wall_time(void)
Return system timestamp in millisecond, need to porting.
hal_gfx_save_file
int hal_gfx_save_file(const char *filename, int length, void *buffer)
save buffer to file, need to porting
img_obj_t
struct _img_obj_ img_obj_t
Image object defination.
hal_gfx_memcpy
void * hal_gfx_memcpy(void *destination, const void *source, size_t num)
memcpy function, need to porting
_img_obj_::h
uint16_t h
Definition: hal_gfx_utils.h:32
hal_gfx_calculate_fps_ext
float hal_gfx_calculate_fps_ext(float start_time, uint32_t frame)
calculate the fps, need to porting
_img_obj_
Image object defination.
Definition: hal_gfx_utils.h:29
hal_gfx_hal.h