lang: work on various things

- work on new world
  - add file db
  - source_file parsing
  - locs
- fix some test stuff
This commit is contained in:
Schrottkatze 2024-07-06 21:57:42 +02:00
parent eb7806572b
commit 3eee768ce1
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
12 changed files with 395 additions and 14 deletions

View file

@ -1,8 +1,65 @@
use svg_filters::codegen::SvgDocument;
use svg_filters::{
codegen::SvgDocument,
types::nodes::{
primitives::{
blend::BlendMode,
color_matrix::ColorMatrixType,
component_transfer::TransferFn,
displacement_map::Channel,
turbulence::{NoiseType, StitchTiles},
},
standard_input::StandardInput,
},
};
fn main() {
let mut doc = SvgDocument::new();
eprintln!("{}", doc.generate_svg_pretty());
println!("{}", doc.generate_svg());
let f = doc.create_filter("cmyk-chromabb");
let noise = f.turbulence(0., 0.1, 2, 0, StitchTiles::Stitch, NoiseType::FractalNoise);
let noise = f.component_transfer_rgba(
noise,
TransferFn::Discrete {
table_values: vec![0., 0.2, 0.4, 0.6, 0.8, 1.],
},
TransferFn::Discrete {
table_values: vec![0., 0.2, 0.4, 0.6, 0.8, 1.],
},
TransferFn::Discrete {
table_values: vec![0., 0.2, 0.4, 0.6, 0.8, 1.],
},
TransferFn::Linear {
slope: 0.,
intercept: 0.5,
},
);
let cyan = f.color_matrix(
StandardInput::SourceGraphic,
ColorMatrixType::Matrix(Box::new([
0., 0., 0., 0., 0., //
0., 1., 0., 0., 0., //
0., 0., 1., 0., 0., //
0., 0., 0., 1., 0.,
])),
);
let cyan = f.offset(cyan, 25., 0.);
let cyan = f.displacement_map(cyan, noise, 50., Channel::R, Channel::A);
let magenta = f.color_matrix(
StandardInput::SourceGraphic,
ColorMatrixType::Matrix(Box::new([
1., 0., 0., 0., 0., //
0., 0., 0., 0., 0., //
0., 0., 1., 0., 0., //
0., 0., 0., 1., 0.,
])),
);
let magenta = f.displacement_map(magenta, noise, 50., Channel::R, Channel::A);
let magenta = f.offset(magenta, -25., 0.);
f.blend(cyan, magenta, BlendMode::Screen);
println!("{}", doc.generate_svg_pretty());
}