diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2016-01-04 21:13:38 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2016-01-04 21:13:38 +0100 |
commit | db99d62a8f3ac1c09f4105e60f5be32ad008d3a5 (patch) | |
tree | b5e35927e302c830811c4780a8a8584502bd2d95 /src/libred.h | |
parent | split out from radharc (diff) | |
download | libred-db99d62a8f3ac1c09f4105e60f5be32ad008d3a5.tar.gz libred-db99d62a8f3ac1c09f4105e60f5be32ad008d3a5.tar.bz2 libred-db99d62a8f3ac1c09f4105e60f5be32ad008d3a5.tar.xz |
misc
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/libred.h (renamed from src/solar.h) | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/solar.h b/src/libred.h index 8e94cf9..615ed04 100644 --- a/src/solar.h +++ b/src/libred.h @@ -14,6 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef LIBRED_H +#define LIBRED_H + /** @@ -105,3 +108,57 @@ int libred_check_timetravel(void); # define libred_check_timetravel() 0 #endif + + +/** + * The highest colour temperature in the table. + */ +#define LIBRED_HIGHEST_TEMPERATURE 40000 + +/** + * The lowest colour temperature in the table. + */ +#define LIBRED_LOWEST_TEMPERATURE 1000 + +/** + * The temperature difference between the colours in the table. + */ +#define LIBRED_DELTA_TEMPERATURE 100 + + + +/** + * This function must be called, once, + * before calling `libred_get_colour`. + * + * @return 0 on success, -1 on error. + * + * @throws Any error specified for `open(3)`. + */ +int libred_init_colour(void); + +/** + * Call this when the process will not + * longer make calls to `libred_get_colour`. + */ +void libred_term_colour(void); + +/** + * Get the [0, 1] sRGB values of a colour temperature. + * + * @param temp The desired colour temperature. + * @param r Output parameter for the “red” value. + * @param g Output parameter for the green value. + * @param b Output parameter for the blue value. + * @return 0 on succeess, -1 on error. + * + * @throws 0 The file did not have the expected size. + * @throws EDOM The selected temperature is below 1000 K. + * @throws Any error specified for pread(3). + */ +int libred_get_colour(long int temp, double *r, double *g, double *b); + + + +#endif + |