#include <stdio.h>
#include "mixbox.h"
int main() {
unsigned char r1 = 0, g1 = 33, b1 = 133; // blue
unsigned char r2 = 252, g2 = 211, b2 = 0; // yellow
float t = 0.5;
unsigned char r, g, b;
mixbox_lerp(r1, g1, b1, // first color
r2, g2, b2, // second color
t, // mixing ratio
&r, &g, &b); // result
printf("%d %d %d\n", r, g, b);
}
mixbox_latent z1, z2, z3, z_mix;
mixbox_rgb_to_latent(r1, g1, b1, z1);
mixbox_rgb_to_latent(r2, g2, b2, z2);
mixbox_rgb_to_latent(r3, g3, b3, z3);
for (int i = 0; i < MIXBOX_LATENT_SIZE; i++) {
// mix 30% of rgb1, 60% of rgb2, and 10% of rgb3
z_mix[i] = 0.3f*z1[i] + 0.6f*z2[i] + 0.1f*z3[i];
}
mixbox_latent_to_rgb(z_mix, &r, &g, &b);
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]