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: 
Pete1995
Channel Surfer

Bug: Bitmap not updating. Tracker ID: 09-016-985

Scenario:
Draw into a bitmap, get it's content and it's all zeros.


Troubleshooting performed:
Wrote included sample code printing zero'ed byteArray after calling Finish()
and then printing rendered content after SwapBuffers().


Issue ID/Serial number/Software version and build:
Tracker ID: 09-016-985
S/N: YG0024242509
OS Version: 14.1.4 Build: 7709-51


Channel software version, if applicable:
N/A - app not yet submitted


Anything else we should know?:
By definition, Finish() should triger any batched draw ops. In practice,
GetByteArray() should also trigger updating.
Why? Because I'm post-processing the bitmap content and, since you won't
allow me to write into the bitmap, I have to read it out, process it and
then load it back in again as a file. *sigh*
Also, and I'll swear I tried this: Loaded the app via vscode. It fails.
Run it again via remote as a chennel. It succeeds. Try it again. It succeeds.
Run some other channel and then re-run the channel and it fails again! Thinking
about that scenario gives me a headache.

 

Sub Main()
pixWidth = 10
bytesPerPix = 4
bytesPerRow = (pixWidth * bytesPerPix)
printRow = 3
screen = CreateObject("roScreen", true)

bm = CreateObject("roBitmap", {width:pixWidth, height:10, AlphaEnable:true, name:"test"})
bm.clear( &h808080FF)
bm.DrawRect( 2, 2, 6, 6, &hFFFFFFFF)
bm.Finish()
ba = bm.GetByteArray( 0, 0, pixWidth, 10)
ba[ (printRow * bytesPerRow) + (4 * bytesPerPix)] = &hFF

' Set index to start of 4th row. Setup to read a line of 10 pixels
indx = printRow * (pixWidth * bytesPerPix)

print "i"; TAB(16)"Red";TAB(22)"Grn";TAB(28)"Blu";TAB(34)"Alp"
for i = 0 to (pixWidth-1)
r = ba[indx ] : g = ba[indx+1] : b = ba[indx+2] : a = ba[indx+3]
print indx; TAB(16)r;TAB(22)g;TAB(28)b;TAB(34)a
indx += 4
endfor

screen.DrawObject( 0, 0, bm)
screen.SwapBuffers()
sleep(5000)
 
ba = bm.GetByteArray( 0, 0, pixWidth, 10)
print "i"; TAB(16)"Red";TAB(22)"Grn";TAB(28)"Blu";TAB(34)"Alp"
for i = 0 to (pixWidth-1)
r = ba[indx ] : g = ba[indx+1] : b = ba[indx+2] : a = ba[indx+3]
print indx; TAB(16)r;TAB(22)g;TAB(28)b;TAB(34)a
indx += 4
endfor
 
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.