summaryrefslogtreecommitdiffstats
path: root/libdimension/color.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-14 21:20:43 -0500
commit8fe33a340b8979a73fa84f201c15519a9b5d0266 (patch)
tree12cdbb1c1b9a48f533ab36980602785be1e1deeb /libdimension/color.c
parent20a55aa78050d94b187d4edfaac91ea00efea505 (diff)
downloaddimension-8fe33a340b8979a73fa84f201c15519a9b5d0266.tar.xz
Document libdimension with Doxygen.
Diffstat (limited to 'libdimension/color.c')
-rw-r--r--libdimension/color.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/libdimension/color.c b/libdimension/color.c
index eee1f0e..e91ebc1 100644
--- a/libdimension/color.c
+++ b/libdimension/color.c
@@ -18,6 +18,11 @@
* <http://www.gnu.org/licenses/>. *
*************************************************************************/
+/**
+ * @file
+ * Color handling.
+ */
+
#include "dimension.h"
#include <math.h> /* For pow(), sqrt() */
@@ -97,7 +102,21 @@ dmnsn_color_is_black(dmnsn_color color)
return color.R == 0.0 && color.G == 0.0 && color.B == 0.0;
}
-/* sRGB's `C' function */
+/* Convert an sRGB color to a dmnsn_color (actually a no-op) */
+dmnsn_color
+dmnsn_color_from_sRGB(dmnsn_sRGB sRGB)
+{
+ dmnsn_color ret = {
+ .R = sRGB.R,
+ .G = sRGB.G,
+ .B = sRGB.B,
+ .filter = 0.0,
+ .trans = 0.0
+ };
+ return ret;
+}
+
+/** sRGB's `C' function. */
static double
dmnsn_sRGB_C(double Clinear)
{
@@ -144,7 +163,8 @@ dmnsn_color_from_xyY(dmnsn_CIE_xyY xyY)
return dmnsn_color_from_XYZ(ret);
}
-/* Inverse function of CIE L*a*b*'s `f' function, for the reverse conversion */
+/** Inverse function of CIE L*a*b*'s `f' function, for the reverse
+ conversion. */
static double
dmnsn_Lab_finv(double t)
{
@@ -195,21 +215,15 @@ dmnsn_color_from_Luv(dmnsn_CIE_Luv Luv, dmnsn_CIE_XYZ white)
return dmnsn_color_from_XYZ(ret);
}
-/* Convert an sRGB color to a dmnsn_color (actually a no-op) */
-dmnsn_color
-dmnsn_color_from_sRGB(dmnsn_sRGB sRGB)
+/* Convert a dmnsn_color to an sRGB color (actually a no-op) */
+dmnsn_sRGB
+dmnsn_sRGB_from_color(dmnsn_color color)
{
- dmnsn_color ret = {
- .R = sRGB.R,
- .G = sRGB.G,
- .B = sRGB.B,
- .filter = 0.0,
- .trans = 0.0
- };
- return ret;
+ dmnsn_sRGB sRGB = { .R = color.R, .G = color.G, .B = color.B };
+ return sRGB;
}
-/* Inverse function of sRGB's `C' function, for the reverse conversion */
+/** Inverse function of sRGB's `C' function, for the reverse conversion. */
static double
dmnsn_sRGB_Cinv(double CsRGB)
{
@@ -260,7 +274,7 @@ dmnsn_xyY_from_color(dmnsn_color color)
return ret;
}
-/* CIE L*a*b*'s `f' function */
+/** CIE L*a*b*'s `f' function. */
static double
dmnsn_Lab_f(double t)
{
@@ -305,14 +319,7 @@ dmnsn_Luv_from_color(dmnsn_color color, dmnsn_CIE_XYZ white)
return ret;
}
-/* Convert a dmnsn_color to an sRGB color (actually a no-op) */
-dmnsn_sRGB
-dmnsn_sRGB_from_color(dmnsn_color color)
-{
- dmnsn_sRGB sRGB = { .R = color.R, .G = color.G, .B = color.B };
- return sRGB;
-}
-
+/** Greyscale color intensity. */
static double
dmnsn_color_intensity(dmnsn_color color)
{