Ugh. Is my math (and logic) right?
#11
Hey, thanks for the help!

I wound up going back to the approach in the OP.  For the moment.  I'm on the fence.

All of this to put together an "RgbaLine" statement.

https://www.reddit.com/r/BASICAnywhereMa...the_works/
Reply
#12
"Problem solved with a little security (last two lines added to bLine):"

I think if you subst in the first and last i to the pset values you will see the first and last point on line are already covered. Also if you want lines with transparencies doubling on first and last will show the color more like doing a circle fill with circles using alpha colors.

Try the 2 versions using alpha and see.
Code: (Select All)
Screen _NewImage(800, 600, 32)
Color &H30FFFFFF
For x = 1 To 20
cLine x + 100, 10, x + 100, 500
bLine x + 200, 10, x + 200, 500
Next

Sub cLine (x1, y1, x2, y2)
dx = x2 - x1
dy = y2 - y1
dist = Sqr(dx * dx + dy * dy)
dx = dx / dist
dy = dy / dist
For i = 0 To dist
PSet (x1 + dx * i, y1 + dy * i)
Next
PSet (x1, y1)
PSet (x2, y2)
End Sub

Sub bLine (x1, y1, x2, y2)
dx = x2 - x1
dy = y2 - y1
dist = Sqr(dx * dx + dy * dy)
dx = dx / dist
dy = dy / dist
For i = 0 To dist
PSet (x1 + dx * i, y1 + dy * i)
Next
End Sub
b = b + ...
Reply




Users browsing this thread: 1 Guest(s)