mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-12-22 10:05:52 +01:00
svg-filters: cleanup
This commit is contained in:
parent
384fef5a81
commit
f59062cf88
2 changed files with 1 additions and 45 deletions
|
@ -10,51 +10,8 @@ use svg_filters::{
|
|||
};
|
||||
|
||||
fn main() {
|
||||
// <filter id="chromabb" >
|
||||
// <feColorMatrix values="1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0" in="SourceGraphic" />
|
||||
// <feOffset dx="25" dy="0" />
|
||||
// <feGaussianBlur stdDeviation="5 0" result="red" />
|
||||
|
||||
// <feColorMatrix values="0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0" result="grn" in="SourceGraphic" />
|
||||
|
||||
// <feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0" in="SourceGraphic" />
|
||||
// <feOffset dx="-25" dy="0" />
|
||||
// <feGaussianBlur stdDeviation="5 0" result="blu"/>
|
||||
|
||||
// <feComposite in="red" in2="blu" operator="arithmetic" k2="1" k3="1" result="rb" />
|
||||
// <feComposite in="rb" in2="grn" operator="arithmetic" k2="1" k3="1" />
|
||||
// </filter>
|
||||
|
||||
let mut doc = SvgDocument::new();
|
||||
let chromabb = doc.create_filter("chromabb_gen");
|
||||
|
||||
let chan_r = chromabb.color_matrix(
|
||||
StandardInput::SourceGraphic,
|
||||
ColorMatrixType::Matrix(Box::new([
|
||||
1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,
|
||||
])),
|
||||
);
|
||||
let offset_r = chromabb.offset(chan_r, 25., 0.);
|
||||
let blur_r = chromabb.gaussian_blur_xy(offset_r, 5, 0);
|
||||
|
||||
let chan_b = chromabb.color_matrix(
|
||||
StandardInput::SourceGraphic,
|
||||
ColorMatrixType::Matrix(Box::new([
|
||||
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 1., 0.,
|
||||
])),
|
||||
);
|
||||
let offset_b = chromabb.offset(chan_b, -25., 0.);
|
||||
let blur_b = chromabb.gaussian_blur_xy(offset_b, 5, 0);
|
||||
|
||||
let composite_rb = chromabb.composite_arithmetic(blur_r, blur_b, 0., 1., 1., 0.);
|
||||
|
||||
let chan_g = chromabb.color_matrix(
|
||||
StandardInput::SourceGraphic,
|
||||
ColorMatrixType::Matrix(Box::new([
|
||||
0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,
|
||||
])),
|
||||
);
|
||||
chromabb.composite_arithmetic(composite_rb, chan_g, 0., 1., 1., 0.);
|
||||
|
||||
eprintln!("{}", doc.generate_svg_pretty());
|
||||
println!("{}", doc.generate_svg());
|
||||
}
|
||||
|
|
|
@ -61,7 +61,6 @@ pub trait WriteElement {
|
|||
/// svg filter effects primitives
|
||||
#[derive(Debug)]
|
||||
pub enum FePrimitive {
|
||||
// 2 inputs
|
||||
Blend(blend::Blend),
|
||||
ColorMatrix(color_matrix::ColorMatrix),
|
||||
ComponentTransfer(component_transfer::ComponentTransfer),
|
||||
|
|
Loading…
Reference in a new issue