Add color compare api

This commit is contained in:
Willy-JL
2023-08-15 00:59:44 +02:00
parent d413d30a2d
commit 9a3036387f
3 changed files with 15 additions and 0 deletions

View File

@@ -1734,6 +1734,7 @@ Function,+,hex_char_to_uint8,_Bool,"char, char, uint8_t*"
Function,+,hex_chars_to_uint64,_Bool,"const char*, uint64_t*" Function,+,hex_chars_to_uint64,_Bool,"const char*, uint64_t*"
Function,+,hex_chars_to_uint8,_Bool,"const char*, uint8_t*" Function,+,hex_chars_to_uint8,_Bool,"const char*, uint8_t*"
Function,+,hsv2rgb,RgbColor,HsvColor Function,+,hsv2rgb,RgbColor,HsvColor
Function,+,hsvcmp,int,"HsvColor*, HsvColor*"
Function,-,hypot,double,"double, double" Function,-,hypot,double,"double, double"
Function,-,hypotf,float,"float, float" Function,-,hypotf,float,"float, float"
Function,-,hypotl,long double,"long double, long double" Function,-,hypotl,long double,"long double, long double"
@@ -2571,6 +2572,7 @@ Function,+,rgb_backlight_set_rainbow_interval,void,uint32_t
Function,+,rgb_backlight_set_rainbow_mode,void,RGBBacklightRainbowMode Function,+,rgb_backlight_set_rainbow_mode,void,RGBBacklightRainbowMode
Function,+,rgb_backlight_set_rainbow_speed,void,uint8_t Function,+,rgb_backlight_set_rainbow_speed,void,uint8_t
Function,-,rgb_backlight_update,void,"uint8_t, _Bool" Function,-,rgb_backlight_update,void,"uint8_t, _Bool"
Function,+,rgbcmp,int,"RgbColor*, RgbColor*"
Function,-,rindex,char*,"const char*, int" Function,-,rindex,char*,"const char*, int"
Function,-,rint,double,double Function,-,rint,double,double
Function,-,rintf,float,float Function,-,rintf,float,float
1 entry status name type params
1734 Function + hex_chars_to_uint64 _Bool const char*, uint64_t*
1735 Function + hex_chars_to_uint8 _Bool const char*, uint8_t*
1736 Function + hsv2rgb RgbColor HsvColor
1737 Function + hsvcmp int HsvColor*, HsvColor*
1738 Function - hypot double double, double
1739 Function - hypotf float float, float
1740 Function - hypotl long double long double, long double
2572 Function + rgb_backlight_set_rainbow_mode void RGBBacklightRainbowMode
2573 Function + rgb_backlight_set_rainbow_speed void uint8_t
2574 Function - rgb_backlight_update void uint8_t, _Bool
2575 Function + rgbcmp int RgbColor*, RgbColor*
2576 Function - rindex char* const char*, int
2577 Function - rint double double
2578 Function - rintf float float

View File

@@ -2,6 +2,14 @@
#include "colors.h" #include "colors.h"
inline int rgbcmp(RgbColor* a, RgbColor* b) {
return memcmp(a, b, sizeof(RgbColor));
}
inline int hsvcmp(HsvColor* a, HsvColor* b) {
return memcmp(a, b, sizeof(HsvColor));
}
RgbColor hsv2rgb(HsvColor hsv) { RgbColor hsv2rgb(HsvColor hsv) {
RgbColor rgb; RgbColor rgb;
uint8_t region, remainder, p, q, t; uint8_t region, remainder, p, q, t;

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include <string.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -18,6 +19,10 @@ typedef struct HsvColor {
uint8_t v; uint8_t v;
} HsvColor; } HsvColor;
int rgbcmp(RgbColor* a, RgbColor* b);
int hsvcmp(HsvColor* a, HsvColor* b);
RgbColor hsv2rgb(HsvColor hsv); RgbColor hsv2rgb(HsvColor hsv);
HsvColor rgb2hsv(RgbColor rgb); HsvColor rgb2hsv(RgbColor rgb);