From 62d613358a248f26e7e84c0df34a25ef3c93c5ff Mon Sep 17 00:00:00 2001 From: Codeberg Date: Tue, 28 May 2019 12:15:47 +0200 Subject: [PATCH] main.go: broken WIP for HSV --- main.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 6007a52..740447e 100644 --- a/main.go +++ b/main.go @@ -100,20 +100,21 @@ func rgb(s string) *RGB { } func (c *HSV) to_rgb() *RGB { - h := int(floor(c.h / 60)) + h := int((c.h / 60)) f := c.h / 60 - h p := c.v * (1 - c.s) q := c.v * (1 - c.s * f) t := c.v * (1 - c.s * (1 - f)) switch (h) { case 6: - case 0: return f2rgb(C.V, t, p) - case 1: return f2rgb(q, C.V, p) - case 2: return f2rgb(p, C.V, t) - case 3: return f2rgb(p, q, C.V) - case 4: return f2rgb(t, p, C.V) - case 5: return f2rgb(C.V, p, q) + case 0: return f2rgb(c.v, t, p) + case 1: return f2rgb(q, c.v, p) + case 2: return f2rgb(p, c.v, t) + case 3: return f2rgb(p, q, c.v) + case 4: return f2rgb(t, p, c.v) + case 5: return f2rgb(c.v, p, q) } + return f2rgb(0, 0, 0) } func add255(x uint8, y uint8) uint8 {