ishish1
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020
05:53 AM
Using ifDraw2D with SceneGraph
I would like to draw some more complex objects on my Roku channel. I have been using SceneGraph for everything but would like to utilize ifDraw2D functions in order to draw shapes, etc. What is the best way to do so? When I create my channel I use
screen = CreateObject("roSGScreen")
Do I just save a reference to this when I need to draw to the screen? I assume this means that I can't draw from component code and there is no way for the drawn pixels to be "contained" by a SceneGraph node correct?
2 REPLIES 2
necrotek
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020
07:33 AM
Re: Using ifDraw2D with SceneGraph
Start a task in scengraph , set up a roBitmap and draw what you need. use getPng(..) and save the result to device filesystem. use that path for a poster image in scenegraph.
Function SaveTestPng() w = 200 : h = 100 bm = CreateObject("roBitmap", {width: w, height: h, AlphaEnable: true}) bm.DrawRect(10, 10, w-20, h-20, &hFF0000FF) bm.Finish() ba = bm.GetPng(0, 0, w, h) ba.WriteFile("tmp:/test.png") End Function

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020
06:26 PM
Re: Using ifDraw2D with SceneGraph
This is code snippet gold, thank you!