mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-05 15:26:24 +01:00
svg-filters(primitives): start with feComponentTransfer
This commit is contained in:
parent
77bcb54b5e
commit
384fef5a81
|
@ -6,6 +6,7 @@ use self::{
|
|||
primitives::{
|
||||
blend::{Blend, BlendMode},
|
||||
color_matrix::{ColorMatrix, ColorMatrixType},
|
||||
component_transfer::{ComponentTransfer, TransferFn},
|
||||
composite::{Composite, CompositeOperator},
|
||||
gaussian_blur::GaussianBlur,
|
||||
offset::Offset,
|
||||
|
@ -145,9 +146,7 @@ impl Node {
|
|||
}
|
||||
|
||||
pub fn composite_arithmetic(k1: f32, k2: f32, k3: f32, k4: f32) -> Self {
|
||||
Self::simple(FePrimitive::Composite(Composite::arithmetic(
|
||||
k1, k2, k3, k4,
|
||||
)))
|
||||
Self::composite(CompositeOperator::Arithmetic { k1, k2, k3, k4 })
|
||||
}
|
||||
|
||||
pub fn gaussian_blur(v: u16) -> Self {
|
||||
|
@ -161,4 +160,18 @@ impl Node {
|
|||
pub fn offset(dx: f32, dy: f32) -> Self {
|
||||
Self::simple(FePrimitive::Offset(Offset::new(dx, dy)))
|
||||
}
|
||||
|
||||
pub fn component_transfer_rgba(
|
||||
r: TransferFn,
|
||||
g: TransferFn,
|
||||
b: TransferFn,
|
||||
a: TransferFn,
|
||||
) -> Self {
|
||||
Self::simple(FePrimitive::ComponentTransfer(ComponentTransfer {
|
||||
func_r: r,
|
||||
func_g: g,
|
||||
func_b: b,
|
||||
func_a: a,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/// [feComponentTransfer](https://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement)
|
||||
#[derive(Debug)]
|
||||
pub struct ComponentTransfer {
|
||||
func_r: TransferFunction,
|
||||
func_g: TransferFunction,
|
||||
func_b: TransferFunction,
|
||||
func_a: TransferFunction,
|
||||
pub func_r: TransferFn,
|
||||
pub func_g: TransferFn,
|
||||
pub func_b: TransferFn,
|
||||
pub func_a: TransferFn,
|
||||
}
|
||||
|
||||
/// [transfer functions](https://www.w3.org/TR/SVG11/filters.html#transferFuncElements)
|
||||
#[derive(Debug)]
|
||||
enum TransferFunction {
|
||||
pub enum TransferFn {
|
||||
Identity,
|
||||
Table {
|
||||
table_values: Vec<f32>,
|
||||
|
|
Loading…
Reference in a new issue