Struct glifparser::color::Color
source · pub struct Color {
pub r: IntegerOrFloat,
pub g: IntegerOrFloat,
pub b: IntegerOrFloat,
pub a: IntegerOrFloat,
}Fields§
§r: IntegerOrFloat§g: IntegerOrFloat§b: IntegerOrFloat§a: IntegerOrFloatImplementations§
source§impl Color
impl Color
sourcepub fn from_rgba(
r: IntegerOrFloat,
g: IntegerOrFloat,
b: IntegerOrFloat,
a: IntegerOrFloat
) -> Color
pub fn from_rgba(
r: IntegerOrFloat,
g: IntegerOrFloat,
b: IntegerOrFloat,
a: IntegerOrFloat
) -> Color
sourcepub fn as_plist_value(&self) -> Value
pub fn as_plist_value(&self) -> Value
Examples found in repository?
src/guideline.rs (line 49)
40 41 42 43 44 45 46 47 48 49 50 51 52
pub fn as_plist_dict(&self) -> plist::Dictionary {
let mut dict = plist::Dictionary::new();
dict.insert("x".to_string(), plist::Value::Real(self.at.x.into()));
dict.insert("y".to_string(), plist::Value::Real(self.at.y.into()));
dict.insert("angle".to_string(), plist::Value::Real(self.angle.into()));
if let Some(ref name) = self.name {
dict.insert("name".to_string(), plist::Value::String(name.to_string()));
}
if let Some(ref color) = self.color {
dict.insert("color".to_string(), color.as_plist_value());
}
dict
}Trait Implementations§
source§impl<'de> Deserialize<'de> for Color
impl<'de> Deserialize<'de> for Color
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<Color> for Color
impl PartialEq<Color> for Color
source§impl ToString for Color
impl ToString for Color
This follows the UFO spec, not other specs that would say to do e.g. rgba(1,1,1,1)