Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 9

Re: Help me clear my canvas layers!

"jfb_mdialog" wrote:
However, I'm also trying to put something on top of the scrubber (using a z-index higher than that of the scrubber_layer), and while I can put that up, I can't make it go away. In addition, I can't get the correct solution to work -- painting the scrubber (a ~50ms operation) once into a background (negative z-index) layer and then swapping it with a visible layer as requested. If I create a negative z-index layer (calling setLayer(negative_index, some_content)), I can't summon that layer forward.

I've never worked with negative z-index, but why not just do a SetLayer with the content, instead of trying to swap existing layers?

"jfb_mdialog" wrote:
I'm seeing inconsistent or missing documentation on how to manage layers; for instance, nowhere is it defined which if any layer the video is playing on;

Video isn't playing on any layer. It's behind the image canvas.

"jfb_mdialog" wrote:
nowhere is it made explicit that layer 0 is privileged;

I wasn't aware that this was the case. Privileged in what way? I know RokuJoel mentioned trouble with ClearLayer and 0, but I've never experienced any issues with it.

"jfb_mdialog" wrote:
and nowhere is it explained what layer swapping entails (e.g., is it commutative?).

It should behave the same as clearing the two layers and replacing them with the others' content. Think of it as a stack of paper or tranparencies. Swapping two layers should react the same way.

"jfb_mdialog" wrote:
How do I make a layer transparent?

The whole layer, or a portion of the layer? CompositionMode should be set to "Source_Over" if you want it to alpha blend with the layer below. If you want the whole layer transparent, then ClearLayer.

"jfb_mdialog" wrote:
Is the color specification RGBA or ARGB?

ARGB for the image canvas. If only three bytes are specified, then RGB with an assumed FF alpha.

"jfb_mdialog" wrote:
What about gaps (setLayer(3, content), setLayer(5, othercontent) yields ... ?)?

No different than "setLayer(3, content), setLayer(4, othercontent)", except that with gaps, you have the ability to insert layers in between. I'll typically number my layers in 10s or 100s, just so I don't have to re-number anything if I need to add a new layer in between at some point.
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
Level 7

Re: Help me clear my canvas layers!

"TheEndless" wrote:
"jfb_mdialog" wrote:
However, I'm also trying to put something on top of the scrubber (using a z-index higher than that of the scrubber_layer), and while I can put that up, I can't make it go away. In addition, I can't get the correct solution to work -- painting the scrubber (a ~50ms operation) once into a background (negative z-index) layer and then swapping it with a visible layer as requested. If I create a negative z-index layer (calling setLayer(negative_index, some_content)), I can't summon that layer forward.

I've never worked with negative z-index, but why not just do a SetLayer with the content, instead of trying to swap existing layers?

It takes about ~50ms to paint the controls; that's something like wo frames of video, and it's perceptible latency.


"jfb_mdialog" wrote:
What about gaps (setLayer(3, content), setLayer(5, othercontent) yields ... ?)?

No different than "setLayer(3, content), setLayer(4, othercontent)", except that with gaps, you have the ability to insert layers in between. I'll typically number my layers in 10s or 100s, just so I don't have to re-number anything if I need to add a new layer in between at some point.

Cool, thanks.

This helps a lot. Appreciated.
0 Kudos
Roku Employee
Roku Employee

Re: Help me clear my canvas layers!

Using ImageCanvas is almost guaranteed to create a slow, sub-par user experience, I would highly recommend switching to roScreen with the 2D API's for creating a fast gui on top of video playback.

- Joel
0 Kudos