Page 1 of 1

What does StartVectorDrawing() return?

Posted: Fri Dec 06, 2024 3:58 pm
by Justin
I think in MaxOS is a CGContext, in linux a cairo context maybe?
And in windows i thought it was a graphics object, but all gdiplus commands fail with that value, what is it?, it can be used?

Re: What does StartVectorDrawing() return?

Posted: Sat Dec 07, 2024 1:05 pm
by breeze4me
When I checked it before, it looked like an internal memory structure address.
It seems that the graphics object can be obtained as shown below.
However, it's an internal thing and could change at any time.

Code: Select all

Prototype.l ptGdipGraphicsClear(*graphics, color.l)

If OpenLibrary(0, "gdiplus.dll")
  GdipGraphicsClear.ptGdipGraphicsClear = GetFunction(0, "GdipGraphicsClear")
EndIf

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  CanvasGadget(0, 0, 0, 400, 200)
  
  a =  StartVectorDrawing(CanvasVectorOutput(0))
  If a
    *graphics = PeekI(a)
    
    MovePathCursor(40, 20)
    For i = 1 To 4
      AddPathLine(80, 0, #PB_Path_Relative)
      AddPathLine(0, 40, #PB_Path_Relative)
    Next i
    
    VectorSourceColor(RGBA(255, 0, 0, 255))
    DashPath(5, 15)
    
    GdipGraphicsClear(*graphics, $FF0000FF)
    
    StopVectorDrawing()
  EndIf
  
  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

CloseLibrary(#PB_All)

Re: What does StartVectorDrawing() return?

Posted: Sat Dec 07, 2024 4:53 pm
by Justin
Interesting, many thanks!