Add BlurredRoundedRectangle - #173
Conversation
Copy-pasted from vello_common.
waywardmonkeys
left a comment
There was a problem hiding this comment.
This is an interesting one ...
In anyrender, it transports the transform along with it:
pub struct BoxShadowCommand {
pub transform: Affine,
pub rect: Rect,
pub brush: Color,
pub radius: f64,
pub std_dev: f64,
}In imaging, it does as well and includes a composite:
/// A solid-color rounded rectangle blurred with a gaussian filter.
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct BlurredRoundedRect {
/// Geometry transform.
pub transform: Affine,
/// Unblurred rectangle bounds.
pub rect: Rect,
/// Solid color used by the blurred rectangle.
pub color: peniko::Color,
/// Uniform corner radius in user-space units.
pub radius: f64,
/// Gaussian standard deviation in user-space units.
pub std_dev: f64,
/// Per-draw compositing.
pub composite: Composite,
}Obviously, we could use this to store the 4 fields as a single shared structure definition, but that wouldn't necessarily make the API better / different.
Not sure.
|
@waywardmonkeys I could see that being useful/convenient for serializing or for lowering into renderers without the specialization (likely a straight copy, rather than a manual swizzle). In that sense it would be ‘better’ in at least that way. |
|
I think vello_common's version makes the most sense for peniko.
|
5638dff to
c7fa856
Compare
|
I would like to request we merge this without further delay. Assuming the lack of a transform is the only objection, I honestly don't think it's an objection strong enough to stall this PR for three months. I think the real reason is that nobody has had the bandwidth to review this, but also... It's a twenty-line copy-paste from an existing Linebender project? I'm fine with a rubber-stamp review. |
Copy-pasted from vello_common.