Thanks for your response! ( ... and for not being too brutal about my "ps" skills )
No editing this time. That is the unedited screen cap.
Left 4 Tris = alpha off, Right 4 Tris = alpha on
Of each 2 Triangle "group":* Left Triangle is using drawLine()
* Right Triangle is using drawRect()
source\drawLine-bug.brs:
function Main()
? "drawLine Bug"
scr = CreateObject("roScreen", true, 1280, 720) ' double buffer
if type(scr) <> "roScreen" then
? "Unable to create roScreen."
STOP ' stop exits to the debugger
end if
GetGlobalAA().scr = scr
msgport = CreateObject("roMessagePort")
scr.SetPort(msgport)
font_registry = CreateObject("roFontRegistry")
f = font_registry.GetDefaultFont(25, false, false)
black = &h0FF
white = &hFFFFFFFF
' clear both screen buffers
scr.clear(black) ' RGBA, but A is ignored
scr.swapbuffers() ' on background planes
scr.clear(black)
scr.swapbuffers()
' draw*FT(v1x, v1y, v2x, v2y, v3x, v3y, color)
drawTFT( 50, 50, 350, 50, 200, 650, &h00FF0042)
drawBFT(475, 50, 325, 650, 625, 650, &h00FF0042)
scr.SetAlphaEnable(true)
' draw*FT( v1x, v1y, v2x, v2y, v3x, v3y, color)
drawTFT( 600, 50, 900, 50, 750, 650, &h00FF0042)
drawBFT(1025, 50, 875, 650, 1175, 650, &h00FF0042)
scr.DrawText("Press a button to continue", 100, 610, white, f)
scr.swapbuffers()
while true
msg=wait(0, msgport) ' wait(0 == wait forever
' ? "hi"
if type(msg)="roUniversalControlEvent" then exit while
end while
end function
' fillBottomFlatTriangle
Sub drawBFT(v1x, v1y, v2x, v2y, v3x, v3y, clr%)
scr = GetGlobalAA().scr
if v2y = v1y then return
if v3y = v1y then return
invslope1 = (v2x - v1x) / (v2y - v1y)
invslope2 = (v3x - v1x) / (v3y - v1y)
curx1 = v1x
curx2 = v1x
' for (scanlineY = v1y; scanlineY <= v2y; scanlineY++)
for scanlineY = FIX(v1y) TO FIX(v2y) ' +1
scr.drawLine(curx1, scanlineY, curx2, scanlineY, clr%)
scr.drawRect(curx1+100, scanlineY, curx2-curx1, 1, clr%)
curx1 = curx1 + invslope1
curx2 = curx2 + invslope2
end for
end sub
REM ' fillTopFlatTriangle
Sub drawTFT(v1x, v1y, v2x, v2y, v3x, v3y, clr%)
scr = GetGlobalAA().scr
if v3y = v1y then return
if v3y = v2y then return
invslope1 = (v3x - v1x) / (v3y - v1y)
invslope2 = (v3x - v2x) / (v3y - v2y)
curx1 = v3x
curx2 = v3x
' for (scanlineY = v3y; scanlineY > v1y; scanlineY--)
for scanlineY = FIX(v3y) TO FIX(v1y+1) STEP -1
curx1 = curx1 - invslope1
curx2 = curx2 - invslope2
scr.drawLine(curx1, scanlineY, curx2, scanlineY, clr%)
scr.drawRect(curx1+100, scanlineY, curx2-curx1, 1, clr%)
end for
End Sub
manifest:
title=drawLine() Bug?
subtitle=Possible Alpha bug in horizontal drawLine()
You bring up many Q's that I have and gave me more! Could it be my TV? Can of worms going there? After some thought I believe the answer is "No!" because of the screen capture, right? The Screen Capture bypasses anything the TV is doing and pulls the image directly from the Roku itself, correct?
Roku stats: Roku 2, Model number 3100X, SW ver 5.5 * build 410
HDTV Running in 1980x1080 with Roku set to "1080p HDTV" and the call:
scr = CreateObject("roScreen", true, 1280, 720) ' double buffer
... problem persists with Roku set to "480p"
... problem persists with Roku set to "16:9"
... problem persists with Roku set to "720p"
I did my best to cycle all HTDV "picture sizes" As in Normal, 16:9, Movie expand, Zoom, Wide, Full
Where's the Roku dump? ( Off topic, but are there any memory usage / available memory functions? )
The whole by-reference / by-value is a discussion I very much need, but another thread. Another time. FWIW, I ported the pseudo code from the blog post as I totally missed the link to his code. I ported it to javascript first and then to Roku and in both ports I had a hard time trying to get the Swap( ) function to work. [Note: I took that out in this test so it is not a factor at all.]
peace & 84 lines of code
😄