Skip to content

Commit

Permalink
Some more HSV math fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Aug 9, 2024
1 parent e7d9f5e commit 3509ab2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions initfs/is31fl3737.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def hsv(self, hue, sat, val=255):
"""
# Convert hue to an angle and compute the remainder mod 60
hue = int(hue * 360) % 360
rem = hue // 60
rem = hue % 60

# Convert saturation into a byte and do the rest in fixed point.
sat = int(sat * 256)
val = int(val)
p = val * (256 - sat) >> 8
q = val * (256 - (rem * sat // 60)) >> 8
t = val * (256 - (256 - rem) * sat // 60) >> 8
t = val * (256 - (60 - rem) * sat // 60) >> 8

if hue < 60:
self.r = val
Expand Down

0 comments on commit 3509ab2

Please sign in to comment.