Vector drawing roundbox? [Answered]
Posted: Fri Nov 04, 2016 3:15 pm
Hi all
Is there an equivalent to the 2d drawing roundbox.
I have am using some code to give me a round box written by another forum member. All good until you want to use a colour with some transparency as shown. you get the round box but you also get another box inside i think it is because you are drawing it twice and the alphas add together. I have tried setting the source colour to fully transparent for the strokepath command but the corners are then not shown.
any help welcome
regards
collectordave
Is there an equivalent to the 2d drawing roundbox.
I have am using some code to give me a round box written by another forum member. All good until you want to use a colour with some transparency as shown. you get the round box but you also get another box inside i think it is because you are drawing it twice and the alphas add together. I have tried setting the source colour to fully transparent for the strokepath command but the corners are then not shown.
any help welcome
Code: Select all
If OpenWindow(0, 0, 0, 400, 300, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 300)
If StartVectorDrawing(CanvasVectorOutput(0))
vLW = 30; line width (bigger width = bigger radius)
vLW2= vLW * 0.5; half line width
;Fill this with round corners?
MovePathCursor(20 + vLW2, 20 + vLW2)
AddPathLine (100 - vLW2, 20 + vLW2)
AddPathLine (100 - vLW2, 100 - vLW2)
AddPathLine (20 + vLW2, 100 - vLW2)
ClosePath ()
VectorSourceColor(RGBA(0, 0, 255, 100))
FillPath(#PB_Path_Preserve)
;VectorSourceColor(RGBA(0, 0, 255, 0)) ;fully transparent
StrokePath(vLW, #PB_Path_RoundCorner)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
collectordave