summaryrefslogtreecommitdiff
path: root/include/im_colorhsi.h
blob: 9749002d747fe9377f9261efc0f8e81a33dea820 (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** \file
 * \brief HSI Color Manipulation
 *
 * See Copyright Notice in im_lib.h
 */

#ifndef __IM_COLORHSI_H
#define __IM_COLORHSI_H

#if	defined(__cplusplus)
extern "C" {
#endif


/** \defgroup hsi HSI Color Coordinate System Conversions
 *
 * \par
 * HSI is just the RGB color space written in a different coordinate system.
 * \par
 * "I" is defined along the cube diagonal. It ranges from 0 (black) to 1 (white). \n
 * HS are the polar coordinates of a plane normal to "I". \n
 * "S" is the normal distance from the diagonal of the RGB cube. It ranges from 0 to 1. \n
 * "H" is the angle starting from the red vector, given in degrees.
 * \par
 * This is not a new color space, this is exactly the same gammut as RGB. \n
 * \par
 * See \ref im_colorhsi.h
 * \ingroup color */


/** Returns I where S is maximum given H (here in radians).
 * \ingroup hsi */
float imColorHSI_ImaxS(float h, double cosh, double sinh);

/** Converts from RGB to HSI.
 * \ingroup hsi */
void imColorRGB2HSI(float r, float g, float b, float *h, float *s, float *i);

/** Converts from RGB (byte) to HSI.
 * \ingroup hsi */
void imColorRGB2HSIbyte(unsigned char r, unsigned char g, unsigned char b, float *h, float *s, float *i);

/** Converts from HSI to RGB.
 * \ingroup hsi */
void imColorHSI2RGB(float h, float s, float i, float *r, float *g, float *b);

/** Converts from HSI to RGB (byte).
 * \ingroup hsi */
void imColorHSI2RGBbyte(float h, float s, float i, unsigned char *r, unsigned char *g, unsigned char *b);


#if defined(__cplusplus)
}
#endif

#endif