colourpicker

Simple Colour Picker written in C
git clone anongit@rnpnr.xyz:colourpicker.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: c4d55b6b374dc0307c057ec4e45dc6d3881ee2ce
Parent: 6bda1debf5c27a8714095318f93db36b4396c696
Author: Randy Palamar
Date:   Sun,  4 Aug 2024 15:14:35 -0600

make sure hsv texture is cleared before filling

Diffstat:
Mcolourpicker.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/colourpicker.c b/colourpicker.c @@ -208,7 +208,7 @@ step_colour_mode(ColourPickerCtx *ctx, i32 inc) } static void -fill_hsv_texture(RenderTexture texture, v4 hsv) +fill_hsv_texture(RenderTexture texture, v4 hsv, Color bg) { f32 line_length = (f32)texture.texture.height / 3; v2 vtop = {0}; @@ -223,6 +223,7 @@ fill_hsv_texture(RenderTexture texture, v4 hsv) f32 inc = 1.0 / texture.texture.width; BeginTextureMode(texture); + ClearBackground(bg); for (u32 i = 0; i < texture.texture.width; i++) { DrawLineV(sbot.rv, hbot.rv, colour_from_normalized(hsv_to_rgb(h))); DrawLineV(vbot.rv, sbot.rv, colour_from_normalized(hsv_to_rgb(s))); @@ -815,7 +816,7 @@ do_slider_mode(ColourPickerCtx *ctx, v2 relative_origin) UnloadRenderTexture(ctx->hsv_texture); ctx->hsv_texture = LoadRenderTexture(w, h); } - fill_hsv_texture(ctx->hsv_texture, ctx->colour); + fill_hsv_texture(ctx->hsv_texture, get_formatted_colour(ctx, CM_HSV), ctx->bg); ctx->flags &= ~CPF_REFILL_TEXTURE; }