~kennylevinsen/wlsunset

wlsunset/color_math.h -rw-r--r-- 542 bytes
f32f6963Kenny Levinsen readme: Update discuss section 26 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef _COLOR_MATH_H
#define _COLOR_MATH_H

#include "math.h"
#include "time.h"

// These are macros so they can be applied to constants
#define DEGREES(rad) ((rad) * 180.0 / M_PI)
#define RADIANS(deg) ((deg) * M_PI / 180.0)

enum sun_condition {
	NORMAL,
	MIDNIGHT_SUN,
	POLAR_NIGHT,
	SUN_CONDITION_LAST
};

struct sun {
	time_t dawn;
	time_t sunrise;
	time_t sunset;
	time_t dusk;
};

enum sun_condition calc_sun(struct tm *tm, double latitude, struct sun *sun);
void calc_whitepoint(int temp, double *rw, double *gw, double *bw);

#endif