ferroui_base/rendering/composition/generated/mod.rs
1// @generated by scripts/generate_composition.py — do not edit
2
3//! The composition object model generated from the composition schema.
4//!
5//! Upstream generates C# partial classes and completes them by hand in the
6//! other half of each partial class. Here the generated half of a schema class
7//! `X` is a pair of *property blocks* that the hand-written class embeds, and a
8//! pair of *hook traits* through which the block calls back into that class:
9//!
10//! | Upstream (generated) | Here |
11//! |----------------------------------------------|----------------------------------------|
12//! | `enum XChangedFields` | `XChangedFields` (bit flags) |
13//! | fields, properties, `InitializeDefaults`, `SerializeChangesCore`, `StartAnimation` of `X` | `XProps` |
14//! | `partial void` methods of `X` | `XHooks` (default: do nothing) |
15//! | fields, properties, `DeserializeChangesCore`, `GetCompositionProperty`, `SerializeAllChanges` of `ServerX` | `ServerXProps` |
16//! | `partial void` methods of `ServerX` | `ServerXHooks` (default: do nothing) |
17//! | `static CompositionProperty<T> s_IdOfPProperty` | `ServerXProps::id_of_p_property()` |
18//!
19//! A `ServerOnly` class has no `XProps`; its UI-thread side is a media class
20//! that calls `ServerXProps::serialize_all_changes`.
21//!
22//! # Embedding the UI-thread block
23//!
24//! The class holds an `XProps` (created with `XProps::new()`), implements
25//! `ICompositionObjectHost` (registering for serialization, the id of its
26//! server object, pending and implicit animations) and `XHooks`, and
27//!
28//! * calls `props.initialize_defaults(self)` where the upstream constructor
29//! calls `InitializeDefaults()` (use `initialize_own_defaults` when the
30//! constructor chain is customised);
31//! * exposes the properties by forwarding to `props.p()` /
32//! `props.set_p(self, value)`; the setter raises the hooks, marks the field
33//! changed, registers the object and handles implicit animations exactly as
34//! the upstream setter does;
35//! * forwards `ICompositorSerializable::serialize_changes` to
36//! `props.serialize_changes_core(self, writer)` and `StartAnimation` to
37//! `props.start_animation(self, name, animation, final_value)` (a `false`
38//! result means the property is unknown to the generated classes).
39//!
40//! # Embedding the server block
41//!
42//! The class holds a `ServerXProps`, implements `IServerPropertyHost` (or
43//! `IServerAnimatedPropertyHost` when it derives from the animatable server
44//! object) and `ServerXHooks`, and
45//!
46//! * forwards `IServerObject::deserialize_changes_core` to
47//! `props.deserialize_changes_core(self, reader, committed_at)`;
48//! * returns `props.find_props(type_id)` from `IServerObject::get_props`, which
49//! is how composition properties reach the fields of the block;
50//! * exposes the properties by forwarding to `props.p()` /
51//! `props.set_p(self, value)`.
52//!
53//! `IServerPropertyHost::set_value` is upstream's `SetValue(prop, ref field,
54//! value)`: the block hands the class the assignment and the class decides what
55//! surrounds it (nothing, animation subscriptions, or the observer bookkeeping
56//! of a render resource).
57//!
58//! # Inheritance
59//!
60//! A class whose base class is generated embeds the block of the base
61//! (`props.base()`), its hook trait extends the hook trait of the base, and its
62//! `serialize_changes_core` / `deserialize_changes_core` run the base first, as
63//! `base.SerializeChangesCore` does upstream. A class whose base is written by
64//! hand (a `Manual` class of the schema, or a `ServerBase` that is not
65//! generated) has a required hook instead, `base_serialize_changes_core` /
66//! `base_deserialize_changes_core`, called at the same point.
67//!
68//! # Types
69//!
70//! Composition objects referenced by a property are held as
71//! `Rc<dyn ICompositionObject>` on the UI thread and cross as the id of their
72//! server object; the server block holds the resolved `Rc<dyn IServerObject>`.
73//! Brushes and transforms are `BatchResource` values on the UI thread (the
74//! value itself or the id of its server-side counterpart) and
75//! `ServerResourceRef` values on the server. Other reference types cross as
76//! payloads; plain values cross through `BatchValue`.
77//!
78//! The schema attributes `Internal`, `Private` and `InternalSet` are recorded
79//! in the documentation of the generated items; everything is `pub` so the
80//! hand-written classes, which live in other modules, can reach it.
81//!
82//! # Classes of the schema that are not generated
83//!
84//! Manual classes (written by hand): `CompositionSurface`, `CompositionDrawingSurface`, `CompositionDrawListVisual`, `CompositionSimpleGradientBrush`, `CompositionGradientBrush`.
85
86mod composition_animations;
87mod composition_bitmap_cache;
88mod composition_brush;
89mod composition_cache_mode;
90mod composition_conic_gradient_brush;
91mod composition_container_visual;
92mod composition_experimental_acrylic_visual;
93mod composition_gradient_stop;
94mod composition_linear_gradient_brush;
95mod composition_radial_gradient_brush;
96mod composition_simple_brush;
97mod composition_simple_conic_gradient_brush;
98mod composition_simple_geometry;
99mod composition_simple_linear_gradient_brush;
100mod composition_simple_pen;
101mod composition_simple_radial_gradient_brush;
102mod composition_simple_solid_color_brush;
103mod composition_simple_tile_brush;
104mod composition_simple_transform;
105mod composition_solid_color_brush;
106mod composition_solid_color_visual;
107mod composition_surface_visual;
108mod composition_target;
109mod composition_tile_brush;
110mod composition_visual;
111mod composition_visual_collection;
112
113pub use composition_animations::*;
114pub use composition_bitmap_cache::*;
115pub use composition_brush::*;
116pub use composition_cache_mode::*;
117pub use composition_conic_gradient_brush::*;
118pub use composition_container_visual::*;
119pub use composition_experimental_acrylic_visual::*;
120pub use composition_gradient_stop::*;
121pub use composition_linear_gradient_brush::*;
122pub use composition_radial_gradient_brush::*;
123pub use composition_simple_brush::*;
124pub use composition_simple_conic_gradient_brush::*;
125pub use composition_simple_geometry::*;
126pub use composition_simple_linear_gradient_brush::*;
127pub use composition_simple_pen::*;
128pub use composition_simple_radial_gradient_brush::*;
129pub use composition_simple_solid_color_brush::*;
130pub use composition_simple_tile_brush::*;
131pub use composition_simple_transform::*;
132pub use composition_solid_color_brush::*;
133pub use composition_solid_color_visual::*;
134pub use composition_surface_visual::*;
135pub use composition_target::*;
136pub use composition_tile_brush::*;
137pub use composition_visual::*;
138pub use composition_visual_collection::*;
139
140#[cfg(test)]
141mod tests;