At which point will the HSV colors in the fill_gradient function (in colorutils.cpp) be converted to RGB?
From this line I conclude that you can store as CHSV in the CRGBPalette256: leds[i] = CHSV( hue88 >> 8, sat88 >> 8, val88 >> 8);
However in the ColorFromPalette functions I only see CRGB data being grabbed from the Palette. Where does the conversion happen?
I found this line in pixeltypes.h, does the magic happen over here?
// allow assignment from HSV color
inline CRGB& operator= (const CHSV& rhs) attribute((always_inline))
The the conversion happen when storing the palette or when reading?
Storing.
The current palettes are currently CRGB-based, hence the name. We are, however, leaving room for CHSVPalette16 and CHSVPalette256, which we’ll probably add in the not-too-far future.
We have grand ideas for an all-HSV world-- and also day jobs.
That inline function where I pointed to (I’m kind of a C noob) takes care of the conversion? Because I’m thinking to use the hsv2rgb_spectrum instead of the rainbow.
I already wrote my own palette creation code, but that was entirely based on floats to create gradients. I’m suffering a lot that it got obsolete now after the release of your palette code
Filling the 256 value array with my gradient function (and HSV2RGB function) takes about 60ms, with yours 2.3ms I’ve noticed that the rainbow is even faster around 1.9ms.
I’m trying to implement an RYB wheel (which seems kind of similar to rainbow, with more yellow), so I need the spectrum function.
I’m a noob in using pointers (still black magic for me), but with the numerous examples (Thanks!) that I could copy-paste from I could at least make it work. I also noticed it matters in speed (using a pointer, instead of a return for example).
I’m curious if it can be optimized. Filling the 256 array with two solid colors (half, half), took about 5.2ms with this function, while it takes about 0.8ms with the normal conversion.