MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / interpolateGradient

Function interpolateGradient

src/gui/SpectrumWidget.cpp:753–762  ·  view source on GitHub ↗

Interpolate a normalized value t (0–1) through the given gradient stops.

Source from the content-addressed store, hash-verified

751
752// Interpolate a normalized value t (0–1) through the given gradient stops.
753static QRgb interpolateGradient(float t, const WfGradientStop* stops, int n)
754{
755 int i = 0;
756 while (i < n - 2 && stops[i + 1].pos < t) ++i;
757 const float seg = (t - stops[i].pos) / (stops[i + 1].pos - stops[i].pos);
758 const int r = static_cast<int>(stops[i].r + seg * (stops[i + 1].r - stops[i].r));
759 const int g = static_cast<int>(stops[i].g + seg * (stops[i + 1].g - stops[i].g));
760 const int b = static_cast<int>(stops[i].b + seg * (stops[i + 1].b - stops[i].b));
761 return qRgb(qBound(0, r, 255), qBound(0, g, 255), qBound(0, b, 255));
762}
763
764#ifdef AETHER_GPU_SPECTRUM
765static bool qtSoftwareOpenGlRequested()

Callers 4

dbmToRgbMethod · 0.85
dssStrengthToRgbMethod · 0.85
kiwiSdrLevelToRgbMethod · 0.85
intensityToRgbMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected