I've tried FillVectorOutput(), but that doesn't work if you're trying to wipe clean an image back to it's transparent state.
Any help is appreciated.
Code: Select all
EnableExplicit
Declare UpdateMouse(ImageHandle.l, MouseX.l, MouseY.l)
Define.l Event
Define.l Image
Global.l Font
Global.l WinH = 600
Global.l WinW = 800
Font = LoadFont(#PB_Any, "Arial", 14)
If OpenWindow(0, 0, 0, WinW, WinH, "Vector Drawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, WinW, WinH)
Image = CreateImage(#PB_Any, WinW, WinH, 32, #PB_Image_Transparent)
Repeat
Event = WaitWindowEvent(32)
UpdateMouse(Image, WindowMouseX(0), WindowMouseY(0))
Until Event = #PB_Event_CloseWindow
EndIf
Procedure UpdateMouse(ImageHandle.l, MouseX.l, MouseY.l)
;Update Image With New Mouse Coordinates.
StartVectorDrawing(ImageVectorOutput(ImageHandle))
;####
;Doesn't work for clearing the image back to it's original transparency.
;VectorSourceColor(RGBA(0,0,0,0))
;FillVectorOutput()
;####
VectorSourceColor(RGBA(255,128,0,255))
VectorFont(FontID(Font), 50)
MovePathCursor(20, 20)
DrawVectorText("MX: " + Str(MouseX) + " MY: " + Str(MouseY))
StopVectorDrawing()
;Draw To Canvas.
StartDrawing(CanvasOutput(0))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0, 0, WinW, WinH, RGBA(40,50,60,255))
DrawAlphaImage(ImageID(ImageHandle), 0, 0)
StopDrawing()
EndProcedure