1mlib_ImageColorHSV2RGB(3MLImBe)diaLib Library Functiomnlsib_ImageColorHSV2RGB(3MLIB)
2
3
4
6 mlib_ImageColorHSV2RGB - HSV to RGB color conversion
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageColorHSV2RGB(mlib_image *dst, const mlib_image *src);
13
14
16 The mlib_ImageColorHSV2RGB() function performs a conversion from
17 hue/saturation/value to red/green/blue. The source and destination
18 images must be three-channel images.
19
20
21 It uses the following equations:
22
23 P = V*(1 - S)
24 Q = V*(1 - S*fraction(H*6))
25 T = V*(1 - S*(1 - fraction(H*6)))
26
27 R, G, B = V, T, P if 0 ≤ H < 1/6
28 R, G, B = Q, V, P if 1/6 ≤ H < 2/6
29 R, G, B = P, V, T if 2/6 ≤ H < 3/6
30 R, G, B = P, Q, V if 3/6 ≤ H < 4/6
31 R, G, B = T, P, V if 4/6 ≤ H < 5/6
32 R, G, B = V, P, Q if 5/6 ≤ H < 1
33
34
35
36 where 0 ≤ H < 1 and 0 ≤ S, V, P, Q, T, R, G, B ≤ 1.
37
38
39 Assuming a pixel in the source image is (h, s, v) and its corresponding
40 pixel in the destination image is (r, g, b), then for MLIB_BYTE images,
41 the following applies:
42
43 H = h/256
44 S = s/255
45 V = v/255
46 r = R*255
47 g = G*255
48 b = B*255
49
50
51
52 for MLIB_SHORT images, the following applies:
53
54 H = (h + 32768)/65536
55 S = (s + 32768)/65535
56 V = (v + 32768)/65535
57 r = R*65535 - 32768
58 g = G*65535 - 32768
59 b = B*65535 - 32768
60
61
62
63 for MLIB_USHORT images, the following applies:
64
65 H = h/65536
66 S = s/65535
67 V = v/65535
68 r = R*65535
69 g = G*65535
70 b = B*65535
71
72
73
74 and for MLIB_INT images, the following applies:
75
76 H = (h + 2147483648)/4294967296
77 S = (s + 2147483648)/4294967295
78 V = (v + 2147483648)/4294967295
79 r = R*4294967295 - 2147483648
80 g = G*4294967295 - 2147483648
81 b = B*4294967295 - 2147483648
82
83
85 The function takes the following arguments:
86
87 dst Pointer to destination image.
88
89
90 src Pointer to source image.
91
92
94 The function returns MLIB_SUCCESS if successful. Otherwise it returns
95 MLIB_FAILURE.
96
98 See attributes(5) for descriptions of the following attributes:
99
100
101
102
103 ┌─────────────────────────────┬─────────────────────────────┐
104 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
105 ├─────────────────────────────┼─────────────────────────────┤
106 │Interface Stability │Committed │
107 ├─────────────────────────────┼─────────────────────────────┤
108 │MT-Level │MT-Safe │
109 └─────────────────────────────┴─────────────────────────────┘
110
112 mlib_ImageColorHSV2RGB_Fp(3MLIB), mlib_ImageColorRGB2HSV(3MLIB),
113 mlib_ImageColorRGB2HSV_Fp(3MLIB), attributes(5)
114
115
116
117SunOS 5.11 12 Sep 2007 mlib_ImageColorHSV2RGB(3MLIB)