Expand description
The composition object model generated from the composition schema.
Upstream generates C# partial classes and completes them by hand in the
other half of each partial class. Here the generated half of a schema class
X is a pair of property blocks that the hand-written class embeds, and a
pair of hook traits through which the block calls back into that class:
| Upstream (generated) | Here |
|---|---|
enum XChangedFields | XChangedFields (bit flags) |
fields, properties, InitializeDefaults, SerializeChangesCore, StartAnimation of X | XProps |
partial void methods of X | XHooks (default: do nothing) |
fields, properties, DeserializeChangesCore, GetCompositionProperty, SerializeAllChanges of ServerX | ServerXProps |
partial void methods of ServerX | ServerXHooks (default: do nothing) |
static CompositionProperty<T> s_IdOfPProperty | ServerXProps::id_of_p_property() |
A ServerOnly class has no XProps; its UI-thread side is a media class
that calls ServerXProps::serialize_all_changes.
§Embedding the UI-thread block
The class holds an XProps (created with XProps::new()), implements
ICompositionObjectHost (registering for serialization, the id of its
server object, pending and implicit animations) and XHooks, and
- calls
props.initialize_defaults(self)where the upstream constructor callsInitializeDefaults()(useinitialize_own_defaultswhen the constructor chain is customised); - exposes the properties by forwarding to
props.p()/props.set_p(self, value); the setter raises the hooks, marks the field changed, registers the object and handles implicit animations exactly as the upstream setter does; - forwards
ICompositorSerializable::serialize_changestoprops.serialize_changes_core(self, writer)andStartAnimationtoprops.start_animation(self, name, animation, final_value)(afalseresult means the property is unknown to the generated classes).
§Embedding the server block
The class holds a ServerXProps, implements IServerPropertyHost (or
IServerAnimatedPropertyHost when it derives from the animatable server
object) and ServerXHooks, and
- forwards
IServerObject::deserialize_changes_coretoprops.deserialize_changes_core(self, reader, committed_at); - returns
props.find_props(type_id)fromIServerObject::get_props, which is how composition properties reach the fields of the block; - exposes the properties by forwarding to
props.p()/props.set_p(self, value).
IServerPropertyHost::set_value is upstream’s SetValue(prop, ref field, value): the block hands the class the assignment and the class decides what
surrounds it (nothing, animation subscriptions, or the observer bookkeeping
of a render resource).
§Inheritance
A class whose base class is generated embeds the block of the base
(props.base()), its hook trait extends the hook trait of the base, and its
serialize_changes_core / deserialize_changes_core run the base first, as
base.SerializeChangesCore does upstream. A class whose base is written by
hand (a Manual class of the schema, or a ServerBase that is not
generated) has a required hook instead, base_serialize_changes_core /
base_deserialize_changes_core, called at the same point.
§Types
Composition objects referenced by a property are held as
Rc<dyn ICompositionObject> on the UI thread and cross as the id of their
server object; the server block holds the resolved Rc<dyn IServerObject>.
Brushes and transforms are BatchResource values on the UI thread (the
value itself or the id of its server-side counterpart) and
ServerResourceRef values on the server. Other reference types cross as
payloads; plain values cross through BatchValue.
The schema attributes Internal, Private and InternalSet are recorded
in the documentation of the generated items; everything is pub so the
hand-written classes, which live in other modules, can reach it.
§Classes of the schema that are not generated
Manual classes (written by hand): CompositionSurface, CompositionDrawingSurface, CompositionDrawListVisual, CompositionSimpleGradientBrush, CompositionGradientBrush.
Structs§
- Composition
Bitmap Cache Changed Fields - The fields of
CompositionBitmapCachethat changed since its last serialization. - Composition
Bitmap Cache Props - The UI-thread properties of
CompositionBitmapCache. - Composition
Brush Changed Fields - The fields of
CompositionBrushthat changed since its last serialization. - Composition
Brush Props - The UI-thread properties of
CompositionBrush. - Composition
Cache Mode Props - The UI-thread properties of
CompositionCacheMode. - Composition
Conic Gradient Brush Changed Fields - The fields of
CompositionConicGradientBrushthat changed since its last serialization. - Composition
Conic Gradient Brush Props - The UI-thread properties of
CompositionConicGradientBrush. - Composition
Container Visual Props - The UI-thread properties of
CompositionContainerVisual. - Composition
Experimental Acrylic Visual Changed Fields - The fields of
CompositionExperimentalAcrylicVisualthat changed since its last serialization. - Composition
Experimental Acrylic Visual Props - The UI-thread properties of
CompositionExperimentalAcrylicVisual. - Composition
Gradient Stop Changed Fields - The fields of
CompositionGradientStopthat changed since its last serialization. - Composition
Gradient Stop Props - The UI-thread properties of
CompositionGradientStop. - Composition
Linear Gradient Brush Changed Fields - The fields of
CompositionLinearGradientBrushthat changed since its last serialization. - Composition
Linear Gradient Brush Props - The UI-thread properties of
CompositionLinearGradientBrush. - Composition
Radial Gradient Brush Changed Fields - The fields of
CompositionRadialGradientBrushthat changed since its last serialization. - Composition
Radial Gradient Brush Props - The UI-thread properties of
CompositionRadialGradientBrush. - Composition
Simple Brush Changed Fields - The fields of
CompositionSimpleBrushthat changed since its last serialization. - Composition
Simple Conic Gradient Brush Changed Fields - The fields of
CompositionSimpleConicGradientBrushthat changed since its last serialization. - Composition
Simple Geometry Changed Fields - The fields of
CompositionSimpleGeometrythat changed since its last serialization. - Composition
Simple Linear Gradient Brush Changed Fields - The fields of
CompositionSimpleLinearGradientBrushthat changed since its last serialization. - Composition
Simple PenChanged Fields - The fields of
CompositionSimplePenthat changed since its last serialization. - Composition
Simple Radial Gradient Brush Changed Fields - The fields of
CompositionSimpleRadialGradientBrushthat changed since its last serialization. - Composition
Simple Solid Color Brush Changed Fields - The fields of
CompositionSimpleSolidColorBrushthat changed since its last serialization. - Composition
Simple Tile Brush Changed Fields - The fields of
CompositionSimpleTileBrushthat changed since its last serialization. - Composition
Simple Transform Changed Fields - The fields of
CompositionSimpleTransformthat changed since its last serialization. - Composition
Solid Color Brush Changed Fields - The fields of
CompositionSolidColorBrushthat changed since its last serialization. - Composition
Solid Color Brush Props - The UI-thread properties of
CompositionSolidColorBrush. - Composition
Solid Color Visual Changed Fields - The fields of
CompositionSolidColorVisualthat changed since its last serialization. - Composition
Solid Color Visual Props - The UI-thread properties of
CompositionSolidColorVisual. - Composition
Surface Visual Changed Fields - The fields of
CompositionSurfaceVisualthat changed since its last serialization. - Composition
Surface Visual Props - The UI-thread properties of
CompositionSurfaceVisual. - Composition
Target Changed Fields - The fields of
CompositionTargetthat changed since its last serialization. - Composition
Target Props - The UI-thread properties of
CompositionTarget. - Composition
Tile Brush Changed Fields - The fields of
CompositionTileBrushthat changed since its last serialization. - Composition
Visual Changed Fields - The fields of
CompositionVisualthat changed since its last serialization. - Composition
Visual Collection Props - The UI-thread list of
CompositionVisualCollection. - Composition
Visual Props - The UI-thread properties of
CompositionVisual. - Server
Composition Bitmap Cache Props - The server-side properties of
ServerCompositionBitmapCache. - Server
Composition Brush Props - The server-side properties of
ServerCompositionBrush. - Server
Composition Cache Mode Props - The server-side properties of
ServerCompositionCacheMode. - Server
Composition Conic Gradient Brush Props - The server-side properties of
ServerCompositionConicGradientBrush. - Server
Composition Container Visual Props - The server-side properties of
ServerCompositionContainerVisual. - Server
Composition Experimental Acrylic Visual Props - The server-side properties of
ServerCompositionExperimentalAcrylicVisual. - Server
Composition Gradient Stop Props - The server-side properties of
ServerCompositionGradientStop. - Server
Composition Linear Gradient Brush Props - The server-side properties of
ServerCompositionLinearGradientBrush. - Server
Composition Radial Gradient Brush Props - The server-side properties of
ServerCompositionRadialGradientBrush. - Server
Composition Simple Brush Props - The server-side properties of
ServerCompositionSimpleBrush. - Server
Composition Simple Conic Gradient Brush Props - The server-side properties of
ServerCompositionSimpleConicGradientBrush. - Server
Composition Simple Geometry Props - The server-side properties of
ServerCompositionSimpleGeometry. - Server
Composition Simple Linear Gradient Brush Props - The server-side properties of
ServerCompositionSimpleLinearGradientBrush. - Server
Composition Simple PenProps - The server-side properties of
ServerCompositionSimplePen. - Server
Composition Simple Radial Gradient Brush Props - The server-side properties of
ServerCompositionSimpleRadialGradientBrush. - Server
Composition Simple Solid Color Brush Props - The server-side properties of
ServerCompositionSimpleSolidColorBrush. - Server
Composition Simple Tile Brush Props - The server-side properties of
ServerCompositionSimpleTileBrush. - Server
Composition Simple Transform Props - The server-side properties of
ServerCompositionSimpleTransform. - Server
Composition Solid Color Brush Props - The server-side properties of
ServerCompositionSolidColorBrush. - Server
Composition Solid Color Visual Props - The server-side properties of
ServerCompositionSolidColorVisual. - Server
Composition Surface Visual Props - The server-side properties of
ServerCompositionSurfaceVisual. - Server
Composition Target Props - The server-side properties of
ServerCompositionTarget. - Server
Composition Tile Brush Props - The server-side properties of
ServerCompositionTileBrush. - Server
Composition Visual Collection Props - The server-side properties of
ServerCompositionVisualCollection. - Server
Composition Visual Props - The server-side properties of
ServerCompositionVisual.
Constants§
- KEY_
FRAME_ ANIMATIONS - The key frame animations of the schema: (name, schema type).
Traits§
- Composition
Bitmap Cache Hooks - The partial methods of
CompositionBitmapCache: implemented by the class that embedsCompositionBitmapCacheProps. Every hook defaults to doing nothing. - Composition
Brush Hooks - The partial methods of
CompositionBrush: implemented by the class that embedsCompositionBrushProps. Every hook defaults to doing nothing. - Composition
Cache Mode Hooks - The partial methods of
CompositionCacheMode: implemented by the class that embedsCompositionCacheModeProps. Every hook defaults to doing nothing. - Composition
Conic Gradient Brush Hooks - The partial methods of
CompositionConicGradientBrush: implemented by the class that embedsCompositionConicGradientBrushProps. Every hook defaults to doing nothing. - Composition
Container Visual Hooks - The partial methods of
CompositionContainerVisual: implemented by the class that embedsCompositionContainerVisualProps. Every hook defaults to doing nothing. - Composition
Experimental Acrylic Visual Hooks - The partial methods of
CompositionExperimentalAcrylicVisual: implemented by the class that embedsCompositionExperimentalAcrylicVisualProps. Every hook defaults to doing nothing. - Composition
Gradient Stop Hooks - The partial methods of
CompositionGradientStop: implemented by the class that embedsCompositionGradientStopProps. Every hook defaults to doing nothing. - Composition
Linear Gradient Brush Hooks - The partial methods of
CompositionLinearGradientBrush: implemented by the class that embedsCompositionLinearGradientBrushProps. Every hook defaults to doing nothing. - Composition
Radial Gradient Brush Hooks - The partial methods of
CompositionRadialGradientBrush: implemented by the class that embedsCompositionRadialGradientBrushProps. Every hook defaults to doing nothing. - Composition
Solid Color Brush Hooks - The partial methods of
CompositionSolidColorBrush: implemented by the class that embedsCompositionSolidColorBrushProps. Every hook defaults to doing nothing. - Composition
Solid Color Visual Hooks - The partial methods of
CompositionSolidColorVisual: implemented by the class that embedsCompositionSolidColorVisualProps. Every hook defaults to doing nothing. - Composition
Surface Visual Hooks - The partial methods of
CompositionSurfaceVisual: implemented by the class that embedsCompositionSurfaceVisualProps. Every hook defaults to doing nothing. - Composition
Target Hooks - The partial methods of
CompositionTarget: implemented by the class that embedsCompositionTargetProps. Every hook defaults to doing nothing. - Composition
Visual Collection Hooks - The partial methods of
CompositionVisualCollection: implemented by the class that embedsCompositionVisualCollectionProps.TItemis the UI-thread class of the items (CompositionVisual). Every hook defaults to doing nothing. - Composition
Visual Hooks - The partial methods of
CompositionVisual: implemented by the class that embedsCompositionVisualProps. Every hook defaults to doing nothing. - Server
Composition Bitmap Cache Hooks - The partial methods of
ServerCompositionBitmapCache: implemented by the class that embedsServerCompositionBitmapCacheProps. Every hook defaults to doing nothing. - Server
Composition Brush Hooks - The partial methods of
ServerCompositionBrush: implemented by the class that embedsServerCompositionBrushProps. Every hook defaults to doing nothing. - Server
Composition Cache Mode Hooks - The partial methods of
ServerCompositionCacheMode: implemented by the class that embedsServerCompositionCacheModeProps. Every hook defaults to doing nothing. - Server
Composition Conic Gradient Brush Hooks - The partial methods of
ServerCompositionConicGradientBrush: implemented by the class that embedsServerCompositionConicGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Container Visual Hooks - The partial methods of
ServerCompositionContainerVisual: implemented by the class that embedsServerCompositionContainerVisualProps. Every hook defaults to doing nothing. - Server
Composition Experimental Acrylic Visual Hooks - The partial methods of
ServerCompositionExperimentalAcrylicVisual: implemented by the class that embedsServerCompositionExperimentalAcrylicVisualProps. Every hook defaults to doing nothing. - Server
Composition Gradient Stop Hooks - The partial methods of
ServerCompositionGradientStop: implemented by the class that embedsServerCompositionGradientStopProps. Every hook defaults to doing nothing. - Server
Composition Linear Gradient Brush Hooks - The partial methods of
ServerCompositionLinearGradientBrush: implemented by the class that embedsServerCompositionLinearGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Radial Gradient Brush Hooks - The partial methods of
ServerCompositionRadialGradientBrush: implemented by the class that embedsServerCompositionRadialGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Brush Hooks - The partial methods of
ServerCompositionSimpleBrush: implemented by the class that embedsServerCompositionSimpleBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Conic Gradient Brush Hooks - The partial methods of
ServerCompositionSimpleConicGradientBrush: implemented by the class that embedsServerCompositionSimpleConicGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Geometry Hooks - The partial methods of
ServerCompositionSimpleGeometry: implemented by the class that embedsServerCompositionSimpleGeometryProps. Every hook defaults to doing nothing. - Server
Composition Simple Linear Gradient Brush Hooks - The partial methods of
ServerCompositionSimpleLinearGradientBrush: implemented by the class that embedsServerCompositionSimpleLinearGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple PenHooks - The partial methods of
ServerCompositionSimplePen: implemented by the class that embedsServerCompositionSimplePenProps. Every hook defaults to doing nothing. - Server
Composition Simple Radial Gradient Brush Hooks - The partial methods of
ServerCompositionSimpleRadialGradientBrush: implemented by the class that embedsServerCompositionSimpleRadialGradientBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Solid Color Brush Hooks - The partial methods of
ServerCompositionSimpleSolidColorBrush: implemented by the class that embedsServerCompositionSimpleSolidColorBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Tile Brush Hooks - The partial methods of
ServerCompositionSimpleTileBrush: implemented by the class that embedsServerCompositionSimpleTileBrushProps. Every hook defaults to doing nothing. - Server
Composition Simple Transform Hooks - The partial methods of
ServerCompositionSimpleTransform: implemented by the class that embedsServerCompositionSimpleTransformProps. Every hook defaults to doing nothing. - Server
Composition Solid Color Brush Hooks - The partial methods of
ServerCompositionSolidColorBrush: implemented by the class that embedsServerCompositionSolidColorBrushProps. Every hook defaults to doing nothing. - Server
Composition Solid Color Visual Hooks - The partial methods of
ServerCompositionSolidColorVisual: implemented by the class that embedsServerCompositionSolidColorVisualProps. Every hook defaults to doing nothing. - Server
Composition Surface Visual Hooks - The partial methods of
ServerCompositionSurfaceVisual: implemented by the class that embedsServerCompositionSurfaceVisualProps. Every hook defaults to doing nothing. - Server
Composition Target Hooks - The partial methods of
ServerCompositionTarget: implemented by the class that embedsServerCompositionTargetProps. Every hook defaults to doing nothing. - Server
Composition Tile Brush Hooks - The partial methods of
ServerCompositionTileBrush: implemented by the class that embedsServerCompositionTileBrushProps. Every hook defaults to doing nothing. - Server
Composition Visual Collection Hooks - The partial methods of
ServerCompositionVisualCollection: implemented by the class that embedsServerCompositionVisualCollectionProps. Every hook defaults to doing nothing. - Server
Composition Visual Hooks - The partial methods of
ServerCompositionVisual: implemented by the class that embedsServerCompositionVisualProps. Every hook defaults to doing nothing.