From 77891affb3f397d464938cac290856dff817e3fd Mon Sep 17 00:00:00 2001 From: Lieven Petersen <50841810+LievenPetersen@users.noreply.github.com> Date: Thu, 15 Feb 2024 22:46:55 +0100 Subject: [PATCH] added documentation on Hue control issues with GuiColorPicker (#373) * added documentation on Hue control issues with GuiColorPicker * Moved Color Picker doc from function signature to definition --- src/raygui.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/raygui.h b/src/raygui.h index a2a2563..5facf0c 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -3561,6 +3561,7 @@ int GuiColorBarHue(Rectangle bounds, const char *text, float *hue) // float GuiColorBarAlpha(Rectangle bounds, float alpha) // float GuiColorBarHue(Rectangle bounds, float value) // NOTE: bounds define GuiColorPanel() size +// NOTE: this picker converts RGB to HSV, which can cause the Hue control to jump. If you have this problem, consider using the HSV variant instead int GuiColorPicker(Rectangle bounds, const char *text, Color *color) { int result = 0; @@ -3573,6 +3574,7 @@ int GuiColorPicker(Rectangle bounds, const char *text, Color *color) Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height }; //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) }; + // NOTE: this conversion can cause low hue-resolution, if the r, g and b value are very similar, which causes the hue bar to shift around when only the GuiColorPanel is used. Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ (*color).r/255.0f, (*color).g/255.0f, (*color).b/255.0f }); GuiColorBarHue(boundsHue, NULL, &hsv.x);