hal_gfx_interpolators.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_gfx_interpolators.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_INTERPOLATORS GFX INTERPOLATORS
47 * @brief GPU interpolators.
48 * @{
49 */
50 #ifndef _HAL_GFX_INTERPOLATORS_H_
51 #define _HAL_GFX_INTERPOLATORS_H_
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 #include "hal_gfx_sys_defs.h"
58
59 /**
60 * @defgroup HAL_GFX_INTERPOLATORS_STRUCT Structures
61 * @{
62 */
63 /**@brief Color structure. */
64 typedef struct _color_var_t
65 {
66 float r; /**< Red */
67 float g; /**< Green */
68 float b; /**< Blue */
69 float a; /**< Alpha */
70 } color_var_t;
71 /** @} */
72
73 /**
74 * @defgroup HAL_GFX_INTERPOLATORS_FUNCTION Functions
75 * @{
76 */
77 /**
78 *****************************************************************************************
79 * @brief Interpolate color gradient for rectangle
80 *
81 * @param[in] x0: x coordinate of the upper left vertex of the rectangle
82 * @param[in] y0: y coordinate at the upper left vertex of the rectangle
83 * @param[in] w: width of the rectangle
84 * @param[in] h: height of the rectangle
85 * @param[in] col0: color for the first vertex
86 * @param[in] col1: color for the second vertex
87 * @param[in] col2: color for the third vertex
88 *****************************************************************************************
89 */
90 void hal_gfx_interpolate_rect_colors(int x0, int y0, int w, int h, color_var_t* col0, color_var_t* col1, color_var_t* col2);
91
92 /**
93 *****************************************************************************************
94 * @brief Interpolate color gradient for triangle
95 *
96 * @param[in] x0: x coordinate at the first vertex of the triangle
97 * @param[in] y0: y coordinate at the first vertex of the triangle
98 * @param[in] x1: x coordinate at the second vertex of the triangle
99 * @param[in] y1: y coordinate at the second vertex of the triangle
100 * @param[in] x2: x coordinate at the third vertex of the triangle
101 * @param[in] y2: y coordinate at the third vertex of the triangle
102 * @param[in] col0: color for the first vertex
103 * @param[in] col1: color for the second vertex
104 * @param[in] col2: color for the third vertex
105 *****************************************************************************************
106 */
107 void hal_gfx_interpolate_tri_colors(float x0, float y0, float x1, float y1, float x2, float y2, color_var_t* col0, color_var_t* col1, color_var_t* col2);
108
109 /**
110 *****************************************************************************************
111 * @brief Interpolate depth buffer values for triangle
112 *
113 * @param[in] x0: coordinate at the first vertex of the triangle
114 * @param[in] y0: coordinate at the first vertex of the triangle
115 * @param[in] z0: coordinate at the first vertex of the triangle
116 * @param[in] x1: coordinate at the second vertex of the triangle
117 * @param[in] y1: coordinate at the second vertex of the triangle
118 * @param[in] z1: coordinate at the second vertex of the triangle
119 * @param[in] x2: coordinate at the third vertex of the triangle
120 * @param[in] y2: coordinate at the third vertex of the triangle
121 * @param[in] z2: coordinate at the third vertex of the triangle
122 *****************************************************************************************
123 */
124 void hal_gfx_interpolate_tri_depth(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2);
125
126 /**
127 *****************************************************************************************
128 * @brief Interpolate texture values for triangle
129 *
130 * @param[in] x0: x coordinate at the first vertex of the triangle
131 * @param[in] y0: y coordinate at the first vertex of the triangle
132 * @param[in] w0: w coordinate at the first vertex of the triangle
133 * @param[in] tx0: x texture coordinate at the first vertex of the triangle
134 * @param[in] ty0: y texture coordinate at the first vertex of the triangle
135 * @param[in] x1: x coordinate at the second vertex of the triangle
136 * @param[in] y1: y coordinate at the second vertex of the triangle
137 * @param[in] w1: w coordinate at the second vertex of the triangle
138 * @param[in] tx1: x texture coordinate at the second vertex of the triangle
139 * @param[in] ty1: y texture coordinate at the second vertex of the triangle
140 * @param[in] x2: x coordinate at the third vertex of the triangle
141 * @param[in] y2: y coordinate at the third vertex of the triangle
142 * @param[in] w2: w coordinate at the third vertex of the triangle
143 * @param[in] tx2: x texture coordinate at the third vertex of the triangle
144 * @param[in] ty2: x texture coordinate at the third vertex of the triangle
145 * @param[in] tex_width: texture width
146 * @param[in] tex_height: texture height
147 *****************************************************************************************
148 */
149 void hal_gfx_interpolate_tx_ty(float x0, float y0, float w0, float tx0, float ty0,
150 float x1, float y1, float w1, float tx1, float ty1,
151 float x2, float y2, float w2, float tx2, float ty2,
152 int tex_width, int tex_height );
153 /** @} */
154 #ifdef __cplusplus
155 }
156 #endif
157
158 #endif
159 /** @} */
160 /** @} */
161 /** @} */
162
hal_gfx_interpolate_tri_depth
void hal_gfx_interpolate_tri_depth(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2)
Interpolate depth buffer values for triangle.
color_var_t
struct _color_var_t color_var_t
Color structure.
hal_gfx_interpolate_tx_ty
void hal_gfx_interpolate_tx_ty(float x0, float y0, float w0, float tx0, float ty0, float x1, float y1, float w1, float tx1, float ty1, float x2, float y2, float w2, float tx2, float ty2, int tex_width, int tex_height)
Interpolate texture values for triangle.
_color_var_t::r
float r
Red.
Definition: hal_gfx_interpolators.h:66
hal_gfx_sys_defs.h
_color_var_t::a
float a
Alpha.
Definition: hal_gfx_interpolators.h:69
_color_var_t::b
float b
Blue.
Definition: hal_gfx_interpolators.h:68
_color_var_t::g
float g
Green.
Definition: hal_gfx_interpolators.h:67
hal_gfx_interpolate_tri_colors
void hal_gfx_interpolate_tri_colors(float x0, float y0, float x1, float y1, float x2, float y2, color_var_t *col0, color_var_t *col1, color_var_t *col2)
Interpolate color gradient for triangle.
hal_gfx_interpolate_rect_colors
void hal_gfx_interpolate_rect_colors(int x0, int y0, int w, int h, color_var_t *col0, color_var_t *col1, color_var_t *col2)
Interpolate color gradient for rectangle.
_color_var_t
Color structure.
Definition: hal_gfx_interpolators.h:65