NiboRoboLib 3.2 - NIBO burger Library
color.h
gehe zur Dokumentation dieser Datei
1 /* BSD-License:
2 
3 Copyright (c) 2015 by Nils Springob, nicai-systems, Germany
4 
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without modification,
8 are permitted provided that the following conditions are met:
9 
10  * Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12  * Redistributions in binary form must reproduce the above copyright notice,
13  this list of conditions and the following disclaimer in the documentation
14  and/or other materials provided with the distribution.
15  * Neither the name nicai-systems nor the names of its contributors may be
16  used to endorse or promote products derived from this software without
17  specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 */
32 
39 #ifndef _NIBOBURGER_COLOR_H_
40 #define _NIBOBURGER_COLOR_H_
41 
42 #include <stdint.h>
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 
49 enum {
50  COLOR_RGB_WHITE = 0xffffffUL,
51  COLOR_RGB_BLACK = 0x000000UL,
52  COLOR_RGB_RED = 0xff0000UL,
53  COLOR_RGB_GREEN = 0x00ff00UL,
54  COLOR_RGB_BLUE = 0x0000ffUL,
55 
56  COLOR_RGB_CAL_BLACK = 0x000000UL,
57  COLOR_RGB_CAL_WHITE = 0xffffffUL,
58  COLOR_RGB_CAL_BLUE = 0x220077UL,
59  COLOR_RGB_CAL_RED = 0xee1122UL,
60  COLOR_RGB_CAL_GREEN = 0x668844UL,
61  COLOR_RGB_CAL_YELLOW = 0xee5555UL
62 };
63 
64 
65 enum {
66  COLOR_HSV_CAL_BLACK = 0x000000UL,
67  COLOR_HSV_CAL_WHITE = 0x0000ffUL,
68  COLOR_HSV_CAL_BLUE = 0x91b558UL,
69  COLOR_HSV_CAL_RED = 0xbaf4b7UL,
70  COLOR_HSV_CAL_GREEN = 0x27cfaaUL,
71  COLOR_HSV_CAL_YELLOW = 0x0cebfcUL
72 };
73 
86 uint16_t color_diff_rgb(uint32_t colorA, uint32_t colorB);
87 
100 uint16_t color_diff_hsv(uint32_t colorA, uint32_t colorB);
101 
116 uint16_t color_diff_hsv_bal(uint32_t colorA, uint32_t colorB, uint8_t vTol);
117 
124 uint32_t color_convert_RGB2hsv(uint8_t r, uint8_t g, uint8_t b);
125 
132 uint32_t color_convert_RGB2rgb(uint8_t r, uint8_t g, uint8_t b);
133 
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif
uint32_t color_convert_RGB2hsv(uint8_t r, uint8_t g, uint8_t b)
uint16_t color_diff_rgb(uint32_t colorA, uint32_t colorB)
uint32_t color_convert_RGB2rgb(uint8_t r, uint8_t g, uint8_t b)
uint16_t color_diff_hsv_bal(uint32_t colorA, uint32_t colorB, uint8_t vTol)
uint16_t color_diff_hsv(uint32_t colorA, uint32_t colorB)