HSL<->RGB?
BlitzMax Forums/BlitzMax Programming/HSL<->RGB?
| ||
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. |
| ||
I'm looking for this exact thing right now for my particle system.. I'll post if I find it or make it work. |
| ||
Specifically (first comment): http://www.blitzbasic.com/codearcs/codearcs.php?code=2494#comments The archive is a nice multi-component color class. |
| ||
http://en.wikipedia.org/wiki/HSL_and_HSV |
| ||
Oh :( It's late. |
| ||
Blah. :p |
| ||
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. |
| ||
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... |
| ||
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. |