Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
EnTerr
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

"TheEndless" wrote:
It's an RGBA value in the range of &HFFFFFF00 to &HFFFFFFFF. No idea what the RGB portion is for. This has no effect on the destination AlphaEnable state. It should behave the same as it would if you were drawing an image that was already semi-transparent (i.e., blend pixels if AlphaEnable is true, replace pixels if AlphaEnable is false).

Thank you for showing the known working values (ditto @squirreltown for the example). What about the alpha channel of the source bitmap, does it get ignored - or honored (i.e. doing blending both by parameter and source pixel alpha)?

Here is a theory on the RGB part - those could be per-color-channel alphas, i.e. you can color-tint the image by using non-FFFFFF values. Or say doing 0xFF0000FF will give you only the red plane... and maybe with some luck 0x000000FF imprints only the alpha plane? (that would be fantastic)
0 Kudos
squirreltown
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

I know if you have transparent parts of the bitmap, they remain transparent through the fade, as long as screen.SetAlpha is true. I don't think color tinting a bitmap works if i read you right, the Roku seems to ignore the color part of the hex string if its a bitmap - if you set a bitmap color to &hFFFFFFFF or &h000000FF it looks the same.
Kinetics Screensavers
0 Kudos
EnTerr
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

"squirreltown" wrote:
I don't think color tinting a bitmap works if i read you right, the Roku seems to ignore the color part of the hex string if its a bitmap - if you set a bitmap color to &hFFFFFFFF or &h000000FF it looks the same.

It works for me. If it didn't, this would be an all-white frame - since in generating code, A is the same and i tweak only R and G channels of the mask:

Der Programmcode:
    bitmap = CreateObject("roBitmap", {width: 100, height: 100})
bitmap.Clear(&hFFFFFFFF)

screen = CreateObject("roScreen")
for i = 0 to 255
screen.DrawObject(50 + 512-2*i, 50 + 0, bitmap, RGBA(255, 255-i, 0, 255))
screen.DrawObject(50 + 0, 50 + 512-2*i, bitmap, RGBA(i, 0, 0, 255))
screen.DrawObject(50 + 2*i, 50 + 512, bitmap, RGBA(0, i, 0, 255))
screen.DrawObject(50 + 512, 50 +2*i, bitmap, RGBA(255-i, 255, 0, 255))
'screen.finish()
end for
screen.finish()
wait(0, screen.getPort())

Where RGBA of course is
function RGBA(r, g, b, a)
return &h1000000*r + &h10000*g + &h100*b + a
end function


PS. bonus points if someone can explain why this code works always on Roku3 (4200) - but same code on HDMI stick (3500) shows the roScreen in only about 40-50% of the time, rest of the cases channel stays in "Loading..." screen forever (=till exiting manually). Seems like a nasty race condition bug.
0 Kudos
squirreltown
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

Thats cool. I should have said external (.png .jpg) bitmaps.
Kinetics Screensavers
0 Kudos
TheEndless
Channel Surfer

Re: Transitions for slideshow? (fades, slides, etc..)

"EnTerr" wrote:
PS. bonus points if someone can explain why this code works always on Roku3 (4200) - but same code on HDMI stick (3500) shows the roScreen in only about 40-50% of the time, rest of the cases channel stays in "Loading..." screen forever (=till exiting manually). Seems like a nasty race condition bug.

Assuming you've pasted that code directly into Main/RunUserInterface, it's likely because you don't have a facade open to keep the channel alive, and the call to CreateObject("roBitmap") is right on the edge of the threshold. Move the CreateObject("roScreen") before the creation of the bitmap, and I bet it runs 100% of the time.
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)
0 Kudos
squirreltown
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

It ran 3 times in a row on my 2XS, but i moved the roscreen like Endless suggested.
Kinetics Screensavers
0 Kudos
EnTerr
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

"TheEndless" wrote:
"EnTerr" wrote:
PS. bonus points if someone can explain why this code works always on Roku3 (4200) - but same code on HDMI stick (3500) shows the roScreen in only about 40-50% of the time, rest of the cases channel stays in "Loading..." screen forever (=till exiting manually). Seems like a nasty race condition bug.

Assuming you've pasted that code directly into Main/RunUserInterface, it's likely because you don't have a facade open to keep the channel alive, and the call to CreateObject("roBitmap") is right on the edge of the threshold. Move the CreateObject("roScreen") before the creation of the bitmap, and I bet it runs 100% of the time.

Yes, code is straight from Main.
Nope, moving roScreen creation on top does not change the situation, still no good 5 out of 10 runs; no regular pattern (i.e. not every other time).

"Facade" use was prescribed to avoid channel exiting prematurely - but this is not the case here, it happily stays in "wait". I can ctrl-C that in console and code gets interrupted. Then the usual YMMV "sudden death syndrome" may happen (i.e. Roku exit to main menu) - but if it stays - i can issue commands like screen.finish()/swapbuffers() but the "Loading..." screen persists.

Zie Stick is on 5.4.2525...

PS. Discussion of this moved to separate thread, viewtopic.php?f=34&t=69015
0 Kudos
TheEndless
Channel Surfer

Re: Transitions for slideshow? (fades, slides, etc..)

"EnTerr" wrote:
"TheEndless" wrote:
"EnTerr" wrote:
PS. bonus points if someone can explain why this code works always on Roku3 (4200) - but same code on HDMI stick (3500) shows the roScreen in only about 40-50% of the time, rest of the cases channel stays in "Loading..." screen forever (=till exiting manually). Seems like a nasty race condition bug.

Assuming you've pasted that code directly into Main/RunUserInterface, it's likely because you don't have a facade open to keep the channel alive, and the call to CreateObject("roBitmap") is right on the edge of the threshold. Move the CreateObject("roScreen") before the creation of the bitmap, and I bet it runs 100% of the time.

Yes, code is straight from Main.
Nope, moving roScreen creation on top does not change the situation, still 5 out of 10 runs no good; no regular patern (i.e. not every other time).
"Facade" use was prescribed to avoid channel exiting prematurely - but this is not the case here, it stays in "wait", i can ctrl-C that in console and code gets interrupted. Then the usual YMMV "sudden death syndrome" may happen (i.e. Roku exit to main menu) but if it stays - i can issue commands like screen.finish()/swapbuffers() but the "Loading..." screen stays.

Zie Stick is on 5.4.2525...

Oh, all right.. I'll give it a try... sheesh... brb. 😛

EDIT: Ok, I reproduced it. My next guess was going to be that the problem was that you are passing screen.GetPort() to wait, but you never actually assign a port to screen, but that doesn't seem to make a difference either.
If you change it to a double-buffered screen, and call SwapBuffers() instead of Finish(), it works every time. My guess is that the loading screen is double-buffered, and when you create a single buffered screen, sometimes it incorrectly shows the old back buffer that the splash screen still lives in (the race condition you referred to).
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)
0 Kudos
EnTerr
Roku Guru

Re: Transitions for slideshow? (fades, slides, etc..)

"squirreltown" wrote:
Thats cool. I should have said external (.png .jpg) bitmaps.

It works with bitmaps from files too (why wouldn't it - a roBitmap is a roBitmap):

ps. i call this art installation "Stairways to purple"

[spoiler=gory details:4ytc4snt]

screen = CreateObject("roScreen")
screen.Clear(&h715883ff)
screen.setAlphaEnable(true)

xfer = createObject("roUrlTransfer")
xfer.setUrl("http://www.roku.com/sites/all/themes/roku/images/logo.png")
? "get to file", xfer.getToFile("tmp:/logo.png")
bitmap = CreateObject("roBitmap", "tmp:/logo.png")

screen.drawObject(300, 300, bitmap)
screen.drawObject(50, 50+512, bitmap, &hFF)
for i = 15 to 255 step 24
screen.drawObject(50 + 0, 50 + 512-2*i, bitmap, RGBA(i, 0, 0, 255))
screen.drawObject(50 + 2*i, 50 + 512, bitmap, RGBA(0, 0, i, 255))
end for
for i = 15 to 255 step 24
screen.drawObject(50 + 2*i, 50 + 0, bitmap, RGBA(255, 0, i, 255))
screen.drawObject(50 + 512, 50 +512-2*i, bitmap, RGBA(i, 0, 255, 255))
end for
screen.finish()

wait(0, screen.getPort())
[/spoiler:4ytc4snt]
0 Kudos

Re: Transitions for slideshow? (fades, slides, etc..)

If anyone is interested I built a Roku photo slideshow app with a slide transition.

It pulls the images from a JSON feed and loads them into an array of temporary images. Then it loops through animating them all.

https://github.com/decadeofdefeat/roku-animated-slideshow

Hope this helps someone.
0 Kudos