Wireshark  4.3.0
The Wireshark network protocol analyzer
color.h
Go to the documentation of this file.
1 
11 #ifndef __COLOR_H__
12 #define __COLOR_H__
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif /* __cplusplus */
17 
18 #include <inttypes.h>
19 
20 /*
21  * Data structure holding RGB value for a color, 16 bits per channel.
22  */
23 typedef struct {
24  uint16_t red;
25  uint16_t green;
26  uint16_t blue;
27 } color_t;
28 
29 /*
30  * Convert a color_t to a 24-bit RGB value, reducing each channel to
31  * 8 bits and combining them.
32  */
33 inline static unsigned int
34 color_t_to_rgb(const color_t *color) {
35  return (((color->red >> 8) << 16)
36  | ((color->green >> 8) << 8)
37  | (color->blue >> 8));
38 }
39 
40 #ifdef __cplusplus
41 }
42 #endif /* __cplusplus */
43 
44 #endif
45 
46 /*
47  * Editor modelines - https://www.wireshark.org/tools/modelines.html
48  *
49  * Local variables:
50  * c-basic-offset: 4
51  * tab-width: 8
52  * indent-tabs-mode: nil
53  * End:
54  *
55  * vi: set shiftwidth=4 tabstop=8 expandtab:
56  * :indentSize=4:tabSize=8:noTabs=true:
57  */
Definition: color.h:23