File indexing completed on 2024-04-28 05:50:39

0001 /*
0002  * HSLuv-C: Human-friendly HSL
0003  * <https://github.com/hsluv/hsluv-c>
0004  * <https://www.hsluv.org/>
0005  *
0006  * SPDX-FileCopyrightText: 2015 Alexei Boronine <alexei@boronine.com> (original idea, JavaScript implementation)
0007  * SPDX-FileCopyrightText: 2015 Roger Tallada <roger.tallada@gmail.com> (Obj-C implementation)
0008  * SPDX-FileCopyrightText: 2017 Martin Mitas <mity@morous.org> (C implementation, based on Obj-C implementation)
0009  * SPDX-License-Identifier: MIT
0010  */
0011 
0012 #ifndef HSLUV_H
0013 #define HSLUV_H
0014 
0015 #ifdef __cplusplus
0016 extern "C" {
0017 #endif
0018 
0019 /**
0020  * Convert HSLuv to RGB.
0021  *
0022  * @param h Hue. Between 0.0 and 360.0.
0023  * @param s Saturation. Between 0.0 and 100.0.
0024  * @param l Lightness. Between 0.0 and 100.0.
0025  * @param[out] pr Red component. Between 0.0 and 1.0.
0026  * @param[out] pg Green component. Between 0.0 and 1.0.
0027  * @param[out] pb Blue component. Between 0.0 and 1.0.
0028  */
0029 void hsluv2rgb(double h, double s, double l, double *pr, double *pg, double *pb);
0030 
0031 /**
0032  * Convert RGB to HSLuv.
0033  *
0034  * @param r Red component. Between 0.0 and 1.0.
0035  * @param g Green component. Between 0.0 and 1.0.
0036  * @param b Blue component. Between 0.0 and 1.0.
0037  * @param[out] ph Hue. Between 0.0 and 360.0.
0038  * @param[out] ps Saturation. Between 0.0 and 100.0.
0039  * @param[out] pl Lightness. Between 0.0 and 100.0.
0040  */
0041 void rgb2hsluv(double r, double g, double b, double *ph, double *ps, double *pl);
0042 
0043 /**
0044  * Convert HPLuv to RGB.
0045  *
0046  * @param h Hue. Between 0.0 and 360.0.
0047  * @param s Saturation. Between 0.0 and 100.0.
0048  * @param l Lightness. Between 0.0 and 100.0.
0049  * @param[out] pr Red component. Between 0.0 and 1.0.
0050  * @param[out] pg Green component. Between 0.0 and 1.0.
0051  * @param[out] pb Blue component. Between 0.0 and 1.0.
0052  */
0053 void hpluv2rgb(double h, double s, double l, double *pr, double *pg, double *pb);
0054 
0055 /**
0056  * Convert RGB to HPLuv.
0057  *
0058  * @param r Red component. Between 0.0 and 1.0.
0059  * @param g Green component. Between 0.0 and 1.0.
0060  * @param b Blue component. Between 0.0 and 1.0.
0061  * @param[out] ph Hue. Between 0.0 and 360.0.
0062  * @param[out] ps Saturation. Between 0.0 and 100.0.
0063  * @param[out] pl Lightness. Between 0.0 and 100.0.
0064  *
0065  * Note that HPLuv does not contain all the colors of RGB, so converting
0066  * arbitrary RGB to it may generate invalid HPLuv colors.
0067  */
0068 void rgb2hpluv(double r, double g, double b, double *ph, double *ps, double *pl);
0069 
0070 #ifdef __cplusplus
0071 }
0072 #endif
0073 
0074 #endif /* HSLUV_H */