From 824b2704df43f5a455e9ed9c01d871d1436be912 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 8 Mar 2025 15:47:33 +0100 Subject: minor misc improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/common.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) (limited to 'src/common.h') diff --git a/src/common.h b/src/common.h index 0b89b8f..22253e7 100644 --- a/src/common.h +++ b/src/common.h @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -116,17 +117,85 @@ #define WITHIN(LO, X, UP) ((LO) <= (X) && (X) <= (UP)) +/** + * Minimum valid latitude + */ +#define MIN_LATITUDE -90.0 + +/** + * Maximum valid latitude + */ +#define MAX_LATITUDE 90.0 + +/** + * Minimum valid longitude + */ +#define MIN_LONGITUDE -180.0 + +/** + * Maximum valid longitude + */ +#define MAX_LONGITUDE 180.0 + +/** + * Minimum allowed colour temperature + */ +#define MIN_TEMPERATURE ((unsigned long int)LIBRED_LOWEST_TEMPERATURE) + +/** + * Maximum allowed colour temperature + */ +#define MAX_TEMPERATURE ULONG_MAX + +/** + * Minimum allowed whitepoint brightness + */ +#define MIN_BRIGHTNESS 0.1 + +/** + * Maximum allowed whitepoint brightness + */ +#define MAX_BRIGHTNESS 1.0 + +/** + * Minimum allowed gamma + */ +#define MIN_GAMMA 0.1 + +/** + * Maximum allowed gamma + */ +#define MAX_GAMMA 10.0 + + /** * The colour temperature corresponding to no effect */ -#define NEUTRAL_TEMP 6500U +#define NEUTRAL_TEMPERATURE 6500UL + +/** + * The whitepoint brightness corresponding to + * full brightness (no effect) + */ +#define NEUTRAL_BRIGHTNESS 1.0 + +/** + * The gamma corresponding to no effect (linear output level curve) + */ +#define NEUTRAL_GAMMA 1.0 + /** * Initialiser for `struct color_setting` * * Sets all values to their neutral values (no effects applied) */ -#define COLOR_SETTING_NEUTRAL ((struct color_setting){NEUTRAL_TEMP, 1.0, {1.0, 1.0, 1.0}}) +#define COLOR_SETTING_NEUTRAL\ + ((struct color_setting){\ + NEUTRAL_TEMPERATURE,\ + NEUTRAL_BRIGHTNESS,\ + {NEUTRAL_GAMMA, NEUTRAL_GAMMA, NEUTRAL_GAMMA}\ + }) /** -- cgit v1.2.3-70-g09d2