-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Background
in Swiftui you can create custom shader effects and apply them to images like so:
Image(systemName: "figure.run.circle.fill")
.font(.system(size: 300))
.colorEffect(ShaderLibrary.checkerboard(.float(10), .color(.blue)))
Proposed changes
- Expose the draw context to the user
What it allows for the user
- GPU Computation for particle systems etc
- Rendering custom ui elements
- Custom renderer
OR / AND
Proposed changes
- Add a way for the user to create a custom wgsl effect. Example api:
let effect = vger::Effect::from_source("examples/gaussian_blur.wgsl");
vger.apply_effect(effect);
or
view.apply_effect(effect)
in use
// draws a blurred white circle.
fn main() {
canvas(|_, rect, vger| {
vger.translate(rect.center() - LocalPoint::zero());
let radius = 100.0;
let paint = vger.color_paint(vger::Color {
r: 1.0,
g: 1.0,
b: 1.0,
a: 1.0,
});
vger.fill_circle(LocalPoint::zero(), radius, paint);
let effect = vger::Effect::from_source("examples/gaussian_blur.wgsl");
vger.apply_effect(effect);
})
.run()
}
What it allows for the user
- Shader effects which could be applied in theory to any view like shadows, color grading, blurs
Metadata
Metadata
Assignees
Labels
No labels