1 /* TSI 2023.xmo */
2 /*******************************************************************************
3  * Copyright (c) 2023 Think Silicon Single Member PC
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this header file and/or associated documentation files to use, copy,
7  * modify, merge, publish, distribute, sublicense, and/or sell copies of the
8  * Materials, and to permit persons to whom the Materials are furnished to do
9  * so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Materials.
13  *
14  * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15  * NEMAGFX API. THE UNMODIFIED, NORMATIVE VERSIONS OF THINK-SILICON NEMAGFX
16  * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT:
17  *   https://think-silicon.com/products/software/nemagfx-api
18  *
19  *  The software is provided 'as is', without warranty of any kind, express or
20  *  implied, including but not limited to the warranties of merchantability,
21  *  fitness for a particular purpose and noninfringement. In no event shall
22  *  Think Silicon Single Member PC be liable for any claim, damages or other
23  *  liability, whether in an action of contract, tort or otherwise, arising
24  *  from, out of or in connection with the software or the use or other dealings
25  *  in the software.
26  ******************************************************************************/
27 
28 
29 #ifndef NEMA_PROVISIONAL_H__
30 #define NEMA_PROVISIONAL_H__
31 
32 #include "nema_sys_defs.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /** \brief Fill a triangle strip with color (float coordinates)
39  *
40  * \param vertices pointer to vertices coordinated (first x coordinate of vertex,
41  *                 then y coordinate of vertex)
42  * \param num_vertices number of vertices
43  * \param stride Distance between two vertices
44  * \param rgba8888 Color to be used
45  *
46  */
47 void nema_fill_triangle_strip_f(float* vertices, int num_vertices, int stride, uint32_t rgba8888);
48 
49 /** \brief Fill a traingle fan with color (float coordinates)
50  *
51  * \param vertices pointer to vertices coordinated (first x coordinate of vertex,
52  *                 then y coordinate of vertex)
53  * \param num_vertices number of vertices
54  * \param stride Distance between two vertices
55  * \param rgba8888 Color to be used
56  *
57  */
58 void nema_fill_triangle_fan_f(float* vertices, int num_vertices, int stride, uint32_t rgba8888);
59 
60 /** \brief Draws a triangle with specific border width. Apply AA if available.
61  * Degenerated triangles have undefined behavior.
62  *
63  * \param x0 x coordinate at the first vertex of the triangle
64  * \param y0 y coordinate at the first vertex of the triangle
65  * \param x1 x coordinate at the second vertex of the triangle
66  * \param y1 y coordinate at the second vertex of the triangle
67  * \param x2 x coordinate at the third vertex of the triangle
68  * \param y2 y coordinate at the third vertex of the triangle
69  * \param border_width triangle's border width
70  * \param color color of the triangle
71  *
72  */
73 void nema_draw_triangle_aa(float x0, float y0, float x1, float y1, float x2, float y2,
74                            float border_width, uint32_t color);
75 
76 
77 /** \brief Draw a colored rectangle with rounded edges and specific border width. Apply AA if available.
78  *
79  * \param x x coordinate of the upper left vertex of the rectangle
80  * \param y y coordinate at the upper left vertex of the rectangle
81  * \param w width of the rectangle
82  * \param h height of the rectangle
83  * \param r corner radius
84  * \param border_width border width
85  * \param rgba8888 rgba color of the rounded rectangle
86  *
87  */
88 void nema_draw_rounded_rect_aa(float x, float y, float w, float h, float r, float border_width, uint32_t rgba8888);
89 
90 
91 /** \brief Draw a filled colored rectangle with rounded edges and specific border width. Apply AA if available.
92  *
93  * \param x x coordinate of the upper left vertex of the rectangle
94  * \param y y coordinate at the upper left vertex of the rectangle
95  * \param w width of the rectangle
96  * \param h height of the rectangle
97  * \param r corner radius
98  * \param rgba8888 rgba color of the rounded rectangle
99  *
100  */
101 void nema_fill_rounded_rect_aa(float x, float y, float w, float h, float r, uint32_t rgba8888);
102 
103 /** \brief Draws a quadrilateral with specific border width. Apply AA if available.
104  * Only Convex quadrilaterals are supported.
105  *
106  * \param x0 x coordinate at the first vertex of the quadrilateral
107  * \param y0 y coordinate at the first vertex of the quadrilateral
108  * \param x1 x coordinate at the second vertex of the quadrilateral
109  * \param y1 y coordinate at the second vertex of the quadrilateral
110  * \param x2 x coordinate at the third vertex of the quadrilateral
111  * \param y2 y coordinate at the third vertex of the quadrilateral
112  * \param x3 x coordinate at the fourth vertex of the quadrilateral
113  * \param y3 y coordinate at the fourth vertex of the quadrilateral
114  * \param border_width trianquadrilateralgle's border width
115  * \param color color of the quadrilateral
116  *
117  */
118 void nema_draw_quad_aa(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3,
119                        float border_width, uint32_t color);
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif // NEMA_PROVISIONAL_H__
125