mixbox = "2.0.0" # add this line to your Cargo.toml
fn main() {
let rgb1 = [0, 33, 133]; // blue
let rgb2 = [252, 211, 0]; // yellow
let t = 0.5; // mixing ratio
let [r, g, b] = mixbox::lerp(&rgb1, &rgb2, t);
println!("{} {} {}", r, g, b);
}
let z1 = mixbox::rgb_to_latent(&rgb1);
let z2 = mixbox::rgb_to_latent(&rgb2);
let z3 = mixbox::rgb_to_latent(&rgb3);
let mut z_mix = [0.0; mixbox::LATENT_SIZE];
for i in 0..z_mix.len() { // mix together:
z_mix[i] = 0.3*z1[i] + // 30% of rgb1
0.6*z2[i] + // 60% of rgb2
0.1*z3[i]; // 10% of rgb3
}
let rgb_mix = mixbox::latent_to_rgb(&z_mix);
Copyright (c) 2022, Secret Weapons. All rights reserved.
Mixbox is provided under the CC BY-NC 4.0 license for non-commercial use only.
If you want to obtain commercial license, please contact: [email protected]