pub struct VelloPixmapRenderer { /* private fields */ }Expand description
vello_cpu rasterization renderer.
Implementations§
Source§impl VelloPixmapRenderer
impl VelloPixmapRenderer
Sourcepub fn new(width: u32, height: u32) -> Self
pub fn new(width: u32, height: u32) -> Self
Create a renderer with the given output canvas size (in device pixels).
Sizes above u16::MAX are clamped (vello_cpu’s canvas limit).
Examples found in repository?
10fn main() {
11 let mut scene = Scene::new(400.0, 300.0).with_background(Color::WHITE);
12
13 let style = TextStyle::new(Color::BLACK, 20.0, "sans-serif")
14 .with_align(TextAlign::Left)
15 .with_baseline(TextBaseline::Top)
16 .with_rotation(45_f64.to_radians());
17
18 scene.push(Element::text(
19 "2026-10-01",
20 Point::new(50.0, 80.0),
21 style.clone(),
22 ));
23 scene.push(Element::text(
24 "不旋转的对照",
25 Point::new(50.0, 220.0),
26 style.with_rotation(0.0),
27 ));
28
29 // SVG
30 let mut r = SvgRenderer::new(400.0, 300.0);
31 r.render_scene(&scene);
32 std::fs::write("rot_text.svg", r.into_string()).unwrap();
33 println!("wrote rot_text.svg");
34
35 // PNG
36 let mut r = VelloPixmapRenderer::new(400, 300);
37 let pixmap = r.render_scene_to_pixmap(&scene);
38 std::fs::write("rot_text.png", pixmap.to_png()).unwrap();
39 println!("wrote rot_text.png");
40}More examples
276fn main() {
277 let scene = build_scene();
278
279 // SVG 输出(render_scene 会自动捕获 scene 的 title/description/scale 与各图层)
280 // 两个后端同一契约:构造尺寸 = 输出尺寸,故这里显式乘 scale 得到 2× 画布。
281 let mut svg = SvgRenderer::new(scene.width * scene.scale, scene.height * scene.scale)
282 .with_background(scene.background);
283 scene.render(&mut svg);
284 let svg_str = svg.into_string();
285 std::fs::write("demo.svg", &svg_str).expect("写 SVG 失败");
286 println!("SVG 已写入 demo.svg ({} 字节)", svg_str.len());
287 println!(" 图层数: {}", scene.layers().len());
288 for l in scene.layers() {
289 println!(
290 " - {} ({} 节点, visible={})",
291 l.name,
292 l.nodes.len(),
293 l.visible
294 );
295 }
296 // 演示 measure_text / TextMetrics(canvas 风格)
297 let demo_style = lievisual::TextStyle::new(Color::BLACK, 20.0, "sans-serif");
298 let tm = lievisual::measure_text(
299 std::slice::from_ref(&lievisual::RichSpan::new(
300 "Measure 示例",
301 demo_style.clone(),
302 )),
303 None,
304 );
305 println!(
306 " 测量 \"Measure 示例\": width={:.2} height={:.2} alphabetic_baseline={:.2} ascent={:.2} descent={:.2}",
307 tm.metrics.width,
308 tm.metrics.height,
309 tm.metrics.alphabetic_baseline,
310 tm.metrics.font_bounding_box_ascent,
311 tm.metrics.font_bounding_box_descent
312 );
313
314 // PNG 输出
315 {
316 use lievisual::render::VelloPixmapRenderer;
317 // 与 SVG 端同一契约:构造尺寸 = 输出尺寸,乘 scale 提升栅格分辨率。
318 let mut renderer = VelloPixmapRenderer::new(
319 (scene.width * scene.scale) as u32,
320 (scene.height * scene.scale) as u32,
321 )
322 .with_background(scene.background);
323 let png = renderer.render_png(&scene);
324 std::fs::write("demo.png", &png).expect("写 PNG 失败");
325 println!("PNG 已写入 demo.png ({} 字节)", png.len());
326 }
327}144fn main() {
145 // 1) 基线:不调用任何 roughen_* —— 与改造前逐字节一致。
146 let baseline = build_scene();
147 write("sketch_normal.svg", &render_svg(&baseline));
148
149 // 2) 全量手绘 + 排线填充,并重新贴合画布(抖动可能顶到边缘)。
150 let mut all = build_scene();
151 roughen_scene_fit(
152 &mut all,
153 &SketchOptions::new()
154 .with_seed(42)
155 .with_fill(SketchFillStyle::Hachure),
156 8.0,
157 );
158 write("sketch_all.svg", &render_svg(&all));
159 let mut png = VelloPixmapRenderer::new(all.width.round() as u32, all.height.round() as u32)
160 .with_background(Color::WHITE);
161 let bytes = png.render_png(&all);
162 std::fs::write("sketch_all.png", &bytes).expect("写 PNG 失败");
163 println!(
164 " {:<22} {:>7} 字节 (画布 {}×{})",
165 "sketch_all.png",
166 bytes.len(),
167 all.width.round(),
168 all.height.round()
169 );
170
171 // 3) 选择性:图元手绘,网格线与连线保持笔直(kinds 排除 Line / Polyline)。
172 let mut selected = build_scene();
173 roughen_scene(
174 &mut selected,
175 &SketchOptions::new().with_seed(7).with_kinds(
176 SketchKinds::ALL
177 .without(SketchKind::Line)
178 .without(SketchKind::Polyline),
179 ),
180 );
181 write("sketch_selected.svg", &render_svg(&selected));
182
183 // 4) 四种填充样式:同一个场景里按 name 选择,分四次各自开启一种样式。
184 let mut fills = Scene::new(520.0, 140.0);
185 for (i, name) in ["hachure", "cross", "zigzag", "dots"]
186 .into_iter()
187 .enumerate()
188 {
189 let x = 20.0 + i as f64 * 125.0;
190 fills.push(
191 SceneNode::new(Element::rect(
192 Rect::new(x, 20.0, x + 100.0, 110.0),
193 node_style(Color::rgb(0xD6, 0xE4, 0xF7)),
194 ))
195 .with_name(name),
196 );
197 }
198 for (name, style) in [
199 ("hachure", SketchFillStyle::Hachure),
200 ("cross", SketchFillStyle::CrossHatch),
201 ("zigzag", SketchFillStyle::Zigzag),
202 ("dots", SketchFillStyle::Dots),
203 ] {
204 let want = name.to_string();
205 roughen_scene_if(
206 &mut fills,
207 &SketchOptions::new().with_seed(3).with_fill(style),
208 &move |node| node.name.as_deref() == Some(want.as_str()),
209 );
210 }
211 write("sketch_fills.svg", &render_svg(&fills));
212
213 println!("\n说明:手绘默认关闭;开启后可用 kinds / 谓词选择范围,文本与图片永不参与。");
214}Sourcepub fn with_background(self, color: Color) -> Self
pub fn with_background(self, color: Color) -> Self
Explicit background color; when unset, Scene::background is used.
A fully transparent color (Color::TRANSPARENT) keeps the canvas transparent
(no background is painted).
Examples found in repository?
276fn main() {
277 let scene = build_scene();
278
279 // SVG 输出(render_scene 会自动捕获 scene 的 title/description/scale 与各图层)
280 // 两个后端同一契约:构造尺寸 = 输出尺寸,故这里显式乘 scale 得到 2× 画布。
281 let mut svg = SvgRenderer::new(scene.width * scene.scale, scene.height * scene.scale)
282 .with_background(scene.background);
283 scene.render(&mut svg);
284 let svg_str = svg.into_string();
285 std::fs::write("demo.svg", &svg_str).expect("写 SVG 失败");
286 println!("SVG 已写入 demo.svg ({} 字节)", svg_str.len());
287 println!(" 图层数: {}", scene.layers().len());
288 for l in scene.layers() {
289 println!(
290 " - {} ({} 节点, visible={})",
291 l.name,
292 l.nodes.len(),
293 l.visible
294 );
295 }
296 // 演示 measure_text / TextMetrics(canvas 风格)
297 let demo_style = lievisual::TextStyle::new(Color::BLACK, 20.0, "sans-serif");
298 let tm = lievisual::measure_text(
299 std::slice::from_ref(&lievisual::RichSpan::new(
300 "Measure 示例",
301 demo_style.clone(),
302 )),
303 None,
304 );
305 println!(
306 " 测量 \"Measure 示例\": width={:.2} height={:.2} alphabetic_baseline={:.2} ascent={:.2} descent={:.2}",
307 tm.metrics.width,
308 tm.metrics.height,
309 tm.metrics.alphabetic_baseline,
310 tm.metrics.font_bounding_box_ascent,
311 tm.metrics.font_bounding_box_descent
312 );
313
314 // PNG 输出
315 {
316 use lievisual::render::VelloPixmapRenderer;
317 // 与 SVG 端同一契约:构造尺寸 = 输出尺寸,乘 scale 提升栅格分辨率。
318 let mut renderer = VelloPixmapRenderer::new(
319 (scene.width * scene.scale) as u32,
320 (scene.height * scene.scale) as u32,
321 )
322 .with_background(scene.background);
323 let png = renderer.render_png(&scene);
324 std::fs::write("demo.png", &png).expect("写 PNG 失败");
325 println!("PNG 已写入 demo.png ({} 字节)", png.len());
326 }
327}More examples
144fn main() {
145 // 1) 基线:不调用任何 roughen_* —— 与改造前逐字节一致。
146 let baseline = build_scene();
147 write("sketch_normal.svg", &render_svg(&baseline));
148
149 // 2) 全量手绘 + 排线填充,并重新贴合画布(抖动可能顶到边缘)。
150 let mut all = build_scene();
151 roughen_scene_fit(
152 &mut all,
153 &SketchOptions::new()
154 .with_seed(42)
155 .with_fill(SketchFillStyle::Hachure),
156 8.0,
157 );
158 write("sketch_all.svg", &render_svg(&all));
159 let mut png = VelloPixmapRenderer::new(all.width.round() as u32, all.height.round() as u32)
160 .with_background(Color::WHITE);
161 let bytes = png.render_png(&all);
162 std::fs::write("sketch_all.png", &bytes).expect("写 PNG 失败");
163 println!(
164 " {:<22} {:>7} 字节 (画布 {}×{})",
165 "sketch_all.png",
166 bytes.len(),
167 all.width.round(),
168 all.height.round()
169 );
170
171 // 3) 选择性:图元手绘,网格线与连线保持笔直(kinds 排除 Line / Polyline)。
172 let mut selected = build_scene();
173 roughen_scene(
174 &mut selected,
175 &SketchOptions::new().with_seed(7).with_kinds(
176 SketchKinds::ALL
177 .without(SketchKind::Line)
178 .without(SketchKind::Polyline),
179 ),
180 );
181 write("sketch_selected.svg", &render_svg(&selected));
182
183 // 4) 四种填充样式:同一个场景里按 name 选择,分四次各自开启一种样式。
184 let mut fills = Scene::new(520.0, 140.0);
185 for (i, name) in ["hachure", "cross", "zigzag", "dots"]
186 .into_iter()
187 .enumerate()
188 {
189 let x = 20.0 + i as f64 * 125.0;
190 fills.push(
191 SceneNode::new(Element::rect(
192 Rect::new(x, 20.0, x + 100.0, 110.0),
193 node_style(Color::rgb(0xD6, 0xE4, 0xF7)),
194 ))
195 .with_name(name),
196 );
197 }
198 for (name, style) in [
199 ("hachure", SketchFillStyle::Hachure),
200 ("cross", SketchFillStyle::CrossHatch),
201 ("zigzag", SketchFillStyle::Zigzag),
202 ("dots", SketchFillStyle::Dots),
203 ] {
204 let want = name.to_string();
205 roughen_scene_if(
206 &mut fills,
207 &SketchOptions::new().with_seed(3).with_fill(style),
208 &move |node| node.name.as_deref() == Some(want.as_str()),
209 );
210 }
211 write("sketch_fills.svg", &render_svg(&fills));
212
213 println!("\n说明:手绘默认关闭;开启后可用 kinds / 谓词选择范围,文本与图片永不参与。");
214}Sourcepub fn render_scene_to_pixmap(&mut self, scene: &Scene) -> Pixmap
pub fn render_scene_to_pixmap(&mut self, scene: &Scene) -> Pixmap
Render the scene and return a crate::Pixmap (non-premultiplied RGBA8).
Reuses the same RenderContext / Resources (glyph, atlas caches persist across frames);
reset() clears the previous frame’s scene before each render, so the same renderer can
render multiple frames repeatedly.
The output canvas is exactly the size given at construction (“renderer size = output
size”, same as the SVG backend). The scene is
mapped onto the
logical viewport 输出尺寸 / scene.scale like SVG’s default
preserveAspectRatio="xMidYMid meet" (uniform scale plus centering), then that viewport is
scaled up by scene.scale — i.e. scale is a pure density knob, never a silent
enlargement of the canvas.
Examples found in repository?
10fn main() {
11 let mut scene = Scene::new(400.0, 300.0).with_background(Color::WHITE);
12
13 let style = TextStyle::new(Color::BLACK, 20.0, "sans-serif")
14 .with_align(TextAlign::Left)
15 .with_baseline(TextBaseline::Top)
16 .with_rotation(45_f64.to_radians());
17
18 scene.push(Element::text(
19 "2026-10-01",
20 Point::new(50.0, 80.0),
21 style.clone(),
22 ));
23 scene.push(Element::text(
24 "不旋转的对照",
25 Point::new(50.0, 220.0),
26 style.with_rotation(0.0),
27 ));
28
29 // SVG
30 let mut r = SvgRenderer::new(400.0, 300.0);
31 r.render_scene(&scene);
32 std::fs::write("rot_text.svg", r.into_string()).unwrap();
33 println!("wrote rot_text.svg");
34
35 // PNG
36 let mut r = VelloPixmapRenderer::new(400, 300);
37 let pixmap = r.render_scene_to_pixmap(&scene);
38 std::fs::write("rot_text.png", pixmap.to_png()).unwrap();
39 println!("wrote rot_text.png");
40}Sourcepub fn render_scene_region(
&mut self,
scene: &Scene,
viewport: (f64, f64),
origin: (f64, f64),
width: u16,
height: u16,
) -> Pixmap
pub fn render_scene_region( &mut self, scene: &Scene, viewport: (f64, f64), origin: (f64, f64), width: u16, height: u16, ) -> Pixmap
Render only a rectangular region of the scene and return that region’s bitmap.
This is the incremental-rendering entry point: only pixels inside region are
rasterized, so a caller that owns a persistent full-frame buffer can refresh a small
damaged area instead of redrawing the whole window.
viewport— the full canvas size in device pixels. It is used only to compute thepreserveAspectRatio="xMidYMid meet"fit, exactly likeSelf::render_scene_to_pixmap. Passing the region size here would rescale the scene instead of cropping it.origin— top-left corner of the region inside that full canvas, in device pixels. Should be integer-aligned: a fractional origin shifts the scene by a subpixel amount and shows up as anti-aliasing seams along the region border.width/height— region size in device pixels (clamped to vello_cpu’su16range).
The returned crate::Pixmap is width × height, non-premultiplied RGBA8 — the same
format as Self::render_scene_to_pixmap — so callers can blit it at origin with a
straight copy. The scene background is filled across the whole region, which makes an
overwrite blit correct for opaque backgrounds.
Sourcepub fn render_png(&mut self, scene: &Scene) -> Vec<u8> ⓘ
pub fn render_png(&mut self, scene: &Scene) -> Vec<u8> ⓘ
Render the scene and export PNG bytes (depends on the permanent png encoder).
The PNG size equals the renderer’s canvas size (see
VelloPixmapRenderer::render_scene_to_pixmap); scene.scale is not applied.
Examples found in repository?
276fn main() {
277 let scene = build_scene();
278
279 // SVG 输出(render_scene 会自动捕获 scene 的 title/description/scale 与各图层)
280 // 两个后端同一契约:构造尺寸 = 输出尺寸,故这里显式乘 scale 得到 2× 画布。
281 let mut svg = SvgRenderer::new(scene.width * scene.scale, scene.height * scene.scale)
282 .with_background(scene.background);
283 scene.render(&mut svg);
284 let svg_str = svg.into_string();
285 std::fs::write("demo.svg", &svg_str).expect("写 SVG 失败");
286 println!("SVG 已写入 demo.svg ({} 字节)", svg_str.len());
287 println!(" 图层数: {}", scene.layers().len());
288 for l in scene.layers() {
289 println!(
290 " - {} ({} 节点, visible={})",
291 l.name,
292 l.nodes.len(),
293 l.visible
294 );
295 }
296 // 演示 measure_text / TextMetrics(canvas 风格)
297 let demo_style = lievisual::TextStyle::new(Color::BLACK, 20.0, "sans-serif");
298 let tm = lievisual::measure_text(
299 std::slice::from_ref(&lievisual::RichSpan::new(
300 "Measure 示例",
301 demo_style.clone(),
302 )),
303 None,
304 );
305 println!(
306 " 测量 \"Measure 示例\": width={:.2} height={:.2} alphabetic_baseline={:.2} ascent={:.2} descent={:.2}",
307 tm.metrics.width,
308 tm.metrics.height,
309 tm.metrics.alphabetic_baseline,
310 tm.metrics.font_bounding_box_ascent,
311 tm.metrics.font_bounding_box_descent
312 );
313
314 // PNG 输出
315 {
316 use lievisual::render::VelloPixmapRenderer;
317 // 与 SVG 端同一契约:构造尺寸 = 输出尺寸,乘 scale 提升栅格分辨率。
318 let mut renderer = VelloPixmapRenderer::new(
319 (scene.width * scene.scale) as u32,
320 (scene.height * scene.scale) as u32,
321 )
322 .with_background(scene.background);
323 let png = renderer.render_png(&scene);
324 std::fs::write("demo.png", &png).expect("写 PNG 失败");
325 println!("PNG 已写入 demo.png ({} 字节)", png.len());
326 }
327}More examples
144fn main() {
145 // 1) 基线:不调用任何 roughen_* —— 与改造前逐字节一致。
146 let baseline = build_scene();
147 write("sketch_normal.svg", &render_svg(&baseline));
148
149 // 2) 全量手绘 + 排线填充,并重新贴合画布(抖动可能顶到边缘)。
150 let mut all = build_scene();
151 roughen_scene_fit(
152 &mut all,
153 &SketchOptions::new()
154 .with_seed(42)
155 .with_fill(SketchFillStyle::Hachure),
156 8.0,
157 );
158 write("sketch_all.svg", &render_svg(&all));
159 let mut png = VelloPixmapRenderer::new(all.width.round() as u32, all.height.round() as u32)
160 .with_background(Color::WHITE);
161 let bytes = png.render_png(&all);
162 std::fs::write("sketch_all.png", &bytes).expect("写 PNG 失败");
163 println!(
164 " {:<22} {:>7} 字节 (画布 {}×{})",
165 "sketch_all.png",
166 bytes.len(),
167 all.width.round(),
168 all.height.round()
169 );
170
171 // 3) 选择性:图元手绘,网格线与连线保持笔直(kinds 排除 Line / Polyline)。
172 let mut selected = build_scene();
173 roughen_scene(
174 &mut selected,
175 &SketchOptions::new().with_seed(7).with_kinds(
176 SketchKinds::ALL
177 .without(SketchKind::Line)
178 .without(SketchKind::Polyline),
179 ),
180 );
181 write("sketch_selected.svg", &render_svg(&selected));
182
183 // 4) 四种填充样式:同一个场景里按 name 选择,分四次各自开启一种样式。
184 let mut fills = Scene::new(520.0, 140.0);
185 for (i, name) in ["hachure", "cross", "zigzag", "dots"]
186 .into_iter()
187 .enumerate()
188 {
189 let x = 20.0 + i as f64 * 125.0;
190 fills.push(
191 SceneNode::new(Element::rect(
192 Rect::new(x, 20.0, x + 100.0, 110.0),
193 node_style(Color::rgb(0xD6, 0xE4, 0xF7)),
194 ))
195 .with_name(name),
196 );
197 }
198 for (name, style) in [
199 ("hachure", SketchFillStyle::Hachure),
200 ("cross", SketchFillStyle::CrossHatch),
201 ("zigzag", SketchFillStyle::Zigzag),
202 ("dots", SketchFillStyle::Dots),
203 ] {
204 let want = name.to_string();
205 roughen_scene_if(
206 &mut fills,
207 &SketchOptions::new().with_seed(3).with_fill(style),
208 &move |node| node.name.as_deref() == Some(want.as_str()),
209 );
210 }
211 write("sketch_fills.svg", &render_svg(&fills));
212
213 println!("\n说明:手绘默认关闭;开启后可用 kinds / 谓词选择范围,文本与图片永不参与。");
214}Trait Implementations§
Source§impl Debug for VelloPixmapRenderer
impl Debug for VelloPixmapRenderer
Source§impl Renderer for VelloPixmapRenderer
impl Renderer for VelloPixmapRenderer
Source§fn draw_rect(&mut self, rect: Rect, style: &FillStrokeStyle)
fn draw_rect(&mut self, rect: Rect, style: &FillStrokeStyle)
Source§fn draw_circle(&mut self, center: Point, radius: f64, style: &FillStrokeStyle)
fn draw_circle(&mut self, center: Point, radius: f64, style: &FillStrokeStyle)
Source§fn draw_polyline(&mut self, points: &[Point], style: &Stroke)
fn draw_polyline(&mut self, points: &[Point], style: &Stroke)
Source§fn draw_path(&mut self, path: &BezPath, style: &FillStrokeStyle, closed: bool)
fn draw_path(&mut self, path: &BezPath, style: &FillStrokeStyle, closed: bool)
Source§fn draw_gradient_path(
&mut self,
path: &BezPath,
gradient: &LinearGradient,
stroke: Option<&Stroke>,
)
fn draw_gradient_path( &mut self, path: &BezPath, gradient: &LinearGradient, stroke: Option<&Stroke>, )
Source§fn draw_image(&mut self, image: &SceneImage, frame: Rect, opacity: f64)
fn draw_image(&mut self, image: &SceneImage, frame: Rect, opacity: f64)
image is a self-contained RGBA8 bitmap and frame is the display
rectangle (pt/px coordinates). Read moreSource§fn draw_text(
&mut self,
spans: &[RichSpan],
position: Point,
style: &TextStyle,
layout: Option<&TextLayout>,
)
fn draw_text( &mut self, spans: &[RichSpan], position: Point, style: &TextStyle, layout: Option<&TextLayout>, )
spans are the core content; when layout is provided it
takes precedence. Read moreSource§fn push_transform(&mut self, t: Transform)
fn push_transform(&mut self, t: Transform)
Source§fn pop_transform(&mut self)
fn pop_transform(&mut self)
Renderer::push_transform.Source§fn push_opacity(&mut self, opacity: f64)
fn push_opacity(&mut self, opacity: f64)
opacity < 1). Empty by default.Source§fn pop_opacity(&mut self)
fn pop_opacity(&mut self)
Renderer::push_opacity.Source§fn push_blend(&mut self, mode: BlendMode)
fn push_blend(&mut self, mode: BlendMode)
Renderer::pop_blend is composited
with the backdrop using mode. Empty by default (backends without blend support ignore
it, degrading to BlendMode::Normal).Source§fn pop_blend(&mut self)
fn pop_blend(&mut self)
Renderer::push_blend.Source§fn push_mask(&mut self, mask: &Mask)
fn push_mask(&mut self, mask: &Mask)
Renderer::pop_mask has its composited alpha
multiplied by mask. Empty by default (backends without mask support ignore it).Source§fn pop_mask(&mut self)
fn pop_mask(&mut self)
Renderer::push_mask.Source§fn push_filter(&mut self, filter: &Filter)
fn push_filter(&mut self, filter: &Filter)
Renderer::pop_filter is rendered into an
offscreen layer and filtered (blur / drop shadow). Empty by default.Source§fn pop_filter(&mut self)
fn pop_filter(&mut self)
Renderer::push_filter.Source§fn push_color_matrix(&mut self, matrix: ColorMatrix)
fn push_color_matrix(&mut self, matrix: ColorMatrix)
Renderer::pop_color_matrix is transformed by matrix. Read moreSource§fn pop_color_matrix(&mut self)
fn pop_color_matrix(&mut self)
Renderer::push_color_matrix.Source§fn push_antialias(&mut self, enabled: bool)
fn push_antialias(&mut self, enabled: bool)
Renderer::pop_antialias use
enabled anti-aliasing. Read moreSource§fn pop_antialias(&mut self)
fn pop_antialias(&mut self)
Renderer::push_antialias.Source§fn push_clip(&mut self, clip: &Clip)
fn push_clip(&mut self, clip: &Clip)
clip). Empty by default.Source§fn pop_clip(&mut self)
fn pop_clip(&mut self)
Renderer::push_clip.Source§fn draw_ellipse(
&mut self,
center: Point,
radii: Vec2,
rotation: f64,
style: &FillStrokeStyle,
)
fn draw_ellipse( &mut self, center: Point, radii: Vec2, rotation: f64, style: &FillStrokeStyle, )
radii are the two semi-axis lengths, rotation is the angle
around the center).Source§fn draw_rounded_rect(
&mut self,
rect: Rect,
radius: f64,
style: &FillStrokeStyle,
)
fn draw_rounded_rect( &mut self, rect: Rect, radius: f64, style: &FillStrokeStyle, )
Source§fn draw_rounded_rect_radii(
&mut self,
rect: Rect,
radii: CornerRadii,
style: &FillStrokeStyle,
)
fn draw_rounded_rect_radii( &mut self, rect: Rect, radii: CornerRadii, style: &FillStrokeStyle, )
Source§fn draw_polygon(&mut self, points: &[Point], style: &FillStrokeStyle)
fn draw_polygon(&mut self, points: &[Point], style: &FillStrokeStyle)
Source§fn draw_arc(
&mut self,
center: Point,
radii: Vec2,
start_angle: f64,
sweep_angle: f64,
style: &Stroke,
)
fn draw_arc( &mut self, center: Point, radii: Vec2, start_angle: f64, sweep_angle: f64, style: &Stroke, )
Source§fn draw_pie(
&mut self,
center: Point,
radius: f64,
start_angle: f64,
sweep_angle: f64,
style: &FillStrokeStyle,
)
fn draw_pie( &mut self, center: Point, radius: f64, start_angle: f64, sweep_angle: f64, style: &FillStrokeStyle, )
Source§fn push_name(&mut self, _name: Option<&str>)
fn push_name(&mut self, _name: Option<&str>)
name; emits id on the SVG side).
name is an Option: None means no id attribute is emitted.Source§fn pop_name(&mut self)
fn pop_name(&mut self)
Renderer::push_name.Source§fn push_scope(&mut self, scope: &NodeScope<'_>)
fn push_scope(&mut self, scope: &NodeScope<'_>)
Source§fn pop_scope(&mut self, scope: &NodeScope<'_>)
fn pop_scope(&mut self, scope: &NodeScope<'_>)
Renderer::push_scope (pops in reverse order).Source§fn push_node_scope(&mut self, node: &SceneNode)
fn push_node_scope(&mut self, node: &SceneNode)
Renderer::push_scope).Source§fn pop_node_scope(&mut self, node: &SceneNode)
fn pop_node_scope(&mut self, node: &SceneNode)
Renderer::push_node_scope.Source§fn render_scene(&mut self, scene: &Scene)
fn render_scene(&mut self, scene: &Scene)
Scene metadata (title / description /
scale), then call Renderer::render_scene_ordered to reuse the default traversal.Source§fn render_children(&mut self, nodes: &[SceneNode])
fn render_children(&mut self, nodes: &[SceneNode])
z_index order. Read moreSource§fn render_scene_ordered(&mut self, scene: &Scene)
fn render_scene_ordered(&mut self, scene: &Scene)
nodes layer first (bottommost, sorted
stably by ascending z_index), then each Layer in array order from bottom to
top.Source§fn render_layer(&mut self, layer: &Layer)
fn render_layer(&mut self, layer: &Layer)
z_index (including container recursion). Rarely needs to be
overridden. Read moreSource§fn render_node(&mut self, node: &SceneNode)
fn render_node(&mut self, node: &SceneNode)
Source§fn draw_element(&mut self, element: &Element)
fn draw_element(&mut self, element: &Element)
draw_* methods. Read more