Forum Discussion

jackhand's avatar
jackhand
Visitor
8 years ago

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  |
--------
   \/

10 Replies

  • I've never tried but sounds like a fun challenge πŸ˜„
    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?
  • makes sense; however, what's behind the triangle is a paused video, so I can't use rectangles to match the background.
  • 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.
  • 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?
  • "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.
  • oh!  i get it! just use a bmp of a triangle and change its color as needed, that makes sense now - good idea!
  • "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
  • "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
  • 90 degrees only?  oy (that's pretty lame) good point, so much for that idea.
  • Using a PNG file with white shapes AND using a hexadecimal value within the poster's blendColor attribute is the perfect solution for me. Thanks, Veta!!