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: 
destruk
Streaming Star

How can your app know when the screen is done drawing?

With roImageCanvas, I have canvas.SetRequireAllImagesToDraw(TRUE) before I call show(), and yet sometimes the screen is displayed with partial images that are populated after it is displayed.

Sub DrawTopLevelScreen()
port=CreateObject("roMessagePort")
canvas=CreateObject("roImageCanvas")
canvas.SetMessagePort(port)
canvas.SetLayer(0, { Color: "#000000" }) 'opaque background
canvas.SetRequireAllImagesToDraw(TRUE)
DrawSelectionScreen(canvas)
canvas.Show()
End Sub

The DrawSelectionScreen(canvas) routine simply sets up the graphics arrays to populate the roImageCanvas screen. It was my understanding that the screen wouldn't be seen by the end user until all the graphics were done drawing?
0 Kudos
6 REPLIES 6
destruk
Streaming Star

Re: How can your app know when the screen is done drawing?

It appears by removing the line to require all images to draw fixes the problem. How strange. 3.0 beta firmware
0 Kudos
destruk
Streaming Star

Re: How can your app know when the screen is done drawing?

ok, still seeing this 'issue' . The roImageCanvas is set to pull 6 or 7 graphics from the server to create the screen to display. Sometimes on entering the channel it immediately shows a black background which is the default Image Canvas and one or two of the loaded graphics, and 30 seconds later or so it displays the rest of the images on the screen. Other times it shows the black screen immediately and then about 30 seconds later it displays the entire screen. And sometimes it displays the entire screen instantly when the channel app starts up. Similar behavior occurs when closing a grid screen created on top of the image canvas screen. I'm open to any suggestions - would any of these ideas help?

Using roUrlTransfer to download all images used to tmp first, then using rofilesystem to verify the byte sizes of the downloaded files, and then drawing the images to the canvas?
Forcing the garbage collector to run when the gridscreen is closed and creating a facade screen to prevent the prior canvas image from displaying until the garbage collection is finished?

Because what I also see is - when the gridscreen is closed, you can see the canvas fully drawn, which is great, and pressing buttons on the remote play sound like they should be immediately when the button is pressed, but the graphics aren't being updated until it's entirely done closing the gridscreen, so some delay is there too.
0 Kudos
destruk
Streaming Star

Re: How can your app know when the screen is done drawing?

Does a question require a bump to get any guesses? Even with the images downloaded to tmp first, the roku appears to be quite busy as a larger gridscreen closes, so unless I add a 5 second delay to comnpensate (which is quite long) the delay would need to be variable duration.
0 Kudos
TheEndless
Channel Surfer

Re: How can your app know when the screen is done drawing?

We actually discussed this in depth awhile back.. I don't think we ever found a definitive method, but let me see if I can find the thread...

EDIT: Yeah, we discussed it here (not as "in depth" as I thought).. looks like the same general results as you're seeing: viewtopic.php?f=34&t=31062&p=190596
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
destruk
Streaming Star

Re: How can your app know when the screen is done drawing?

Thas for the link - no solution, so I'll mark it off the list of bugs to look at.
0 Kudos
jbrave
Channel Surfer

Re: How can your app know when the screen is done drawing?

Getting roImageCanvas working the way you want is all about timing, putting sleep() statements in various places and experimenting till something works. Also, imagecanvas starts off slow, and then speeds up if you keep drawing to it. You can actually have multiple objects moving around the screen and get some almost "sprite" like effects and but have no luck getting a single object to do what you want. In short its is a mystery and you can find things that work by experimenting. In the time it takes to draw one object, hundreds or thousands of brightscript statements can have executed, so you might as well draw a pile of objects. As some of the threads have discussed, you can draw faster if you section an image into little chunks and draw each chunk to a separate layer.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.