]> Pileus Git - aweather/blobdiff - src/plugins/radar-info.h
Check for error conditions
[aweather] / src / plugins / radar-info.h
index 664eeb1b9eb97db58e11f2b40fc13993f291f1a3..100c7bd0fa9c43810856569d245d2d1d009e9c10 100644 (file)
@@ -33,4 +33,10 @@ typedef struct {
 
 extern AWeatherColormap colormaps[];
 
+static inline guint8 *colormap_get(AWeatherColormap *colormap, float value)
+{
+       int idx = value * colormap->scale + colormap->shift;
+       return colormap->data[CLAMP(idx, 0, colormap->len)];
+}
+
 #endif