1#![allow(dead_code)]
6#![allow(non_snake_case)]
7#![allow(clippy::too_many_arguments)]
8#![allow(clippy::missing_safety_doc)]
9
10#[repr(u64)]
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum HandleValue {
13 Invalid = 0,
14}
15#[repr(u32)]
16#[derive(Debug, Clone, Copy, PartialEq, Eq)]
17pub enum NodeType {
18 FlexBox = 0,
19 Text = 1,
20 Image = 2,
21 Svg = 3,
22 ScrollView = 4,
23 Grid = 5,
24}
25#[repr(u32)]
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub enum Unit {
28 Pixel = 0,
29 Auto = 1,
30 Percent = 2,
31}
32#[repr(u32)]
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub enum GridUnit {
35 Pixel = 0,
36 Auto = 1,
37 Star = 2,
38}
39#[repr(u32)]
40#[derive(Debug, Clone, Copy, PartialEq, Eq)]
41pub enum PositionType {
42 Relative = 0,
43 Absolute = 1,
44}
45#[repr(u32)]
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47pub enum Visibility {
48 Normal = 0,
49 Hidden = 1,
50 Collapsed = 2,
51}
52#[repr(u32)]
53#[derive(Debug, Clone, Copy, PartialEq, Eq)]
54pub enum FlexDirection {
55 Column = 0,
56 Row = 1,
57}
58#[repr(u32)]
59#[derive(Debug, Clone, Copy, PartialEq, Eq)]
60pub enum FlexWrap {
61 NoWrap = 0,
62 Wrap = 1,
63 WrapReverse = 2,
64}
65#[repr(u32)]
66#[derive(Debug, Clone, Copy, PartialEq, Eq)]
67pub enum JustifyContent {
68 Start = 0,
69 Center = 1,
70 End = 2,
71}
72#[repr(u32)]
73#[derive(Debug, Clone, Copy, PartialEq, Eq)]
74pub enum AlignItems {
75 Start = 0,
76 Center = 1,
77 End = 2,
78 Stretch = 3,
79 None = 4,
80}
81#[repr(u32)]
82#[derive(Debug, Clone, Copy, PartialEq, Eq)]
83pub enum AlignSelf {
84 Auto = 0,
85 Start = 1,
86 Center = 2,
87 End = 3,
88 Stretch = 4,
89}
90#[repr(u32)]
91#[derive(Debug, Clone, Copy, PartialEq, Eq)]
92pub enum BorderStyle {
93 Solid = 0,
94 Dashed = 1,
95 Dotted = 2,
96}
97#[repr(u32)]
98#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99pub enum ObjectFit {
100 Fill = 0,
101 Contain = 1,
102 Cover = 2,
103 None = 3,
104 ScaleDown = 4,
105}
106#[repr(u32)]
107#[derive(Debug, Clone, Copy, PartialEq, Eq)]
108pub enum ImageSamplingKind {
109 Linear = 0,
110 Nearest = 1,
111 LinearMipmapNearest = 2,
112 LinearMipmapLinear = 3,
113 CubicMitchell = 4,
114 CubicCatmullRom = 5,
115 Anisotropic = 6,
116}
117#[repr(u32)]
118#[derive(Debug, Clone, Copy, PartialEq, Eq)]
119pub enum TextAlign {
120 Left = 0,
121 Center = 1,
122 Right = 2,
123}
124#[repr(u32)]
125#[derive(Debug, Clone, Copy, PartialEq, Eq)]
126pub enum TextVerticalAlign {
127 Top = 0,
128 Center = 1,
129 Bottom = 2,
130}
131#[repr(u32)]
132#[derive(Debug, Clone, Copy, PartialEq, Eq)]
133pub enum TextOverflow {
134 Clip = 0,
135 Ellipsis = 1,
136 Fade = 2,
137}
138#[repr(u32)]
139#[derive(Debug, Clone, Copy, PartialEq, Eq)]
140pub enum Orientation {
141 None = 0,
142 Horizontal = 1,
143 Vertical = 2,
144}
145#[repr(u32)]
146#[derive(Debug, Clone, Copy, PartialEq, Eq)]
147pub enum KeyEventType {
148 Down = 1,
149 Up = 2,
150}
151#[repr(u32)]
152#[derive(Debug, Clone, Copy, PartialEq, Eq)]
153pub enum PointerEventType {
154 Down = 1,
155 Up = 2,
156 Move = 3,
157 Enter = 4,
158 Leave = 5,
159 Cancel = 6,
160}
161#[repr(u32)]
162#[derive(Debug, Clone, Copy, PartialEq, Eq)]
163pub enum KeyModifier {
164 Shift = 1 << 0,
165 Ctrl = 1 << 1,
166 Alt = 1 << 2,
167 Meta = 1 << 3,
168}
169#[repr(u32)]
170#[derive(Debug, Clone, Copy, PartialEq, Eq)]
171pub enum SemanticRole {
172 None = 0,
173 Button = 1,
174 Textbox = 2,
175 Link = 3,
176 Heading = 4,
177 Form = 5,
178 List = 6,
179 ListItem = 7,
180 Image = 8,
181 Dialog = 9,
182 StaticText = 10,
183 Checkbox = 11,
184 Radio = 12,
185 RadioGroup = 13,
186 Switch = 14,
187 Slider = 15,
188 ComboBox = 16,
189}
190#[repr(u32)]
191#[derive(Debug, Clone, Copy, PartialEq, Eq)]
192pub enum PlatformFamily {
193 Unknown = 0,
194 Apple = 1,
195 Windows = 2,
196 Linux = 3,
197}
198#[repr(u32)]
199#[derive(Debug, Clone, Copy, PartialEq, Eq)]
200pub enum HostEnvironment {
201 Unknown = 0,
202 Browser = 1,
203 Desktop = 2,
204 Headless = 3,
205}
206#[repr(u32)]
207#[derive(Debug, Clone, Copy, PartialEq, Eq)]
208pub enum HostCapability {
209 BrowserHistory = 1,
210 Reload = 2,
211 NewBrowsingContext = 4,
212 OpenExternalUri = 8,
213 ClipboardRead = 16,
214 ClipboardWrite = 32,
215 FileDialogs = 64,
216}
217#[repr(u32)]
218#[derive(Debug, Clone, Copy, PartialEq, Eq)]
219pub enum CursorStyle {
220 Default = 0,
221 Pointer = 1,
222 Text = 2,
223 Move = 3,
224 Grab = 4,
225 Grabbing = 5,
226 ResizeNS = 6,
227 ResizeEW = 7,
228}
229#[repr(u32)]
230#[derive(Debug, Clone, Copy, PartialEq, Eq)]
231pub enum SemanticCheckedState {
232 None = 0,
233 False = 1,
234 True = 2,
235 Mixed = 3,
236}
237
238#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
239#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "effindom_v2_ui"))]
240unsafe extern "C" {
241 pub fn ui_get_abi_version() -> u32;
242 pub fn ui_arena_alloc(size: u32) -> usize;
243 pub fn ui_reset();
244 pub fn ui_create_node(type_: u32) -> u64;
245 pub fn ui_delete_node(handle: u64);
246 pub fn ui_set_node_id(handle: u64, utf8_id: *const u8, len: u32);
247 pub fn ui_set_semantic_role(handle: u64, role_enum: u32);
248 pub fn ui_set_semantic_label(handle: u64, utf8_label: *const u8, len: u32);
249 pub fn ui_set_semantic_checked(handle: u64, checked_state_enum: u32);
250 pub fn ui_set_semantic_selected(handle: u64, has_selected: bool, is_selected: bool);
251 pub fn ui_set_semantic_expanded(handle: u64, has_expanded: bool, is_expanded: bool);
252 pub fn ui_set_semantic_disabled(handle: u64, has_disabled: bool, is_disabled: bool);
253 pub fn ui_set_semantic_value_range(
254 handle: u64,
255 has_value_range: bool,
256 value_now: f32,
257 value_min: f32,
258 value_max: f32,
259 );
260 pub fn ui_set_semantic_orientation(handle: u64, orientation_enum: u32);
261 pub fn ui_request_semantic_announcement(handle: u64);
262 pub fn ui_push_semantic_scope(handle: u64) -> u32;
263 pub fn ui_remove_semantic_scope(token: u32);
264 pub fn ui_node_add_child(parent: u64, child: u64);
265 pub fn ui_node_remove_child(parent: u64, child: u64);
266 pub fn ui_set_is_portal(handle: u64, is_portal: bool);
267 pub fn ui_set_visibility(handle: u64, visibility_enum: u32);
268 pub fn ui_set_width(handle: u64, value: f32, unit_enum: u32);
269 pub fn ui_set_height(handle: u64, value: f32, unit_enum: u32);
270 pub fn ui_set_fill_width(handle: u64, fill: bool);
271 pub fn ui_set_fill_height(handle: u64, fill: bool);
272 pub fn ui_set_fill_width_percent(handle: u64, percent: f32);
273 pub fn ui_set_fill_height_percent(handle: u64, percent: f32);
274 pub fn ui_set_min_width(handle: u64, value: f32, unit_enum: u32);
275 pub fn ui_set_max_width(handle: u64, value: f32, unit_enum: u32);
276 pub fn ui_set_min_height(handle: u64, value: f32, unit_enum: u32);
277 pub fn ui_set_max_height(handle: u64, value: f32, unit_enum: u32);
278 pub fn ui_set_flex_direction(handle: u64, dir_enum: u32);
279 pub fn ui_set_flex_basis(handle: u64, basis: f32);
280 pub fn ui_set_justify_content(handle: u64, justify_enum: u32);
281 pub fn ui_set_align_items(handle: u64, align_enum: u32);
282 pub fn ui_set_align_self(handle: u64, align_enum: u32);
283 pub fn ui_set_padding(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
284 pub fn ui_set_margin(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
285 pub fn ui_set_position_type(handle: u64, pos_enum: u32);
286 pub fn ui_set_position(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
287 pub fn ui_set_is_shared_size_scope(handle: u64, is_scope: bool);
288 pub fn ui_set_custom_drawable(handle: u64, is_custom_drawable: bool);
289 pub fn ui_set_flex_wrap(handle: u64, wrap_enum: u32);
290 pub fn ui_prepare_node(handle: u64) -> u32;
291 pub fn ui_set_dynamic_text_charset(handle: u64, utf8_charset: *const u8, len: u32);
292 pub fn ui_get_text_metrics(
293 handle: u64,
294 out_width: *mut f32,
295 out_height: *mut f32,
296 out_baseline: *mut f32,
297 out_line_count: *mut u32,
298 out_max_line_width: *mut f32,
299 ) -> bool;
300 pub fn ui_grid_set_columns(handle: u64, count: u32, values: *const f32, types: *const u8);
301 pub fn ui_grid_set_rows(handle: u64, count: u32, values: *const f32, types: *const u8);
302 pub fn ui_grid_set_column_shared_size_group(
303 handle: u64,
304 index: u32,
305 utf8_group: *const u8,
306 len: u32,
307 );
308 pub fn ui_grid_set_row_shared_size_group(
309 handle: u64,
310 index: u32,
311 utf8_group: *const u8,
312 len: u32,
313 );
314 pub fn ui_node_set_grid_placement(child: u64, row: u32, col: u32, row_span: u32, col_span: u32);
315 pub fn ui_set_bg_color(handle: u64, color: u32);
316 pub fn ui_set_box_style(
317 handle: u64,
318 bg_color: u32,
319 radius_tl: f32,
320 radius_tr: f32,
321 radius_br: f32,
322 radius_bl: f32,
323 border_width: f32,
324 border_color: u32,
325 border_style_enum: u32,
326 border_dash_on: f32,
327 border_dash_off: f32,
328 );
329 pub fn ui_set_clip_to_bounds(handle: u64, clip: bool);
330 pub fn ui_set_linear_gradient(
331 handle: u64,
332 sx: f32,
333 sy: f32,
334 ex: f32,
335 ey: f32,
336 stop_count: u32,
337 offsets: *const f32,
338 colors: *const u32,
339 );
340 pub fn ui_set_drop_shadow(
341 handle: u64,
342 color: u32,
343 offset_x: f32,
344 offset_y: f32,
345 blur_sigma: f32,
346 spread: f32,
347 );
348 pub fn ui_set_layer_effect(handle: u64, opacity: f32, blur_sigma: f32, blend_mode_enum: u32);
349 pub fn ui_set_background_blur(handle: u64, blur_sigma: f32);
350 pub fn ui_set_image(
351 handle: u64,
352 texture_id: u32,
353 object_fit_enum: u32,
354 sampling_kind: u32,
355 max_aniso: u32,
356 );
357 pub fn ui_set_image_nine(
358 handle: u64,
359 texture_id: u32,
360 inset_l: f32,
361 inset_t: f32,
362 inset_r: f32,
363 inset_b: f32,
364 sampling_kind: u32,
365 max_aniso: u32,
366 );
367 pub fn ui_set_svg(
368 handle: u64,
369 svg_id: u32,
370 tint_color: u32,
371 sampling_kind: u32,
372 max_aniso: u32,
373 );
374 pub fn ui_set_text(handle: u64, utf8_str: *const u8, len: u32);
375 pub fn ui_set_text_style_runs(handle: u64, run_count: u32, runs_words: *const u32);
376 pub fn ui_set_font(handle: u64, font_id: u32, size: f32);
377 pub fn ui_set_line_height(handle: u64, line_height: f32);
378 pub fn ui_set_text_color(handle: u64, color: u32);
379 pub fn ui_set_text_align(handle: u64, align_enum: u32);
380 pub fn ui_set_text_vertical_align(handle: u64, align_enum: u32);
381 pub fn ui_set_text_limits(handle: u64, max_chars: i32, max_lines: i32);
382 pub fn ui_set_text_wrapping(handle: u64, wrap: bool);
383 pub fn ui_set_text_overflow(handle: u64, overflow_enum: u32);
384 pub fn ui_set_text_overflow_fade(handle: u64, horizontal: bool, vertical: bool);
385 pub fn ui_set_text_obscured(handle: u64, is_password: bool);
386 pub fn ui_measure_text(
387 utf8_str: *const u8,
388 len: u32,
389 font_id: u32,
390 size: f32,
391 max_width: f32,
392 out_width: *mut f32,
393 out_height: *mut f32,
394 );
395 pub fn ui_set_interactive(handle: u64, interactive: bool);
396 pub fn ui_set_preserve_selection_on_pointer_down(handle: u64, preserve: bool);
397 pub fn ui_set_editor_command_keys(handle: u64, enabled: bool);
398 pub fn ui_set_editor_accepts_tab(handle: u64, enabled: bool);
399 pub fn ui_set_scroll_proxy_target(handle: u64, scroll_handle: u64);
400 pub fn ui_set_scroll_enabled(handle: u64, enabled_x: bool, enabled_y: bool);
401 pub fn ui_set_scroll_friction(handle: u64, friction: f32);
402 pub fn ui_set_smooth_scrolling(handle: u64, smooth_scrolling: bool);
403 pub fn ui_set_focusable(handle: u64, focusable: bool, tab_index: i32);
404 pub fn ui_request_focus(handle: u64);
405 pub fn ui_set_scroll_offset(handle: u64, offset_x: f32, offset_y: f32);
406 pub fn ui_set_scroll_content_size(handle: u64, content_width: f32, content_height: f32);
407 pub fn ui_set_selectable(handle: u64, selectable: bool, selection_color: u32);
408 pub fn ui_set_selection_area(handle: u64, is_area: bool);
409 pub fn ui_set_selection_area_barrier(handle: u64, is_barrier: bool);
410 pub fn ui_clear_selection(text_node_handle: u64);
411 pub fn ui_retarget_selection(from_text_node_handle: u64, to_text_node_handle: u64);
412 pub fn ui_is_point_in_selection(logical_x: f32, logical_y: f32) -> bool;
413 pub fn ui_set_text_selection_range(handle: u64, selection_start: u32, selection_end: u32);
414 pub fn ui_select_word_at(handle: u64, logical_x: f32, logical_y: f32) -> bool;
415 pub fn ui_get_text_snapshot_handle_count() -> u32;
416 pub fn ui_copy_text_snapshot_handles(out_handle_words: *mut u32, max_handle_count: u32) -> u32;
417 pub fn ui_set_text_find_match(handle: u64, start: u32, end: u32) -> bool;
418 pub fn ui_clear_text_find_match();
419 pub fn ui_push_text_find_highlight(handle: u64, start: u32, end: u32, color: u32) -> bool;
420 pub fn ui_clear_text_find_highlights();
421 pub fn ui_get_text_document_utf8_length(handle: u64) -> u32;
422 pub fn ui_copy_text_document_utf8(handle: u64, out_utf8: *mut u8, buffer_length: u32) -> bool;
423 pub fn ui_get_text_visible_bounds(
424 handle: u64,
425 out_x: *mut f32,
426 out_y: *mut f32,
427 out_width: *mut f32,
428 out_height: *mut f32,
429 ) -> bool;
430 pub fn ui_get_text_range_rect_count(handle: u64, start: u32, end: u32) -> u32;
431 pub fn ui_copy_text_range_rects(
432 handle: u64,
433 start: u32,
434 end: u32,
435 out_rect_words: *mut f32,
436 max_rect_count: u32,
437 ) -> u32;
438 pub fn ui_copy_cross_selection_endpoint_rects(
439 area_handle: u64,
440 out_rect_words: *mut f32,
441 ) -> bool;
442 pub fn ui_begin_selection_endpoint_drag(handle: u64, endpoint: u32) -> bool;
443 pub fn ui_preserves_selection_on_pointer_down(handle: u64) -> bool;
444 pub fn ui_reveal_text_range(handle: u64, start: u32, end: u32) -> bool;
445 pub fn ui_clear_current_selection();
446 pub fn ui_copy_current_selection();
447 pub fn ui_can_undo_text_edit(handle: u64) -> bool;
448 pub fn ui_can_redo_text_edit(handle: u64) -> bool;
449 pub fn ui_has_text_selection(handle: u64) -> bool;
450 pub fn ui_undo_text_edit(handle: u64);
451 pub fn ui_redo_text_edit(handle: u64);
452 pub fn ui_copy_text_selection(handle: u64);
453 pub fn ui_cut_text_selection(handle: u64);
454 pub fn ui_paste_text(handle: u64);
455 pub fn ui_select_all_text(handle: u64);
456 pub fn ui_set_editable(handle: u64, editable: bool);
457 pub fn ui_set_caret_color(handle: u64, color: u32);
458 pub fn ui_commit_frame();
459 pub fn ui_has_pending_visual_work() -> bool;
460 pub fn ui_needs_animation_frame() -> bool;
461 pub fn ui_has_pointer_autoscroll() -> bool;
462 pub fn ui_selection_autoscroll(logical_x: f32, logical_y: f32, edge_threshold: f32) -> u64;
463 pub fn ui_on_pointer_event(
464 event_enum: u32,
465 handle: u64,
466 logical_x: f32,
467 logical_y: f32,
468 pointer_id: i32,
469 pointer_type: u32,
470 button: i32,
471 buttons: u32,
472 pressure: f32,
473 width: f32,
474 height: f32,
475 click_count: i32,
476 modifiers: u32,
477 ) -> bool;
478 pub fn ui_on_wheel_event(delta_x: f32, delta_y: f32);
479 pub fn ui_touch_scroll_begin(handle: u64, logical_x: f32, logical_y: f32, timestamp_ms: f64);
480 pub fn ui_touch_scroll_update(delta_x: f32, delta_y: f32, timestamp_ms: f64);
481 pub fn ui_wheel_scroll_can_consume(delta_x: f32, delta_y: f32) -> bool;
482 pub fn ui_touch_scroll_can_consume(delta_x: f32, delta_y: f32) -> bool;
483 pub fn ui_touch_scroll_end(timestamp_ms: f64);
484 pub fn ui_clear_momentum_scroll();
485 pub fn ui_touch_scroll_allows_pull_to_refresh() -> bool;
486 pub fn ui_set_coarse_pointer_mode(coarse_pointer_mode: bool);
487 pub fn ui_set_platform_family(platform_family: u32);
488 pub fn ui_on_key_event(type_enum: u32, key_utf8: *const u8, len: u32, modifiers: u32) -> bool;
489 pub fn ui_set_interaction_time(interaction_time_ms: u64);
490 pub fn ui_on_ime_update(handle: u64, utf8_str: *const u8, len: u32, caret_idx: u32);
491 pub fn ui_replace_text_range(
492 handle: u64,
493 start_idx: u32,
494 end_idx: u32,
495 utf8_str: *const u8,
496 len: u32,
497 caret_idx: u32,
498 );
499 pub fn ui_on_paste_text(handle: u64, utf8_str: *const u8, len: u32);
500 pub fn ui_font_loaded(font_id: u32);
501 pub fn ui_register_icu_data(bytes: *const u8, len: u32);
502 pub fn ui_register_font_fallback(font_id: u32, fallback_font_id: u32);
503 pub fn ui_unregister_font_fallback(font_id: u32, fallback_font_id: u32) -> bool;
504 pub fn ui_unregister_font(font_id: u32) -> bool;
505 pub fn ui_set_root(handle: u64);
506 pub fn ui_resize_window(logical_w: f32, logical_h: f32);
507 pub fn ui_register_font(font_id: u32, bytes: *const u8, len: u32) -> bool;
508 pub fn ui_get_command_buffer(out_length: *mut u32) -> *mut u32;
509 pub fn ui_get_semantic_buffer(out_length: *mut u32) -> *mut u32;
510 pub fn ui_get_debug_tree_buffer(out_length: *mut u32) -> *mut u32;
511 pub fn ui_get_live_fallback_font_buffer(out_length: *mut u32) -> *mut u32;
512 pub fn ui_get_bounds(
513 handle: u64,
514 out_x: *mut f32,
515 out_y: *mut f32,
516 out_width: *mut f32,
517 out_height: *mut f32,
518 ) -> bool;
519 pub fn ui_get_focused_handle() -> u64;
520 pub fn ui_get_visible_bounds(
521 handle: u64,
522 out_x: *mut f32,
523 out_y: *mut f32,
524 out_width: *mut f32,
525 out_height: *mut f32,
526 ) -> bool;
527 pub fn ui_set_host_callbacks(callbacks: *const u32);
528}
529
530#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
531#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "fui_host"))]
532unsafe extern "C" {
533 pub fn request_render();
534 pub fn get_viewport_width() -> f32;
535 pub fn get_viewport_height() -> f32;
536 pub fn get_device_pixel_ratio() -> f32;
537 pub fn fui_set_application_caption(captionPtr: usize, captionLen: u32);
538 pub fn fui_set_pointer_capture(handle: u64);
539 pub fn fui_release_pointer_capture();
540 pub fn fui_reload_page();
541 pub fn fui_can_navigate_back() -> bool;
542 pub fn fui_can_navigate_forward() -> bool;
543 pub fn fui_navigate_back();
544 pub fn fui_navigate_forward();
545 pub fn fui_copy_text(ptr: usize, len: u32);
546 pub fn fui_register_text_input_metadata(
547 handle: u64,
548 isPassword: bool,
549 hintPtr: usize,
550 hintLen: u32,
551 );
552 pub fn fui_has_text_selection_snapshot(handle: u64) -> bool;
553 pub fn fui_freeze_text_selection_snapshot(handle: u64);
554 pub fn fui_copy_text_selection_snapshot(handle: u64) -> bool;
555 pub fn fui_cut_focused_text_selection() -> bool;
556 pub fn fui_cut_text_selection_snapshot(handle: u64) -> bool;
557 pub fn fui_cut_text_range_snapshot(handle: u64, start: u32, end: u32) -> bool;
558 pub fn fui_delete_focused_text_range(start: u32, end: u32) -> bool;
559 pub fn fui_commit_text_action_focus(handle: u64);
560 pub fn fui_load_svg(svgId: u32, ptr: usize, len: u32);
561 pub fn fui_load_texture(textureId: u32, ptr: usize, len: u32);
562 pub fn fui_release_svg(svgId: u32);
563 pub fn fui_release_texture(textureId: u32);
564 pub fn fui_bitmap_commit(
565 textureId: u32,
566 bytesPtr: usize,
567 bytesLen: u32,
568 width: u32,
569 height: u32,
570 );
571 pub fn fui_bitmap_commit_dirty(
572 textureId: u32,
573 bytesPtr: usize,
574 bytesLen: u32,
575 fullW: u32,
576 fullH: u32,
577 subX: u32,
578 subY: u32,
579 subW: u32,
580 subH: u32,
581 );
582 pub fn fui_bitmap_release(textureId: u32);
583 pub fn fui_render_node_to_rgba(
584 handle: u64,
585 width: u32,
586 height: u32,
587 outPtr: usize,
588 outCapacity: u32,
589 scale: f32,
590 x: f32,
591 y: f32,
592 ) -> u32;
593 pub fn fui_load_font(fontId: u32, ptr: usize, len: u32);
594 pub fn fui_start_timer(timerId: u32, delayMs: i32);
595 pub fn fui_cancel_timer(timerId: u32);
596 pub fn fui_set_cursor(style: u32);
597 pub fn fui_is_dark_mode() -> bool;
598 pub fn fui_get_accent_color() -> u32;
599 pub fn fui_get_platform_family() -> u32;
600 pub fn fui_get_host_environment() -> u32;
601 pub fn fui_get_host_capabilities() -> u32;
602 pub fn fui_is_coarse_pointer() -> bool;
603 pub fn fui_show_url_preview(ptr: usize, len: u32);
604 pub fn fui_hide_url_preview();
605 pub fn fui_navigate_to(ptr: usize, len: u32, openInNewTab: bool);
606 pub fn fui_set_persisted_scroll_offset(nodeIdPtr: usize, nodeIdLen: u32, x: f32, y: f32);
607 pub fn fui_try_get_persisted_scroll_offset(
608 nodeIdPtr: usize,
609 nodeIdLen: u32,
610 outX: usize,
611 outY: usize,
612 ) -> bool;
613 pub fn fui_set_persisted_state(
614 nodeIdPtr: usize,
615 nodeIdLen: u32,
616 kindPtr: usize,
617 kindLen: u32,
618 version: u32,
619 payloadPtr: usize,
620 payloadLen: u32,
621 );
622 pub fn fui_copy_persisted_state(
623 nodeIdPtr: usize,
624 nodeIdLen: u32,
625 kindPtr: usize,
626 kindLen: u32,
627 outVersionPtr: usize,
628 payloadPtr: usize,
629 payloadCapacity: u32,
630 ) -> i32;
631 pub fn fui_log(categoryPtr: usize, catLen: u32, msgPtr: usize, msgLen: u32);
632 pub fn fui_logs_enabled() -> bool;
633 pub fn fui_worker_start_string(
634 workerId: u32,
635 wasmPathPtr: usize,
636 wasmPathLen: u32,
637 entryPtr: usize,
638 entryLen: u32,
639 inputPtr: usize,
640 inputLen: u32,
641 );
642 pub fn fui_worker_cancel(workerId: u32);
643 pub fn fui_file_capabilities() -> u32;
644 pub fn fui_file_pick(requestId: u32, acceptPtr: usize, acceptLen: u32, multiple: bool);
645 pub fn fui_file_read_chunk(
646 requestId: u32,
647 fileIdPtr: usize,
648 fileIdLen: u32,
649 offsetBytes: u64,
650 maxBytes: u32,
651 );
652 pub fn fui_file_save_text(
653 requestId: u32,
654 suggestedNamePtr: usize,
655 suggestedNameLen: u32,
656 mimeTypePtr: usize,
657 mimeTypeLen: u32,
658 fileExtensionPtr: usize,
659 fileExtensionLen: u32,
660 textPtr: usize,
661 textLen: u32,
662 );
663 pub fn fui_file_save_bytes(
664 requestId: u32,
665 suggestedNamePtr: usize,
666 suggestedNameLen: u32,
667 mimeTypePtr: usize,
668 mimeTypeLen: u32,
669 fileExtensionPtr: usize,
670 fileExtensionLen: u32,
671 bytesPtr: usize,
672 bytesLen: u32,
673 );
674 pub fn fui_file_create_writer(
675 requestId: u32,
676 suggestedNamePtr: usize,
677 suggestedNameLen: u32,
678 mimeTypePtr: usize,
679 mimeTypeLen: u32,
680 fileExtensionPtr: usize,
681 fileExtensionLen: u32,
682 );
683 pub fn fui_file_writer_write_text(
684 requestId: u32,
685 writerIdPtr: usize,
686 writerIdLen: u32,
687 textPtr: usize,
688 textLen: u32,
689 );
690 pub fn fui_file_writer_write_bytes(
691 requestId: u32,
692 writerIdPtr: usize,
693 writerIdLen: u32,
694 bytesPtr: usize,
695 bytesLen: u32,
696 );
697 pub fn fui_file_writer_finish(requestId: u32, writerIdPtr: usize, writerIdLen: u32);
698 pub fn fui_file_process_worker_start(
699 requestId: u32,
700 workerWasmPathPtr: usize,
701 workerWasmPathLen: u32,
702 workerEntryPtr: usize,
703 workerEntryLen: u32,
704 fileIdPtr: usize,
705 fileIdLen: u32,
706 suggestedNamePtr: usize,
707 suggestedNameLen: u32,
708 chunkBytes: u32,
709 saveToPickedFile: bool,
710 );
711 pub fn fui_file_process_worker_cancel(requestId: u32);
712 pub fn fui_canvas_save(canvasPtr: usize);
713 pub fn fui_canvas_restore(canvasPtr: usize);
714 pub fn fui_canvas_translate(canvasPtr: usize, x: f32, y: f32);
715 pub fn fui_canvas_scale(canvasPtr: usize, sx: f32, sy: f32);
716 pub fn fui_canvas_rotate(canvasPtr: usize, degrees: f32);
717 pub fn fui_canvas_clip_rect(canvasPtr: usize, x: f32, y: f32, w: f32, h: f32);
718 pub fn fui_canvas_clip_round_rect(
719 canvasPtr: usize,
720 x: f32,
721 y: f32,
722 w: f32,
723 h: f32,
724 topLeft: f32,
725 topRight: f32,
726 bottomRight: f32,
727 bottomLeft: f32,
728 );
729 pub fn fui_canvas_draw_rect(
730 canvasPtr: usize,
731 x: f32,
732 y: f32,
733 w: f32,
734 h: f32,
735 fillColor: u32,
736 strokeColor: u32,
737 strokeWidth: f32,
738 );
739 pub fn fui_canvas_draw_circle(
740 canvasPtr: usize,
741 cx: f32,
742 cy: f32,
743 radius: f32,
744 fillColor: u32,
745 strokeColor: u32,
746 strokeWidth: f32,
747 );
748 pub fn fui_canvas_draw_line(
749 canvasPtr: usize,
750 x1: f32,
751 y1: f32,
752 x2: f32,
753 y2: f32,
754 color: u32,
755 strokeWidth: f32,
756 );
757 pub fn fui_canvas_draw_round_rect(
758 canvasPtr: usize,
759 x: f32,
760 y: f32,
761 w: f32,
762 h: f32,
763 rx: f32,
764 ry: f32,
765 fillColor: u32,
766 strokeColor: u32,
767 strokeWidth: f32,
768 );
769 pub fn fui_path_create() -> u32;
770 pub fn fui_path_destroy(pathId: u32);
771 pub fn fui_path_move_to(pathId: u32, x: f32, y: f32);
772 pub fn fui_path_line_to(pathId: u32, x: f32, y: f32);
773 pub fn fui_path_quad_to(pathId: u32, cx: f32, cy: f32, x: f32, y: f32);
774 pub fn fui_path_cubic_to(pathId: u32, cx1: f32, cy1: f32, cx2: f32, cy2: f32, x: f32, y: f32);
775 pub fn fui_path_close(pathId: u32);
776 pub fn fui_path_add_rect(pathId: u32, x: f32, y: f32, w: f32, h: f32);
777 pub fn fui_path_add_circle(pathId: u32, cx: f32, cy: f32, r: f32);
778 pub fn fui_canvas_draw_path(
779 canvasPtr: usize,
780 pathId: u32,
781 fillColor: u32,
782 strokeColor: u32,
783 strokeWidth: f32,
784 );
785 pub fn fui_canvas_draw_text_node(
786 canvasPtr: usize,
787 handleLo: u32,
788 handleHi: u32,
789 x: f32,
790 y: f32,
791 );
792 pub fn fui_canvas_draw_image(
793 canvasPtr: usize,
794 textureId: u32,
795 x: f32,
796 y: f32,
797 w: f32,
798 h: f32,
799 samplingKind: u32,
800 maxAniso: u32,
801 );
802 pub fn fui_canvas_draw_svg(canvasPtr: usize, svgId: u32, x: f32, y: f32, w: f32, h: f32);
803 pub fn fui_canvas_draw_batch(canvasPtr: usize, wordsPtr: usize, wordCount: u32);
804 pub fn fui_canvas_create_offscreen(width: u32, height: u32) -> u32;
805 pub fn fui_canvas_get_offscreen_ptr(offscreenId: u32) -> usize;
806 pub fn fui_canvas_read_offscreen_pixels(
807 offscreenId: u32,
808 outPtr: usize,
809 width: u32,
810 height: u32,
811 );
812 pub fn fui_canvas_destroy_offscreen(offscreenId: u32);
813}
814
815#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
816#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "fui_fetch_host"))]
817unsafe extern "C" {
818 pub fn fui_fetch_start(
819 requestId: u32,
820 methodPtr: usize,
821 methodLen: u32,
822 urlPtr: usize,
823 urlLen: u32,
824 headersPtr: usize,
825 headersLen: u32,
826 bodyPtr: usize,
827 bodyLen: u32,
828 );
829 pub fn fui_fetch_cancel(requestId: u32);
830}