Roku Developer Program

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

How to draw a simple triangle

I would like to draw a simple triangle to be used to display when scrubbing the video player. How do I go about creating a triangle?

Actually, I would like to draw a rectangle with a triangle centered on the bottom. The current scrubbing speed will display within the rectangle. I'd like to use vector artwork (instead of a bitmap) since I'd like the scrubbing indicator to be able to change colors.
It will sort of look like the following ASCII art...

--------
|  8x  |
--------
   \/
0 Kudos
10 Replies
joetesta
Level 10

Re: How to draw a simple triangle

I've never tried but sounds like a fun challenge Smiley Very Happy
Here's my proposed solution: 
3 rectangles, 1 is the background, not rotated, the color is the color of your desired triangle. (the black one in the example)
2 other rectangles are colored to match the screen color and placed on top of the first rectangle, rotated by 45 degrees or whatever you want to shape your triangle.
Make sense?
aspiring
0 Kudos
jackhand
Level 7

Re: How to draw a simple triangle

makes sense; however, what's behind the triangle is a paused video, so I can't use rectangles to match the background.
0 Kudos
Veeta
Level 7

Re: How to draw a simple triangle

You can change colors of a Poster with blendColor.  Just use a while color PNG with transparency and use the blendColor to make it any color you wish.
0 Kudos
joetesta
Level 10

Re: How to draw a simple triangle

I don't really understand if blendColor could be used to match the video behind rectangle 1 somehow?  Would rectangle 2 cause only the overlapped portion of rectangle 1 to become transparent to the video?  That would be awesome, that's what you want.
My guess is you'd need to have this triangle and stuff above it on a blended patch so it stands out from the video.  Even if you get the transparent thing to work, how will you know what color to set your widget so that it's not getting lost in the video when they happen to be similar color?
aspiring
0 Kudos
Veeta
Level 7

Re: How to draw a simple triangle

"joetesta" wrote:
I don't really understand if blendColor could be used to match the video behind rectangle 1 somehow?  Would rectangle 2 cause only the overlapped portion of rectangle 1 to become transparent to the video?  That would be awesome, that's what you want.
My guess is you'd need to have this triangle and stuff above it on a blended patch so it stands out from the video.  Even if you get the transparent thing to work, how will you know what color to set your widget so that it's not getting lost in the video when they happen to be similar color?


My suggestion was not in response to your rectangles idea. It was addressing what the original post was trying to achieve. Since it's possible to change the color of a poster bitmap, no vector drawing is necessary.
0 Kudos
joetesta
Level 10

Re: How to draw a simple triangle

oh!  i get it! just use a bmp of a triangle and change its color as needed, that makes sense now - good idea!
aspiring
0 Kudos
Roku Employee
Roku Employee

Re: How to draw a simple triangle

"jackhand" wrote:
Actually, I would like to draw a rectangle with a triangle centered on the bottom. The current scrubbing speed will display within the rectangle. I'd like to use vector artwork (instead of a bitmap) since I'd like the scrubbing indicator to be able to change colors.

You don't need vector graphics for that. How about bitmap with transparencies, to which you may add a layer on top to re-color?
PS. oops, Veeta already answered to that effect
0 Kudos
Roku Employee
Roku Employee

Re: How to draw a simple triangle

"joetesta" wrote:
[...] 2 other rectangles are colored to match the screen color and placed on top of the first rectangle, rotated by 45 degrees or whatever you want to shape your triangle.

i like the thinking! But what if the player does not support arbitrary angle rotation?
Someone may need to check me on that - but if "HD RokuTV" (5xxx), Express (37xx), Roku 1/HD/LT (27xx, 25xx) indeed don't do that - then the above idea will fail on ballpark 2 out of every 5 players, not great
0 Kudos
joetesta
Level 10

Re: How to draw a simple triangle

90 degrees only?  oy (that's pretty lame) good point, so much for that idea.
aspiring
0 Kudos