#[derive(Debug, Clone, PartialEq, Eq)] pub struct Config { pub source_factor: Factor, pub destination_factor: Factor, pub equation: Equation, } impl Default for Config { fn default() -> Self { Self { source_factor: Factor::One, destination_factor: Factor::Zero, equation: Equation::default(), } } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[non_exhaustive] pub enum Factor { /// Factor will be the RGBA color `(0,0,0,0)` Zero, /// Factor will be the RGBA color `(1,1,1,1)` One, /// Factor will be the source color SrcColor, /// Factor will be the RGBA color `(1,1,1,1) - source color` OneMinusSrcColor, /// Factor will be the destination color DstColor, /// Factor will be the RGBA color `(1,1,1,1) - destination color` OneMinusDstColor, /// Factor will be the alpha component of the source color. SrcAlpha, /// Factor will be the RGBA color `(1,1,1,1) - source color alpha` OneMinusSrcAlpha, /// Factor will be the alpha component of the destination color. DstAlpha, /// Factor will be the RGBA color `(1,1,1,1) - destination color alpha` OneMinusDstAlpha, /// Factor will be the constant color ConstantColor, /// Factor will be the RGBA color `(1,1,1,1) - constant color` OneMinusConstantColor, /// Factor will be the alpha component of the constant color. ConstantAlpha, /// Factor will be the RGBA color `(1,1,1,1) - constant color alpha` OneMinusConstantAlpha, } #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] pub enum Equation { /// The destination color and source color is added to each other in the blend /// function #[default] Add, /// The destination color is subtracted from the source color in the blend function Subtract, /// The source color is subtracted from the destination color in the blend function ReverseSubtract, /// The blend function will take the component-wise minimum of the destination color /// and the source color Min, /// The blend function will take the component-wise maximum of the destination color /// and the source color Max, }