Skip to main content

vello_common/
blurred_rounded_rect.rs

1// Copyright 2025 the Vello Authors
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Blurred, rounded rectangles.
5use crate::color::{AlphaColor, Srgb};
6use crate::kurbo::Rect;
7
8/// A blurred, rounded rectangle.
9#[derive(Debug)]
10pub struct BlurredRoundedRectangle {
11    /// The base rectangle to use for the blur effect.
12    pub rect: Rect,
13    /// The color of the blurred rectangle.
14    pub color: AlphaColor<Srgb>,
15    /// The radius of the rounded rectangle's corners.
16    pub radius: f32,
17    /// The standard deviation of the blur effect.
18    pub std_dev: f32,
19    /// Whether to paint the inverse (`1 - alpha`) of the blur coverage.
20    ///
21    /// When `true`, the paint is fully opaque outside the blurred rectangle and fades to
22    /// transparent inside it. This is useful for implementing inset box shadows.
23    pub invert: bool,
24}