1 /*************************************************************************/
2 /*  color.h                                                              */
3 /*************************************************************************/
4 /*                       This file is part of:                           */
5 /*                           GODOT ENGINE                                */
6 /*                      https://godotengine.org                          */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
9 /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
10 /*                                                                       */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the       */
13 /* "Software"), to deal in the Software without restriction, including   */
14 /* without limitation the rights to use, copy, modify, merge, publish,   */
15 /* distribute, sublicense, and/or sell copies of the Software, and to    */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions:                                             */
18 /*                                                                       */
19 /* The above copyright notice and this permission notice shall be        */
20 /* included in all copies or substantial portions of the Software.       */
21 /*                                                                       */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
29 /*************************************************************************/
30 
31 #ifndef GODOT_COLOR_H
32 #define GODOT_COLOR_H
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <stdint.h>
39 
40 #define GODOT_COLOR_SIZE 16
41 
42 #ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
43 #define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
44 typedef struct {
45 	uint8_t _dont_touch_that[GODOT_COLOR_SIZE];
46 } godot_color;
47 #endif
48 
49 // reduce extern "C" nesting for VS2013
50 #ifdef __cplusplus
51 }
52 #endif
53 
54 #include <gdnative/gdnative.h>
55 #include <gdnative/string.h>
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a);
62 void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b);
63 
64 godot_real godot_color_get_r(const godot_color *p_self);
65 void godot_color_set_r(godot_color *p_self, const godot_real r);
66 
67 godot_real godot_color_get_g(const godot_color *p_self);
68 void godot_color_set_g(godot_color *p_self, const godot_real g);
69 
70 godot_real godot_color_get_b(const godot_color *p_self);
71 void godot_color_set_b(godot_color *p_self, const godot_real b);
72 
73 godot_real godot_color_get_a(const godot_color *p_self);
74 void godot_color_set_a(godot_color *p_self, const godot_real a);
75 
76 godot_real godot_color_get_h(const godot_color *p_self);
77 godot_real godot_color_get_s(const godot_color *p_self);
78 godot_real godot_color_get_v(const godot_color *p_self);
79 
80 godot_string GDAPI godot_color_as_string(const godot_color *p_self);
81 
82 godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self);
83 
84 godot_int GDAPI godot_color_to_abgr32(const godot_color *p_self);
85 
86 godot_int GDAPI godot_color_to_abgr64(const godot_color *p_self);
87 
88 godot_int GDAPI godot_color_to_argb64(const godot_color *p_self);
89 
90 godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self);
91 
92 godot_int GDAPI godot_color_to_argb32(const godot_color *p_self);
93 
94 godot_real GDAPI godot_color_gray(const godot_color *p_self);
95 
96 godot_color GDAPI godot_color_inverted(const godot_color *p_self);
97 
98 godot_color GDAPI godot_color_contrasted(const godot_color *p_self);
99 
100 godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
101 
102 godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);
103 
104 godot_color GDAPI godot_color_darkened(const godot_color *p_self, const godot_real p_amount);
105 
106 godot_color GDAPI godot_color_from_hsv(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a);
107 
108 godot_color GDAPI godot_color_lightened(const godot_color *p_self, const godot_real p_amount);
109 
110 godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha);
111 
112 godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b);
113 
114 godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b);
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif // GODOT_COLOR_H
121