@@ -62,6 +62,141 @@ class CNativeApiBindings {
6262 late final _native_accessibility_manager_is_enabled =
6363 _native_accessibility_manager_is_enabledPtr.asFunction< bool Function ()> ();
6464
65+ /// @brief Creates a color from RGBA values.
66+ ///
67+ /// @param red Red component (0-255)
68+ /// @param green Green component (0-255)
69+ /// @param blue Blue component (0-255)
70+ /// @param alpha Alpha component (0-255)
71+ /// @return Color instance with specified values
72+ native_color_t native_color_from_rgba (
73+ int red,
74+ int green,
75+ int blue,
76+ int alpha,
77+ ) {
78+ return _native_color_from_rgba (red, green, blue, alpha);
79+ }
80+
81+ late final _native_color_from_rgbaPtr =
82+ _lookup<
83+ ffi.NativeFunction <
84+ native_color_t Function (
85+ ffi.UnsignedChar ,
86+ ffi.UnsignedChar ,
87+ ffi.UnsignedChar ,
88+ ffi.UnsignedChar ,
89+ )
90+ >
91+ > ('native_color_from_rgba' );
92+ late final _native_color_from_rgba = _native_color_from_rgbaPtr
93+ .asFunction< native_color_t Function (int , int , int , int )> ();
94+
95+ /// @brief Creates a color from a hexadecimal string.
96+ ///
97+ /// Supports multiple hex color formats:
98+ /// - "#RGB" - 3-digit hex (e.g., "#F00" = red)
99+ /// - "#RGBA" - 4-digit hex with alpha
100+ /// - "#RRGGBB" - 6-digit hex (e.g., "#FF0000" = red)
101+ /// - "#RRGGBBAA" - 8-digit hex with alpha
102+ ///
103+ /// @param hex Hexadecimal color string (with or without '#' prefix)
104+ /// @param out_color Pointer to store the resulting color
105+ /// @return true if parsing succeeded, false otherwise
106+ bool native_color_from_hex (
107+ ffi.Pointer <ffi.Char > hex,
108+ ffi.Pointer <native_color_t> out_color,
109+ ) {
110+ return _native_color_from_hex (hex, out_color);
111+ }
112+
113+ late final _native_color_from_hexPtr =
114+ _lookup<
115+ ffi.NativeFunction <
116+ ffi.Bool Function (ffi.Pointer <ffi.Char >, ffi.Pointer <native_color_t>)
117+ >
118+ > ('native_color_from_hex' );
119+ late final _native_color_from_hex = _native_color_from_hexPtr
120+ .asFunction<
121+ bool Function (ffi.Pointer <ffi.Char >, ffi.Pointer <native_color_t>)
122+ > ();
123+
124+ /// @brief Converts the color to a 32-bit integer (RGBA format).
125+ ///
126+ /// @param color The color to convert
127+ /// @return 32-bit unsigned integer in RGBA format (0xRRGGBBAA)
128+ int native_color_to_rgba (native_color_t color) {
129+ return _native_color_to_rgba (color);
130+ }
131+
132+ late final _native_color_to_rgbaPtr =
133+ _lookup< ffi.NativeFunction <ffi.Uint32 Function (native_color_t)>> (
134+ 'native_color_to_rgba' ,
135+ );
136+ late final _native_color_to_rgba = _native_color_to_rgbaPtr
137+ .asFunction< int Function (native_color_t)> ();
138+
139+ /// @brief Converts the color to a 32-bit integer (ARGB format).
140+ ///
141+ /// @param color The color to convert
142+ /// @return 32-bit unsigned integer in ARGB format (0xAARRGGBB)
143+ int native_color_to_argb (native_color_t color) {
144+ return _native_color_to_argb (color);
145+ }
146+
147+ late final _native_color_to_argbPtr =
148+ _lookup< ffi.NativeFunction <ffi.Uint32 Function (native_color_t)>> (
149+ 'native_color_to_argb' ,
150+ );
151+ late final _native_color_to_argb = _native_color_to_argbPtr
152+ .asFunction< int Function (native_color_t)> ();
153+
154+ /// Predefined color constants
155+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_TRANSPARENT =
156+ _lookup <native_color_t>('NATIVE_COLOR_TRANSPARENT' );
157+
158+ native_color_t get NATIVE_COLOR_TRANSPARENT => _NATIVE_COLOR_TRANSPARENT .ref;
159+
160+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_BLACK =
161+ _lookup <native_color_t>('NATIVE_COLOR_BLACK' );
162+
163+ native_color_t get NATIVE_COLOR_BLACK => _NATIVE_COLOR_BLACK .ref;
164+
165+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_WHITE =
166+ _lookup <native_color_t>('NATIVE_COLOR_WHITE' );
167+
168+ native_color_t get NATIVE_COLOR_WHITE => _NATIVE_COLOR_WHITE .ref;
169+
170+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_RED =
171+ _lookup <native_color_t>('NATIVE_COLOR_RED' );
172+
173+ native_color_t get NATIVE_COLOR_RED => _NATIVE_COLOR_RED .ref;
174+
175+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_GREEN =
176+ _lookup <native_color_t>('NATIVE_COLOR_GREEN' );
177+
178+ native_color_t get NATIVE_COLOR_GREEN => _NATIVE_COLOR_GREEN .ref;
179+
180+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_BLUE =
181+ _lookup <native_color_t>('NATIVE_COLOR_BLUE' );
182+
183+ native_color_t get NATIVE_COLOR_BLUE => _NATIVE_COLOR_BLUE .ref;
184+
185+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_YELLOW =
186+ _lookup <native_color_t>('NATIVE_COLOR_YELLOW' );
187+
188+ native_color_t get NATIVE_COLOR_YELLOW => _NATIVE_COLOR_YELLOW .ref;
189+
190+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_CYAN =
191+ _lookup <native_color_t>('NATIVE_COLOR_CYAN' );
192+
193+ native_color_t get NATIVE_COLOR_CYAN => _NATIVE_COLOR_CYAN .ref;
194+
195+ late final ffi.Pointer <native_color_t> _NATIVE_COLOR_MAGENTA =
196+ _lookup <native_color_t>('NATIVE_COLOR_MAGENTA' );
197+
198+ native_color_t get NATIVE_COLOR_MAGENTA => _NATIVE_COLOR_MAGENTA .ref;
199+
65200 /// Window creation and destruction
66201 native_window_t native_window_create () {
67202 return _native_window_create ();
@@ -785,6 +920,64 @@ class CNativeApiBindings {
785920 late final _native_window_get_opacity = _native_window_get_opacityPtr
786921 .asFunction< double Function (native_window_t)> ();
787922
923+ void native_window_set_visual_effect (
924+ native_window_t window,
925+ native_visual_effect_t effect,
926+ ) {
927+ return _native_window_set_visual_effect (window, effect.value);
928+ }
929+
930+ late final _native_window_set_visual_effectPtr =
931+ _lookup<
932+ ffi.NativeFunction <ffi.Void Function (native_window_t, ffi.UnsignedInt )>
933+ > ('native_window_set_visual_effect' );
934+ late final _native_window_set_visual_effect =
935+ _native_window_set_visual_effectPtr
936+ .asFunction< void Function (native_window_t, int )> ();
937+
938+ native_visual_effect_t native_window_get_visual_effect (
939+ native_window_t window,
940+ ) {
941+ return native_visual_effect_t.fromValue (
942+ _native_window_get_visual_effect (window),
943+ );
944+ }
945+
946+ late final _native_window_get_visual_effectPtr =
947+ _lookup< ffi.NativeFunction <ffi.UnsignedInt Function (native_window_t)>> (
948+ 'native_window_get_visual_effect' ,
949+ );
950+ late final _native_window_get_visual_effect =
951+ _native_window_get_visual_effectPtr
952+ .asFunction< int Function (native_window_t)> ();
953+
954+ void native_window_set_background_color (
955+ native_window_t window,
956+ native_color_t color,
957+ ) {
958+ return _native_window_set_background_color (window, color);
959+ }
960+
961+ late final _native_window_set_background_colorPtr =
962+ _lookup<
963+ ffi.NativeFunction <ffi.Void Function (native_window_t, native_color_t)>
964+ > ('native_window_set_background_color' );
965+ late final _native_window_set_background_color =
966+ _native_window_set_background_colorPtr
967+ .asFunction< void Function (native_window_t, native_color_t)> ();
968+
969+ native_color_t native_window_get_background_color (native_window_t window) {
970+ return _native_window_get_background_color (window);
971+ }
972+
973+ late final _native_window_get_background_colorPtr =
974+ _lookup< ffi.NativeFunction <native_color_t Function (native_window_t)>> (
975+ 'native_window_get_background_color' ,
976+ );
977+ late final _native_window_get_background_color =
978+ _native_window_get_background_colorPtr
979+ .asFunction< native_color_t Function (native_window_t)> ();
980+
788981 void native_window_set_visible_on_all_workspaces (
789982 native_window_t window,
790983 bool visible,
@@ -4599,6 +4792,28 @@ class CNativeApiBindings {
45994792 .asFunction< bool Function (int )> ();
46004793}
46014794
4795+ /// @struct native_color_t
4796+ /// @brief Representation of a color with RGBA components
4797+ ///
4798+ /// Each component is represented as an unsigned byte (0-255).
4799+ /// Alpha value: 0 = fully transparent, 255 = fully opaque
4800+ final class native_color_t extends ffi.Struct {
4801+ @ffi .UnsignedChar ()
4802+ external int r;
4803+
4804+ /// Red component (0-255)
4805+ @ffi .UnsignedChar ()
4806+ external int g;
4807+
4808+ /// Green component (0-255)
4809+ @ffi .UnsignedChar ()
4810+ external int b;
4811+
4812+ /// Blue component (0-255)
4813+ @ffi .UnsignedChar ()
4814+ external int a;
4815+ }
4816+
46024817/// Representation of a point
46034818final class native_point_t extends ffi.Struct {
46044819 @ffi .Double ()
@@ -4718,6 +4933,27 @@ enum native_title_bar_style_t {
47184933 };
47194934}
47204935
4936+ /// Visual effect styles for window background
4937+ enum native_visual_effect_t {
4938+ NATIVE_VISUAL_EFFECT_NONE (0 ),
4939+ NATIVE_VISUAL_EFFECT_BLUR (1 ),
4940+ NATIVE_VISUAL_EFFECT_ACRYLIC (2 ),
4941+ NATIVE_VISUAL_EFFECT_MICA (3 );
4942+
4943+ final int value;
4944+ const native_visual_effect_t (this .value);
4945+
4946+ static native_visual_effect_t fromValue (int value) => switch (value) {
4947+ 0 => NATIVE_VISUAL_EFFECT_NONE ,
4948+ 1 => NATIVE_VISUAL_EFFECT_BLUR ,
4949+ 2 => NATIVE_VISUAL_EFFECT_ACRYLIC ,
4950+ 3 => NATIVE_VISUAL_EFFECT_MICA ,
4951+ _ => throw ArgumentError (
4952+ "Unknown value for native_visual_effect_t: $value " ,
4953+ ),
4954+ };
4955+ }
4956+
47214957/// Window ID type
47224958typedef native_window_id_t = ffi.Long ;
47234959typedef Dartnative_window_id_t = int ;
0 commit comments