pub struct SceneStore { /* private fields */ }Expand description
The scene a renderer draws and the hit targets come from.
Implementations§
Source§impl SceneStore
impl SceneStore
Sourcepub fn write_leaf(&mut self, id: RecordId, leaf: Leaf, items: &[Item])
pub fn write_leaf(&mut self, id: RecordId, leaf: Leaf, items: &[Item])
Writes id as leaf: a leaf of leaf.node without properties,
placed by a translation alone, whose draws changed in the update in
progress, to items. The draws and children id held before stay in
the store: the caller removes them.
Sourcepub fn place_leaf(
&mut self,
id: RecordId,
origin_in_parent: Point,
flags: RecordFlags,
)
pub fn place_leaf( &mut self, id: RecordId, origin_in_parent: Point, flags: RecordFlags, )
Places id, a leaf, at origin_in_parent by a translation alone,
with flags.
Sourcepub fn move_leaf(&mut self, id: RecordId, origin_in_parent: Point)
pub fn move_leaf(&mut self, id: RecordId, origin_in_parent: Point)
Moves id, a leaf, to origin_in_parent by a translation alone,
among the items of a parent whose content the update in progress
changes: the caller notes that change with
Self::note_content_change of the parent.
Source§impl SceneStore
impl SceneStore
Sourcepub fn describe_overlay<'a>(
&mut self,
window: Size,
layers: impl IntoIterator<Item = &'a OverlayLayer>,
)
pub fn describe_overlay<'a>( &mut self, window: Size, layers: impl IntoIterator<Item = &'a OverlayLayer>, )
Writes a root layer of window size that holds layers in order, in
place of what the store held, in a new update. Records at the same
place stay, so the update changes only what differs.
Source§impl SceneStore
impl SceneStore
Sourcepub fn content_offset(&self, id: RecordId) -> Point
pub fn content_offset(&self, id: RecordId) -> Point
The offset of the content box of id from its origin.
Sourcepub fn set_content_offset(&mut self, id: RecordId, offset: Point) -> bool
pub fn set_content_offset(&mut self, id: RecordId, offset: Point) -> bool
Sets the offset of the content box of id, and returns whether it
changed.
Sourcepub fn origin_in_parent(&self, id: RecordId) -> Point
pub fn origin_in_parent(&self, id: RecordId) -> Point
Where layout placed id in its parent’s content, before the
parent’s content offset.
Sourcepub fn origin(&self, id: RecordId) -> Point
pub fn origin(&self, id: RecordId) -> Point
The top left of id in its parent’s layer: its placement and the
parent’s content offset.
Sourcepub fn transform_to_parent(&self, id: RecordId) -> ProjectiveTransform
pub fn transform_to_parent(&self, id: RecordId) -> ProjectiveTransform
The transform from id to its parent’s content.
Sourcepub fn set_placement(
&mut self,
id: RecordId,
origin_in_parent: Point,
transform: Option<ProjectiveTransform>,
) -> bool
pub fn set_placement( &mut self, id: RecordId, origin_in_parent: Point, transform: Option<ProjectiveTransform>, ) -> bool
Places id at origin_in_parent in its parent’s content by
transform, or by a translation there alone, past the parent’s
content offset, for None. A transform that only moves the record
there takes no entry of its own. The parent’s content offset is set
before. Returns whether the placement changed.
Source§impl SceneStore
impl SceneStore
Sourcepub fn props(&self, id: RecordId) -> Option<&LayerProps>
pub fn props(&self, id: RecordId) -> Option<&LayerProps>
The properties of id, when it has any.
Sourcepub fn graphics_layer(&self, id: RecordId) -> Option<&GraphicsLayer>
pub fn graphics_layer(&self, id: RecordId) -> Option<&GraphicsLayer>
The graphics layer set on id, None when it reads as the default.
Sourcepub fn set_graphics_layer(
&mut self,
id: RecordId,
layer: Option<&GraphicsLayer>,
)
pub fn set_graphics_layer( &mut self, id: RecordId, layer: Option<&GraphicsLayer>, )
Sets the graphics layer of id; None reads as the default. A record
that keeps one keeps its slot. A changed layer notes a property
change.
Sourcepub fn set_hit_test(&mut self, id: RecordId, hit_test: Option<HitTestNode>)
pub fn set_hit_test(&mut self, id: RecordId, hit_test: Option<HitTestNode>)
Sets the pointer handling of id: None when it has none. What the
record draws stays.
Source§impl SceneStore
impl SceneStore
Sourcepub fn add_shapes(
&mut self,
print: u64,
record: impl FnOnce(&mut ShapeRecorder),
) -> Item
pub fn add_shapes( &mut self, print: u64, record: impl FnOnce(&mut ShapeRecorder), ) -> Item
Adds an item of the shapes record records into a chunk the store
shares among its shape items. print is a hash of what they draw,
the same for the same shapes.
Source§impl SceneStore
impl SceneStore
Sourcepub fn version(&self) -> SceneVersion
pub fn version(&self) -> SceneVersion
The store’s identity and latest update.
Sourcepub fn update(&self) -> SceneUpdate
pub fn update(&self) -> SceneUpdate
The latest scene update.
Sourcepub fn begin_update(&mut self) -> SceneUpdate
pub fn begin_update(&mut self) -> SceneUpdate
Starts a scene update and returns its number.
Sourcepub fn changed_within(&self, id: RecordId, updates: u32) -> bool
pub fn changed_within(&self, id: RecordId, updates: u32) -> bool
Whether id changed itself or moved in the latest updates updates.
Sourcepub fn follow(&mut self, events: RecordEvents)
pub fn follow(&mut self, events: RecordEvents)
Keeps the changes of the kinds in events for the store’s readers
from the next update on, in place of those it kept.
Sourcepub fn changes_since(&self, read: Option<SceneVersion>) -> JournalRead<'_>
pub fn changes_since(&self, read: Option<SceneVersion>) -> JournalRead<'_>
The changes of the store’s records in the updates after read, the
version of the store a reader read last. Lost for no version, a
version of another store or one older than the store keeps.
Sourcepub fn stamps_since(&self, read: Option<SceneVersion>) -> Option<&[RecordRef]>
pub fn stamps_since(&self, read: Option<SceneVersion>) -> Option<&[RecordRef]>
The records the updates after read made, changed or moved, while
the store follows RecordEvents::STAMPS; a record may come more
than once. None for no version, a version of another store or one
older than the store keeps, or when an update stamped more records
than the store keeps.
Sourcepub fn changed_since(&self, read: Option<SceneVersion>) -> bool
pub fn changed_since(&self, read: Option<SceneVersion>) -> bool
Whether an update after read, the version of the store a reader
read last, changed a record. True for no version, a version of
another store or one the store was cleared after.
Sourcepub fn finish_update(&mut self)
pub fn finish_update(&mut self)
Ends the update in progress: logs the records whose children it put in another order and the own draws it redrew. Readers read the store after it.
Sourcepub fn trim(&mut self) -> bool
pub fn trim(&mut self) -> bool
Gives back the room the store’s arrays hold past their records and draws: the room a burst took, such as a first build’s or a long list’s. The store’s owner calls it at rest, when no frame waits, as a frame would take the room again. Returns whether most rows stay free past records made after them, room that only a store cleared and built anew gives back.
Sourcepub fn refresh_reach(&mut self)
pub fn refresh_reach(&mut self)
Works out the reach of every record whose reach a change beneath it
left to be worked out again, as LayerRef::reach reads it.
Sourcepub fn root_layer(&self) -> Option<LayerRef<'_>>
pub fn root_layer(&self) -> Option<LayerRef<'_>>
The root record as its readers see it.
Sourcepub fn heap_bytes(&self) -> usize
pub fn heap_bytes(&self) -> usize
Estimated heap memory the store holds, in bytes, for memory reports.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
How many records and draws the store holds: each record counts once, each primitive of a draw run on its own.
Sourcepub fn record_count(&self) -> usize
pub fn record_count(&self) -> usize
How many records the store holds.
Sourcepub fn insert(&mut self, seed: RecordSeed) -> RecordId
pub fn insert(&mut self, seed: RecordSeed) -> RecordId
Makes a record from seed, changed in the update in progress, with no
items, at the origin of its parent and of zero size. Its ancestors
take the update as their subtree’s; the caller adds it to its
parent’s items.
Sourcepub fn remove_subtree(&mut self, id: RecordId)
pub fn remove_subtree(&mut self, id: RecordId)
Removes id, its draws, its properties and every record beneath it.
Sourcepub fn remove_item(&mut self, item: Item)
pub fn remove_item(&mut self, item: Item)
Removes what item holds: a child record’s subtree or a draw.
Sourcepub fn record_ref(&self, id: RecordId) -> RecordRef
pub fn record_ref(&self, id: RecordId) -> RecordRef
A handle to id that tells a later holder whether the row went to
another record since.
Sourcepub fn resolve(&self, held: RecordRef) -> Option<RecordId>
pub fn resolve(&self, held: RecordRef) -> Option<RecordId>
The record held names, while its row still holds that record.
Sourcepub fn add_draw(&mut self, draw: DrawPrimitiveNode) -> Item
pub fn add_draw(&mut self, draw: DrawPrimitiveNode) -> Item
Adds a draw primitive for an item.
Sourcepub fn add_text(&mut self, text: TextPrimitiveNode) -> Item
pub fn add_text(&mut self, text: TextPrimitiveNode) -> Item
Adds a text for an item.
Sourcepub fn add_run(&mut self, run: DrawRunNode) -> Item
pub fn add_run(&mut self, run: DrawRunNode) -> Item
Adds a draw run for an item.
Sourcepub fn draw(&self, item: Item) -> &DrawPrimitiveNode
pub fn draw(&self, item: Item) -> &DrawPrimitiveNode
The draw primitive of a draw item.
Sourcepub fn text(&self, item: Item) -> &TextPrimitiveNode
pub fn text(&self, item: Item) -> &TextPrimitiveNode
The text of a text item.
Sourcepub fn run(&self, item: Item) -> &DrawRunNode
pub fn run(&self, item: Item) -> &DrawRunNode
The draw run of a run item.
Sourcepub fn kind(&self, id: RecordId) -> RecordKind
pub fn kind(&self, id: RecordId) -> RecordKind
What id draws for.
Sourcepub fn flags(&self, id: RecordId) -> RecordFlags
pub fn flags(&self, id: RecordId) -> RecordFlags
The flags of id.
Sourcepub fn set_kind(
&mut self,
id: RecordId,
kind: RecordKind,
node: Option<NodeId>,
) -> bool
pub fn set_kind( &mut self, id: RecordId, kind: RecordKind, node: Option<NodeId>, ) -> bool
Sets what id draws for and the layout node it draws for, and
returns whether either changed. A RecordKind::Leaf holds no layer
properties and no child layers.
Sourcepub fn note_content_change(&mut self, id: RecordId)
pub fn note_content_change(&mut self, id: RecordId)
Notes that the update in progress changed what id draws: its own
draws, properties or children. Its ancestors take the update as their
subtree’s.
Sourcepub fn note_property_change(&mut self, id: RecordId)
pub fn note_property_change(&mut self, id: RecordId)
Notes that the update in progress changed the properties of id
without changing what it draws: its hashes go, while a raster cache
keyed on its content does not count the update as a content change.
Sourcepub fn content_rev(&self, id: RecordId) -> SceneUpdate
pub fn content_rev(&self, id: RecordId) -> SceneUpdate
The update that last changed what id itself draws.