MCPcopy Create free account
hub / github.com/averne/Fizeau / hue_matrix

Function hue_matrix

common/src/color.cpp:84–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84ColorMatrix hue_matrix(Hue hue) {
85 if (hue == DEFAULT_HUE) // Fast path
86 return { 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f };
87
88 auto angle = hue * std::numbers::pi_v<float>;
89 auto c1 = (1.0f + 2.0f * std::cos(angle)) / 3.0f,
90 c2 = (1.0f - std::cos(angle)) / 3.0f,
91 c3 = std::sin(angle) / std::numbers::sqrt3_v<float>;
92 return {
93 c1, c2 - c3, c2 + c3,
94 c2 + c3, c1, c2 - c3,
95 c2 - c3, c2 + c3, c1,
96 };
97}
98
99ColorMatrix saturation_matrix(Saturation sat) {
100 if (sat == DEFAULT_SAT) // Fast path

Callers 2

calculate_cmuFunction · 0.85
render_previewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected