MCPcopy Create free account
hub / github.com/DISTRHO/DPF / computeHue

Function computeHue

dgl/src/Color.cpp:19–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include "../Color.hpp"
18
19START_NAMESPACE_DGL
20
21// -----------------------------------------------------------------------
22
23static float computeHue(float h, float m1, float m2)
24{
25 if (h < 0) h += 1;
26 if (h > 1) h -= 1;
27 if (h < 1.0f/6.0f)
28 return m1 + (m2 - m1) * h * 6.0f;
29 if (h < 3.0f/6.0f)
30 return m2;
31 if (h < 4.0f/6.0f)
32 return m1 + (m2 - m1) * (2.0f/3.0f - h) * 6.0f;
33 return m1;
34}
35
36static void fixRange(float& value)
37{

Callers 1

fromHSLMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected