HSL<->RGB?

BlitzMax Forums/BlitzMax Programming/HSL<->RGB?

JoshK(Posted 2009) [#1]
Does anyone have some BlitzMax code for HSL to RGB to HSL conversion? I know there is some .bb code, but I can't get it to work.


_Skully(Posted 2009) [#2]
I'm looking for this exact thing right now for my particle system.. I'll post if I find it or make it work.


plash(Posted 2009) [#3]
Specifically (first comment): http://www.blitzbasic.com/codearcs/codearcs.php?code=2494#comments
The archive is a nice multi-component color class.


Yahfree(Posted 2009) [#4]
http://en.wikipedia.org/wiki/HSL_and_HSV


plash(Posted 2009) [#5]
Oh :(
It's late.


Yahfree(Posted 2009) [#6]
Blah. :p


JoshK(Posted 2009) [#7]
That code doesn't convert between RGB and HSV reliably, either. Run an image through it, just converting to HSV and back, and you will see errors.


BlitzSupport(Posted 2009) [#8]
Is HSV any use? (I don't quite get the difference from that Wiki page.)

Mark had a color.mod in very early BlitzMax that covered conversions between RGB, HSV and CMY. If that's any use (and Mark is OK with it) I've found the code...


Otus(Posted 2009) [#9]
I used these in lossy compression so I may have taken shortcuts (not sure anymore). May or may not be exact enough for your use. All color values are taken to be in [0,1].



Edit: I should also have an Int/Byte version somewhere (more lossy, faster), if someone needs one. Can't seem to find it at the moment, though. May be in another installation.