Closed
Description
Scene::fill()
accepts peniko::BrushRef::Image
as a brush, and I expect it fills the shape with repetition of the specified image if Extend::Repeated
is specified. However, the following code doesn't fill. Is this the expected result? Is something wrong in my code?
#[rustfmt::skip]
let colors = [
Color::RED, Color::BLUE, Color::BLUE,
Color::BLUE, Color::RED, Color::BLUE,
Color::BLUE, Color::BLUE, Color::RED,
];
let mut blob: Vec<u8> = Vec::new();
colors.iter().for_each(|c| {
blob.push(c.r);
blob.push(c.g);
blob.push(c.b);
blob.push(c.a);
});
let data = vello::peniko::Blob::new(Arc::new(blob));
let image = vello::peniko::Image::new(data, vello::peniko::Format::Rgba8, 3, 3)
.with_extend(vello::peniko::Extend::Repeat);
let brush = vello::peniko::BrushRef::Image(&image);
// Draw a filled circle
let circle = Circle::new((400.0, 400.0), 200.0);
scene.fill(
vello::peniko::Fill::NonZero,
Affine::IDENTITY,
brush,
None,
&circle,
);
scene.stroke(
&vello::kurbo::Stroke::new(10.0),
Affine::IDENTITY,
Color::WHITE,
None,
&circle,
);
Metadata
Metadata
Assignees
Labels
No labels