Move blend mode declaration and implementation (#308)
This commit is contained in:
parent
b40da575e7
commit
ce889e3472
|
|
@ -43,48 +43,6 @@ pub enum LayerDataTypes {
|
||||||
Shape(Shape),
|
Shape(Shape),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)]
|
|
||||||
pub enum BlendMode {
|
|
||||||
Normal,
|
|
||||||
Multiply,
|
|
||||||
Darken,
|
|
||||||
ColorBurn,
|
|
||||||
Screen,
|
|
||||||
Lighten,
|
|
||||||
ColorDodge,
|
|
||||||
Overlay,
|
|
||||||
SoftLight,
|
|
||||||
HardLight,
|
|
||||||
Difference,
|
|
||||||
Exclusion,
|
|
||||||
Hue,
|
|
||||||
Saturation,
|
|
||||||
Color,
|
|
||||||
Luminosity,
|
|
||||||
}
|
|
||||||
impl BlendMode {
|
|
||||||
fn to_svg_style_name(&self) -> &str {
|
|
||||||
match self {
|
|
||||||
BlendMode::Normal => "normal",
|
|
||||||
BlendMode::Multiply => "multiply",
|
|
||||||
BlendMode::Darken => "darken",
|
|
||||||
BlendMode::ColorBurn => "color-burn",
|
|
||||||
BlendMode::Screen => "screen",
|
|
||||||
BlendMode::Lighten => "lighten",
|
|
||||||
BlendMode::ColorDodge => "color-dodge",
|
|
||||||
BlendMode::Overlay => "overlay",
|
|
||||||
BlendMode::SoftLight => "soft-light",
|
|
||||||
BlendMode::HardLight => "hard-light",
|
|
||||||
BlendMode::Difference => "difference",
|
|
||||||
BlendMode::Exclusion => "exclusion",
|
|
||||||
BlendMode::Hue => "hue",
|
|
||||||
BlendMode::Saturation => "saturation",
|
|
||||||
BlendMode::Color => "color",
|
|
||||||
BlendMode::Luminosity => "luminosity",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
macro_rules! call_render {
|
macro_rules! call_render {
|
||||||
($self:ident.render($svg:ident, $transform:ident, $style:ident) { $($variant:ident),* }) => {
|
($self:ident.render($svg:ident, $transform:ident, $style:ident) { $($variant:ident),* }) => {
|
||||||
match $self {
|
match $self {
|
||||||
|
|
@ -155,6 +113,49 @@ impl LayerDataTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
|
pub enum BlendMode {
|
||||||
|
Normal,
|
||||||
|
Multiply,
|
||||||
|
Darken,
|
||||||
|
ColorBurn,
|
||||||
|
Screen,
|
||||||
|
Lighten,
|
||||||
|
ColorDodge,
|
||||||
|
Overlay,
|
||||||
|
SoftLight,
|
||||||
|
HardLight,
|
||||||
|
Difference,
|
||||||
|
Exclusion,
|
||||||
|
Hue,
|
||||||
|
Saturation,
|
||||||
|
Color,
|
||||||
|
Luminosity,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl BlendMode {
|
||||||
|
fn to_svg_style_name(&self) -> &str {
|
||||||
|
match self {
|
||||||
|
BlendMode::Normal => "normal",
|
||||||
|
BlendMode::Multiply => "multiply",
|
||||||
|
BlendMode::Darken => "darken",
|
||||||
|
BlendMode::ColorBurn => "color-burn",
|
||||||
|
BlendMode::Screen => "screen",
|
||||||
|
BlendMode::Lighten => "lighten",
|
||||||
|
BlendMode::ColorDodge => "color-dodge",
|
||||||
|
BlendMode::Overlay => "overlay",
|
||||||
|
BlendMode::SoftLight => "soft-light",
|
||||||
|
BlendMode::HardLight => "hard-light",
|
||||||
|
BlendMode::Difference => "difference",
|
||||||
|
BlendMode::Exclusion => "exclusion",
|
||||||
|
BlendMode::Hue => "hue",
|
||||||
|
BlendMode::Saturation => "saturation",
|
||||||
|
BlendMode::Color => "color",
|
||||||
|
BlendMode::Luminosity => "luminosity",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
#[serde(remote = "glam::DAffine2")]
|
#[serde(remote = "glam::DAffine2")]
|
||||||
struct DAffine2Ref {
|
struct DAffine2Ref {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue