pub enum Color {
Scheme(SchemeColor),
Preset(PresetColor),
RGB(RGBColor),
None,
}Expand description
一个颜色(a:solidFill 内的颜色)。
#[default] 选 Color::None 是为了与“未设置“语义对齐。
Variants§
Scheme(SchemeColor)
主题颜色(引用主题/母版中的 schemeClr)。
Preset(PresetColor)
预设颜色(prstClr)。
RGB(RGBColor)
sRGB 颜色。
None
暂未填充。
Implementations§
Source§impl Color
impl Color
Sourcepub fn write_xml(&self, w: &mut XmlWriter, tag: &str)
pub fn write_xml(&self, w: &mut XmlWriter, tag: &str)
写一段 XML(写到指定 tag,例如 a:srgbClr)。
Color::None 不写任何字节。
Sourcepub fn write_solid_fill(&self, w: &mut XmlWriter)
pub fn write_solid_fill(&self, w: &mut XmlWriter)
写为 <a:solidFill><a:??>...</a:??></a:solidFill>。
Color::None 写为 <a:noFill/>(语义上“无填充“)。
Sourcepub fn write_solid_fill_with_alpha(&self, w: &mut XmlWriter, alpha: Option<i32>)
pub fn write_solid_fill_with_alpha(&self, w: &mut XmlWriter, alpha: Option<i32>)
写为 <a:solidFill><a:??>...<a:alpha val="..."/></a:??></a:solidFill>。
与 Self::write_solid_fill 相同,但额外在颜色元素内写入 <a:alpha> 子元素。
§参数
alpha:透明度值(0-100000),None表示不写 alpha。- 0 = 完全不透明
- 100000 = 完全透明
- 30000 = 30% 不透明(70% 透明),常用于水印
Trait Implementations§
impl Eq for Color
Source§impl<'a> From<&'a mut Color> for ColorFormat<'a>
impl<'a> From<&'a mut Color> for ColorFormat<'a>
Source§fn from(c: &'a mut Color) -> ColorFormat<'a>
fn from(c: &'a mut Color) -> ColorFormat<'a>
Converts to this type from the input type.
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.