hal_gfx_utils.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_gfx_utils.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of Graphics library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup GRAPHICS_SDK Graphics
39 * @{
40 */
41
42 /** @addtogroup HAL_GFX HAL GFX
43 * @{
44 */
45
46 /** @defgroup HAL_GFX_UTILS GFX UTILS
47 * @brief graphics utils define
48 * @{
49 */
50
51
52 #ifndef HAL_GFX_UTILS_H_
53 #define HAL_GFX_UTILS_H_
54
55 #include "hal_gfx_hal.h"
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 /** @addtogroup HAL_GFX_UTILS_STRUCT Structures
62 * @{
63 */
64
65 /**
66 * @brief Image object defination
67 */
68
69 typedef struct _img_obj_ {
70 hal_gfx_buffer_t bo; /**< Texture image info */
71 uint16_t w; /**< Texture image width */
72 uint16_t h; /**< Texture image high */
73 int stride; /**< Texture image stride */
74 uint32_t color; /**< Texture image color, default 0 */
75 uint8_t format; /**< Texture image rgb format */
76 uint8_t sampling_mode; /**< Texture image FILTER */
77 } img_obj_t;
78
79 /** @} */
80
81 /** @addtogroup HAL_GFX_UTILS_FUNCTION Functions
82 * @{
83 */
84
85 /**
86 *****************************************************************************************
87 * @brief Return system timestamp in second, need to porting
88 *
89 * @return timestamp in second
90 *****************************************************************************************
91 */
92 float hal_gfx_get_time(void);
93
94 /**
95 *****************************************************************************************
96 * @brief Return system timestamp in millisecond, need to porting
97 *
98 * @return timestamp in millisecond
99 *****************************************************************************************
100 */
101 float hal_gfx_get_wall_time(void);
102
103 /**
104 *****************************************************************************************
105 * @brief load file to buffer, need to porting
106 *
107 * @return the struct to save buffer
108 *****************************************************************************************
109 */
110 hal_gfx_buffer_t hal_gfx_load_file(const char *filename, int length, void *buffer);
111
112 /**
113 *****************************************************************************************
114 * @brief save buffer to file, need to porting
115 *
116 * @return 0 - successful; other - fail
117 *****************************************************************************************
118 */
119 int hal_gfx_save_file(const char *filename, int length, void *buffer);
120
121 /**
122 *****************************************************************************************
123 * @brief generate a random number, need to porting
124 *
125 * @return random number
126 *****************************************************************************************
127 */
128 unsigned int hal_gfx_rand(void);
129
130 /**
131 *****************************************************************************************
132 * @brief calculate the fps, need to porting
133 *
134 * @return none
135 *****************************************************************************************
136 */
137 void hal_gfx_calculate_fps(void);
138
139 /**
140 *****************************************************************************************
141 * @brief calculate the fps, need to porting
142 *
143 * @param[in] start_time: start timestamp in ms
144 * @param[in] frame: frame count from start_time
145 *
146 * @return fps
147 *****************************************************************************************
148 */
149 float hal_gfx_calculate_fps_ext(float start_time, uint32_t frame);
150
151 /**
152 *****************************************************************************************
153 * @brief memcpy function, need to porting
154 *
155 * @param[in] destination: destination address
156 * @param[in] source: source address
157 * @param[in] num: copy data in bytes
158 *
159 * @return destination address
160 *****************************************************************************************
161 */
162 void * hal_gfx_memcpy ( void * destination, const void * source, size_t num );
163
164 /** @} */
165
166 #ifdef __cplusplus
167 }
168 #endif
169
170 #endif
171
172 /** @} */
173 /** @} */
174 /** @} */
175
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
Texture image stride.
Definition: hal_gfx_utils.h:73
_img_obj_::bo
hal_gfx_buffer_t bo
Texture image info.
Definition: hal_gfx_utils.h:70
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
Texture image rgb format.
Definition: hal_gfx_utils.h:75
_img_obj_::sampling_mode
uint8_t sampling_mode
Texture image FILTER.
Definition: hal_gfx_utils.h:76
hal_gfx_buffer_t_
The base structure of gpu memory.
Definition: hal_gfx_hal.h:75
_img_obj_::color
uint32_t color
Texture image color, default 0.
Definition: hal_gfx_utils.h:74
hal_gfx_rand
unsigned int hal_gfx_rand(void)
generate a random number, need to porting
_img_obj_::w
uint16_t w
Texture image width.
Definition: hal_gfx_utils.h:71
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
Texture image high.
Definition: hal_gfx_utils.h:72
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:69
hal_gfx_hal.h
Header file containing functions prototypes of Graphics library.