hal_gfx_interpolators.h
Go to the documentation of this file.
1 
2 
3 /** @addtogroup GRAPHICS_SDK Graphics
4  * @{
5  */
6 
7 /** @defgroup HAL_GFX_INTERPOLATORS Hal gfx interpolators
8  * @brief GPU interpolators.
9  * @{
10  */
11 #ifndef _HAL_GFX_INTERPOLATORS_H_
12 #define _HAL_GFX_INTERPOLATORS_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include "hal_gfx_sys_defs.h"
19 
20 /**
21  * @defgroup HAL_GFX_INTERPOLATORS_STRUCT Structures
22  * @{
23  */
24 /**@brief Color structure. */
25 typedef struct _color_var_t
26 {
27  float r; /**< Red */
28  float g; /**< Green */
29  float b; /**< Blue */
30  float a; /**< Alpha */
32 /** @} */
33 
34 /**
35  * @defgroup HAL_GFX_INTERPOLATORS_FUNCTION Functions
36  * @{
37  */
38 /**
39  *****************************************************************************************
40  * @brief Interpolate color gradient for rectangle
41  *
42  * @param[in] x0: x coordinate of the upper left vertex of the rectangle
43  * @param[in] y0: y coordinate at the upper left vertex of the rectangle
44  * @param[in] w: width of the rectangle
45  * @param[in] h: height of the rectangle
46  * @param[in] col0: color for the first vertex
47  * @param[in] col1: color for the second vertex
48  * @param[in] col2: color for the third vertex
49  *****************************************************************************************
50  */
51 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);
52 
53 /**
54  *****************************************************************************************
55  * @brief Interpolate color gradient for triangle
56  *
57  * @param[in] x0: x coordinate at the first vertex of the triangle
58  * @param[in] y0: y coordinate at the first vertex of the triangle
59  * @param[in] x1: x coordinate at the second vertex of the triangle
60  * @param[in] y1: y coordinate at the second vertex of the triangle
61  * @param[in] x2: x coordinate at the third vertex of the triangle
62  * @param[in] y2: y coordinate at the third vertex of the triangle
63  * @param[in] col0: color for the first vertex
64  * @param[in] col1: color for the second vertex
65  * @param[in] col2: color for the third vertex
66  *****************************************************************************************
67  */
68 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);
69 
70 /**
71  *****************************************************************************************
72  * @brief Interpolate depth buffer values for triangle
73  *
74  * @param[in] x0: coordinate at the first vertex of the triangle
75  * @param[in] y0: coordinate at the first vertex of the triangle
76  * @param[in] z0: coordinate at the first vertex of the triangle
77  * @param[in] x1: coordinate at the second vertex of the triangle
78  * @param[in] y1: coordinate at the second vertex of the triangle
79  * @param[in] z1: coordinate at the second vertex of the triangle
80  * @param[in] x2: coordinate at the third vertex of the triangle
81  * @param[in] y2: coordinate at the third vertex of the triangle
82  * @param[in] z2: coordinate at the third vertex of the triangle
83  *****************************************************************************************
84  */
85 void hal_gfx_interpolate_tri_depth(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2);
86 
87 /**
88  *****************************************************************************************
89  * @brief Interpolate texture values for triangle
90  *
91  * @param[in] x0: x coordinate at the first vertex of the triangle
92  * @param[in] y0: y coordinate at the first vertex of the triangle
93  * @param[in] w0: w coordinate at the first vertex of the triangle
94  * @param[in] tx0: x texture coordinate at the first vertex of the triangle
95  * @param[in] ty0: y texture coordinate at the first vertex of the triangle
96  * @param[in] x1: x coordinate at the second vertex of the triangle
97  * @param[in] y1: y coordinate at the second vertex of the triangle
98  * @param[in] w1: w coordinate at the second vertex of the triangle
99  * @param[in] tx1: x texture coordinate at the second vertex of the triangle
100  * @param[in] ty1: y texture coordinate at the second vertex of the triangle
101  * @param[in] x2: x coordinate at the third vertex of the triangle
102  * @param[in] y2: y coordinate at the third vertex of the triangle
103  * @param[in] w2: w coordinate at the third vertex of the triangle
104  * @param[in] tx2: x texture coordinate at the third vertex of the triangle
105  * @param[in] ty2: x texture coordinate at the third vertex of the triangle
106  * @param[in] tex_width: texture width
107  * @param[in] tex_height: texture height
108  *****************************************************************************************
109  */
110 void hal_gfx_interpolate_tx_ty(float x0, float y0, float w0, float tx0, float ty0,
111  float x1, float y1, float w1, float tx1, float ty1,
112  float x2, float y2, float w2, float tx2, float ty2,
113  int tex_width, int tex_height );
114 /** @} */
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif
120 /** @} */
121 /** @} */
122 
123 
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
Definition: hal_gfx_interpolators.h:27
hal_gfx_sys_defs.h
_color_var_t::a
float a
Definition: hal_gfx_interpolators.h:30
_color_var_t::b
float b
Definition: hal_gfx_interpolators.h:29
_color_var_t::g
float g
Definition: hal_gfx_interpolators.h:28
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:26