lygia
/v1.1.6
/color
/space
/yiq2rgb
)Convert a color in YIQ to linear RGB color. From https://en.wikipedia.org/wiki/YIQ
Use:
<vec3|vec4> yiq2rgb(<vec3|vec4> color)
#ifndef FNC_YIQ2RGB
#define FNC_YIQ2RGB
const mat3 yiq2rgb_mat = mat3(1.0, 0.9469, 0.6235,
1.0, -0.2747, -0.6357,
1.0, -1.1085, 1.7020);
vec3 yiq2rgb(in vec3 yiq) {
return yiq2rgb_mat * yiq;
}
vec4 yiq2rgb(in vec4 yiq) {
return vec4(yiq2rgb(yiq.rgb), yiq.a);
}
#endif
Use:
<float3|float4> yiq2rgb(<float3|float4> color)
#ifndef FNC_YIQ2RGB
#define FNC_YIQ2RGB
const float3x3 yiq2rgb_mat = float3x3(
1.0, 0.9469, 0.6235,
1.0, -0.2747, -0.6357,
1.0, -1.1085, 1.7020
);
float3 yiq2rgb(in float3 yiq) {
return mul(yiq2rgb_mat, yiq);
}
float4 yiq2rgb(in float4 yiq) {
return float4(yiq2rgb(yiq.rgb), yiq.a);
}
#endif
const yiq2rgb_mat : mat3x3<f32> = mat3x3<f32>(
vec3<f32>(1.0, 0.9469, 0.6235),
vec3<f32>(1.0, -0.2747, -0.6357),
vec3<f32>(1.0, -1.1085, 1.7020) );
fn yiqToRgb(yiq : vec3<f32>) -> vec3<f32> {
return yiq2rgb_mat * yiq;
}
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository