update mixbox

This commit is contained in:
Ondrej Jamriska
2022-09-21 05:00:42 +02:00
parent d76d5decb5
commit e63e30fc97
3 changed files with 794 additions and 87059 deletions

87257
mixbox.cpp

File diff suppressed because it is too large Load Diff

View File

@@ -1,35 +1,89 @@
// MIXBOX v1.2 (c) 2022 Secret Weapons // ==========================================================
// This is for non-commercial use only. // MIXBOX 2.0 (c) 2022 Secret Weapons. All rights reserved.
// Contact: mixbox@scrtwpns.com // License: Creative Commons Attribution-NonCommercial 4.0
// Authors: Sarka Sochorova and Ondrej Jamriska
// ==========================================================
//
// BASIC USAGE
//
// mixbox_lerp(r1, g1, b1, // 1st color
// r2, g2, b2, // 2nd color
// t, // mixing ratio
// &r, &g, &b); // result
//
// MULTI-COLOR MIXING
//
// 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);
//
// PIGMENT COLORS
//
// Cadmium Yellow 254, 236, 0
// Hansa Yellow 252, 211, 0
// Cadmium Orange 255, 105, 0
// Cadmium Red 255, 39, 2
// Quinacridone Magenta 128, 2, 46
// Cobalt Violet 78, 0, 66
// Ultramarine Blue 25, 0, 89
// Cobalt Blue 0, 33, 133
// Phthalo Blue 13, 27, 68
// Phthalo Green 0, 60, 50
// Permanent Green 7, 109, 22
// Sap Green 107, 148, 4
// Burnt Sienna 123, 72, 0
//
// LICENSING
//
// If you want to obtain commercial license, please
// contact us at: mixbox@scrtwpns.com
//
#ifndef MIXBOX_H_ #ifndef MIXBOX_H_
#define MIXBOX_H_ #define MIXBOX_H_
#define MIXBOX_NUMLATENTS 7 #ifdef __cplusplus
extern "C" {
#endif
void mixbox_lerp_srgb8(unsigned char r1,unsigned char g1,unsigned char b1, #define MIXBOX_LATENT_SIZE 7
typedef float mixbox_latent[MIXBOX_LATENT_SIZE];
void mixbox_lerp(unsigned char r1, unsigned char g1, unsigned char b1,
unsigned char r2, unsigned char g2, unsigned char b2, unsigned char r2, unsigned char g2, unsigned char b2,
float t, float t,
unsigned char* out_r, unsigned char* out_g, unsigned char* out_b); unsigned char* out_r, unsigned char* out_g, unsigned char* out_b);
void mixbox_lerp_srgb32f(float r1,float g1,float b1, void mixbox_lerp_float(float r1, float g1, float b1,
float r2, float g2, float b2, float r2, float g2, float b2,
float t, float t,
float* out_r, float* out_g, float* out_b); float* out_r, float* out_g, float* out_b);
void mixbox_srgb8_to_latent(unsigned char r,unsigned char g,unsigned char b,float* out_latent); void mixbox_lerp_linear_float(float r1, float g1, float b1,
void mixbox_latent_to_srgb8(float* latent,unsigned char* out_r,unsigned char* out_g,unsigned char* out_b); float r2, float g2, float b2,
void mixbox_srgb32f_to_latent(float r,float g,float b,float* out_latent);
void mixbox_latent_to_srgb32f(float* latent,float* out_r,float* out_g,float* out_b);
void mixbox_lerp_srgb8_dither(unsigned char r1,unsigned char g1,unsigned char b1,
unsigned char r2,unsigned char g2,unsigned char b2,
float t, float t,
float dither_r,float dither_g,float dither_b, float* out_r, float* out_g, float* out_b);
unsigned char* out_r,unsigned char* out_g,unsigned char* out_b);
void mixbox_latent_to_srgb8_dither(float* latent,float dither_r,float dither_g,float dither_b,unsigned char* out_r,unsigned char* out_g,unsigned char* out_b); void mixbox_rgb_to_latent(unsigned char r, unsigned char g, unsigned char b, mixbox_latent out_latent);
void mixbox_latent_to_rgb(mixbox_latent latent, unsigned char* out_r, unsigned char* out_g, unsigned char* out_b);
void mixbox_float_rgb_to_latent(float r, float g, float b, mixbox_latent out_latent);
void mixbox_latent_to_float_rgb(mixbox_latent latent, float* out_r, float* out_g, float* out_b);
void mixbox_linear_float_rgb_to_latent(float r, float g, float b, mixbox_latent out_latent);
void mixbox_latent_to_linear_float_rgb(mixbox_latent latent, float* out_r, float* out_g, float* out_b);
#ifdef __cplusplus
}
#endif
#endif #endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 172 KiB