mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Layer opacity (#312)
Closes #187 * Add layer opacity input * Improve Rust code cleanliness
This commit is contained in:
@@ -175,6 +175,7 @@ pub struct Layer {
|
||||
pub thumbnail_cache: String,
|
||||
pub cache_dirty: bool,
|
||||
pub blend_mode: BlendMode,
|
||||
pub opacity: f64,
|
||||
}
|
||||
|
||||
impl Layer {
|
||||
@@ -189,6 +190,7 @@ impl Layer {
|
||||
thumbnail_cache: String::new(),
|
||||
cache_dirty: true,
|
||||
blend_mode: BlendMode::Normal,
|
||||
opacity: 1.,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +205,9 @@ impl Layer {
|
||||
self.cache.clear();
|
||||
let _ = write!(
|
||||
self.cache,
|
||||
r#"<g style="mix-blend-mode: {}">{}</g>"#,
|
||||
r#"<g style="mix-blend-mode: {}; opacity: {}">{}</g>"#,
|
||||
self.blend_mode.to_svg_style_name(),
|
||||
self.opacity,
|
||||
self.thumbnail_cache.as_str()
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user