1mlib_ImageColorRGB2HSL_Fp(3mMeLdIiBa)Lib Library Funcmtliiobn_sImageColorRGB2HSL_Fp(3MLIB)
2
3
4
6 mlib_ImageColorRGB2HSL_Fp - RGB to HSL color conversion
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageColorRGB2HSL_Fp(mlib_image *dst,
13 const mlib_image *src);
14
15
17 The mlib_ImageColorRGB2HSL_Fp() function performs a conversion from
18 red/green/blue to hue/saturation/lightness. The source and destination
19 images must be three-channel images.
20
21
22 It uses the following equations:
23
24 V = max(R, G, B)
25 Vmin = min(R, G, B)
26
27 L = (V + Vmin)/2
28
29 S = (V - Vmin)/(V + Vmin) if L ≤ 1/2
30 S = (V - Vmin)/(2 - V - Vmin) if L > 1/2
31
32 H = (5.0 + (V - B)/(V - Vmin))/6 if R = V and G = Vmin
33 H = (1.0 - (V - G)/(V - Vmin))/6 if R = V and B = Vmin
34 H = (1.0 + (V - R)/(V - Vmin))/6 if G = V and B = Vmin
35 H = (3.0 - (V - B)/(V - Vmin))/6 if G = V and R = Vmin
36 H = (3.0 + (V - G)/(V - Vmin))/6 if B = V and R = Vmin
37 H = (5.0 - (V - R)/(V - Vmin))/6 if B = V and G = Vmin
38 H = 0.0 if R = G = B
39
40
41
42 where 0 ≤ R, G, B, V, Vmin, L, S ≤ 1 and 0 ≤ H < 1.
43
44
45 For MLIB_FLOAT and MLIB_DOUBLE images, the above equations are followed
46 verbatim. Input R, G, and B component values must be limited to the
47 [0.0, 1.0] range.
48
50 The function takes the following arguments:
51
52 dst Pointer to destination image.
53
54
55 src Pointer to source image.
56
57
59 The function returns MLIB_SUCCESS if successful. Otherwise it returns
60 MLIB_FAILURE.
61
63 See attributes(5) for descriptions of the following attributes:
64
65
66
67
68 ┌─────────────────────────────┬─────────────────────────────┐
69 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
70 ├─────────────────────────────┼─────────────────────────────┤
71 │Interface Stability │Committed │
72 ├─────────────────────────────┼─────────────────────────────┤
73 │MT-Level │MT-Safe │
74 └─────────────────────────────┴─────────────────────────────┘
75
77 mlib_ImageColorHSL2RGB(3MLIB), mlib_ImageColorHSL2RGB_Fp(3MLIB),
78 mlib_ImageColorRGB2HSL(3MLIB), attributes(5)
79
80
81
82SunOS 5.11 2 Mar 2007 mlib_ImageColorRGB2HSL_Fp(3MLIB)