ferroui_base/rendering/composition/drawing/
i_render_data_visitor.rs1use crate::media::{BoxShadows, IBrush, IPen, RenderOptions, TextOptions};
2use crate::media::imaging::BitmapBlendingMode;
3use crate::platform::{IGeometryImpl, IGlyphRunImpl};
4use crate::rendering::scene_graph::ICustomDrawOperation;
5use crate::{Matrix, Point, Rect, RoundedRect};
6use std::sync::Arc;
7
8pub trait IRenderDataVisitor {
11 type Scope;
12
13 fn stop_visiting(&self) -> bool;
15
16 fn on_draw_line(&mut self, server_pen: Option<&dyn IPen>, client_pen: Option<&dyn IPen>, p1: Point, p2: Point);
17 fn on_draw_rectangle(
18 &mut self,
19 server_brush: Option<&dyn IBrush>,
20 server_pen: Option<&dyn IPen>,
21 client_pen: Option<&dyn IPen>,
22 rect: RoundedRect,
23 box_shadows: &BoxShadows,
24 );
25 fn on_draw_ellipse(
26 &mut self,
27 server_brush: Option<&dyn IBrush>,
28 server_pen: Option<&dyn IPen>,
29 client_pen: Option<&dyn IPen>,
30 rect: Rect,
31 );
32 fn on_draw_geometry(
33 &mut self,
34 server_brush: Option<&dyn IBrush>,
35 server_pen: Option<&dyn IPen>,
36 client_pen: Option<&dyn IPen>,
37 geometry: Option<&Arc<dyn IGeometryImpl>>,
38 );
39 fn on_draw_glyph_run(&mut self, server_brush: Option<&dyn IBrush>, glyph_run: Option<&std::sync::Arc<dyn IGlyphRunImpl>>);
40 fn on_draw_bitmap(&mut self, bitmap: Option<&std::sync::Arc<crate::platform::SharedBitmapImpl>>, opacity: f64, source_rect: Rect, dest_rect: Rect);
41 fn on_draw_custom(&mut self, operation: Option<&std::sync::Arc<dyn ICustomDrawOperation>>);
42
43 fn on_push_clip(&mut self, clip: RoundedRect) -> Self::Scope;
44 fn on_push_geometry_clip(&mut self, geometry: Option<&Arc<dyn IGeometryImpl>>) -> Self::Scope;
45 fn on_push_opacity(&mut self, opacity: f64) -> Self::Scope;
46 fn on_push_opacity_mask(&mut self, brush: Option<&dyn IBrush>, bounds: Rect) -> Self::Scope;
47 fn on_push_transform(&mut self, matrix: Matrix) -> Self::Scope;
48 fn on_push_render_options(&mut self, options: RenderOptions) -> Self::Scope;
49 fn on_push_text_options(&mut self, options: TextOptions) -> Self::Scope;
50 fn on_push_effect(&mut self, effect: Option<&std::sync::Arc<dyn crate::media::IImmutableEffect>>, bounds: Rect) -> Self::Scope;
51
52 fn on_push_compositing_layer(&mut self, _blend: BitmapBlendingMode, opacity: f64, _bounds: Rect) -> Self::Scope {
56 self.on_push_opacity(opacity)
57 }
58
59 fn on_pop(&mut self, scope: Self::Scope);
60}