| 82 | } |
| 83 | |
| 84 | ColorMatrix 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 | |
| 99 | ColorMatrix saturation_matrix(Saturation sat) { |
| 100 | if (sat == DEFAULT_SAT) // Fast path |
no outgoing calls
no test coverage detected