Developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dev42
Visitor

Re: HSVA to RGBA function

@Romans -

Thanks for that link! Awesome stuff there.

Now, is there still a problem? Because, to me at least, once the signed/unsigned issue is understood, it should become clear that, when talking about signed integers:
&hFFFFFFFF != 4294967295

&hFFFFFFFF == -1

still working on how the 64 bit Double gets clipped to the 32 bit Signed Integer.

Edit: Double is to Float as int is to char!
4294967295 == 0x41EFFFFFFFE00000 ==
01000001 11101111 11111111 11111111
11111111 11100000 00000000 00000000

but it is getting clipped... possibly taking the least significant 32 bits. ( chime in any time gurus! )
________________________

Wikipedia: 2's Complement
Tags (1)
0 Kudos
squirreltown
Roku Guru

Re: HSVA to RGBA function

"EnTerr" wrote:
Maybe calling it always with V=100, A=255 has saved your bacon so far, IDK. But check for colors with strong R, they should all be washing to cyan (?).

Thats what I found, passing it pure red returned a really pale cyan. I already had another solution so i didnt pursue it though.
Kinetics Screensavers
Tags (1)
0 Kudos
dev42
Visitor

Re: HSVA to RGBA function

I haven't yet tried this with DrawObject and I'm not understanding the point of converting 2^32 to "decimal" and then use that as a color IF the HSVAtoRGBA() func is working as it should ...

The main tweak's to HSVAtoRGBA() are that it now uses Integers, Integer bit shifting which supposedly avoids the Double to Integer conversion issue, and returns an Integer. The function (latest ver) returned negative values and a spectrum from Red through all the hues back to Red... so, I was pleasantly content.

I did call out how fully I tested this. 😉

I'll dig deeper later.
__________________

"squirreltown" wrote:
Thats what I found, passing it pure red returned a really pale cyan. I already had another solution so i didn't pursue it though.

I did make mention of the "baby blue" :roll: ... and again, my changes to the HSV...() fixed it. No more "pale cyan". Could some kind soul test it out?
Tags (1)
0 Kudos
Romans_I_XVI
Roku Guru

Re: HSVA to RGBA function

Sorry, the dectohex function I posted earlier is not the same as what I'm using, I forgot I removed that "As Integer" so it is not getting chopped off and I'm getting back the correct hex as a string, I just now tested it.
Tags (1)
0 Kudos
Romans_I_XVI
Roku Guru

Re: HSVA to RGBA function

Ok finally tested your version of the function dev42 and it works perfect! Thank you for your magic!

I think I will replace the one in the original function with yours.
Tags (1)
0 Kudos
squirreltown
Roku Guru

Re: HSVA to RGBA function

"dev42" wrote:

I did make mention of the "baby blue" :roll: ... and again, my changes to the HSV...() fixed it. No more "pale cyan". Could some kind soul test it out?

Yep it works, thank you.
Kinetics Screensavers
Tags (1)
0 Kudos
Romans_I_XVI
Roku Guru

Re: HSVA to RGBA function

It's throwing a type mismatch if I give it a saturation of 0 though. I've tried 0 with everything else and it works.


Type Mismatch. (runtime error &h18) in pkg:/source/generalUtils.brs(77)
077: for c = 0 to rgb.count()-1 : rgb[c] = int(rgb[c] * 255) : end for
Tags (1)
0 Kudos
Romans_I_XVI
Roku Guru

Re: HSVA to RGBA function

I think I found the problem.

This


if s% = 0 then
rgb = [v, v, v]
else


Needed to change to this

   if s% = 0 then
rgb = [v%/100, v%/100, v%/100]
else
Tags (1)
0 Kudos
dev42
Visitor

Re: HSVA to RGBA function

Good catch. Glad to be helpful.
Tags (1)
0 Kudos
TheEndless
Channel Surfer

Re: HSVA to RGBA function

Out of curiosity, why are you using HSV instead of RGB in the first place?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
Tags (1)
0 Kudos
Community is Being Upgraded!

We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.

Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality. In the meantime, for additional assistance, visit our Support Site.

We're sorry for this disruption — we’re excited to share what’s next!