1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[cfg(feature = "serde")]
use serde::Serialize;
use crate::raw::drawing::{effect::blur::XlsxBlur, st_types::emu_to_pt};
/// blur (Blur Effect)
///
/// a blur effect that is applied to the entire shape, including its fill.
/// All color channels, including alpha, are affected.
///
/// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.drawing.blur?view=openxml-3.0.1
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize))]
pub struct Blur {
/// Specifies whether the bounds of the object should be grown as a result of the blurring.
///
/// True indicates the bounds are grown while false indicates that they are not.
pub grow: bool,
/// Specifies the radius of blur: positive number in points
pub rad: f64,
}
impl Blur {
pub(crate) fn from_raw(raw: Option<XlsxBlur>) -> Option<Self> {
let Some(raw) = raw else {
return None;
};
let Some(rad) = raw.rad.clone() else {
return None;
};
return Some(Self {
grow: raw.grow.unwrap_or(false),
rad: emu_to_pt(rad as i64),
});
}
}