Page 1 of 1

vector drawing display list

Posted: Wed Oct 01, 2025 9:10 pm
by idle
vector drawing display list, It's currently generic for the vector drawing functions but it's part of the SVG module
use cases.
for instance want to do a vector graphics drawing editor. you can use display lists to do undo and redo
or just want to resize the window and canvas from runtime input
you want to modify the items in the display list at runtime

test by resize window and zoom with mouse wheel

Code: Select all

;Vector drawring display List
;Idle  

Prototype pAddPathArc(x1.d,y1.d,x2.d,y2.d,radius.d,flags=#PB_Path_Default)  
Prototype pAddPathBox(x.d,y.d,w.d,h.d,flags=#PB_Path_Default) 
Prototype pAddPathEllipse(x.d,y.d,Rx.d,ry.d,sa.d=0,ed.d=0,flags=#PB_Path_Default)
Prototype pAddPathLine(x.d,y.d,flags=#PB_Path_Default)
Prototype pAddPathSegments(segments.s,flags=#PB_Path_Default) 
Prototype pAddPathText(text.s) 
Prototype pBeginVectorLayer(alpha=255)
Prototype pClipPath(flags=#PB_Path_Default)
Prototype pClosePath()
Prototype.d pConvertCoordinateX(x.d,y.d,src=#PB_Coordinate_User,target=#PB_Coordinate_Output)
Prototype.d pConvertCoordinateY(x.d,y.d,src=#PB_Coordinate_User,target=#PB_Coordinate_Output)
Prototype pCustomDashPath(w.d,Array dashArray.d(1),flags=#PB_Path_Default,startOffset.d=0)
Prototype pDashPath(w.d,l.d,flags=#PB_Path_Default,startoffset.d=0.0) 
Prototype pDotPath(w.d,dist.d,flags=#PB_Path_Default,startoffset.d=0.0)
Prototype pDrawVectorImage(id,alpha=255,w.d=0.0,h.d=0.0)
Prototype pDrawVectorParagraph(text.s,w.d,h.d,flags=#PB_VectorParagraph_Left)
Prototype pDrawVectorText(Text.s)
Prototype pEndVectorLayer()
Prototype pFillPath(flags=#PB_Path_Default)
Prototype pFillVectorOutput()
Prototype pFlipCoordinatesX(axis.d,system=#PB_Coordinate_User)
Prototype pFlipCoordinatesY(axis.d,system=#PB_Coordinate_User)
Prototype pIsInsidePath(x.d,y.d,system=#PB_Coordinate_User)  
Prototype pIsInsideStroke(x.d, y.d, Width.d,Flags=#PB_Path_Default,System=#PB_Coordinate_User)
Prototype pIsPathEmpty() 
Prototype pMovePathCursor(x.d, y.d,Flags=#PB_Path_Default) 
Prototype.d pPathBoundsHeight()
Prototype.d pPathBoundsWidth()
Prototype.d pPathBoundsX()
Prototype.d pPathBoundsY()
Prototype.d pPathCursorX()
Prototype.d pPathCursorY() 
Prototype.d pPathLength() 
Prototype.d pPathPointAngle(Distance.d)
Prototype.d pPathPointX(Distance.d)
Prototype.d pPathPointY(Distance.d)
Prototype.s pPathSegments()
Prototype pResetCoordinates(system=#PB_Coordinate_User) 
Prototype pResetPath()
Prototype pRestoreVectorState()
Prototype pRotateCoordinates(x.d, y.d,Angle.d,System=#PB_Coordinate_User)
Prototype pSaveVectorState()
Prototype pScaleCoordinates(ScaleX.d, ScaleY.d,System=#PB_Coordinate_User)
Prototype pSkewCoordinates(AngleX.d, AngleY.d,System=#PB_Coordinate_User)
Prototype pStartVectorDrawing(Output)
Prototype pStopVectorDrawing()
Prototype pStrokePath(Width.d,Flags=#PB_Path_Default)
Prototype pTranslateCoordinates(x.d, y.d,System=#PB_Coordinate_User)
Prototype pVectorFont(ID,Size.d=0)
Prototype.d pVectorOutputHeight()
Prototype.d pVectorOutputWidth()
Prototype.d pVectorParagraphHeight(Text$, Width.d, Height.d)
Prototype.d pVectorResolutionX()
Prototype.d pVectorResolutionY()
Prototype pVectorSourceCircularGradient(x.d, y.d, Radius.d,CenterX.d=0.0,CenterY.d=0.0)
Prototype pVectorSourceColor(Color)
Prototype pVectorSourceGradientColor(Color, Position.d)
Prototype pVectorSourceImage(ImageID,Alpha=255,Width.d=0,Height.d=0,Flags=#PB_VectorImage_Default)
Prototype pVectorSourceLinearGradient(x1.d, y1.d, x2.d, y2.d)
Prototype.d pVectorTextHeight(Text$,Flags=#PB_VectorText_Default)
Prototype.d pVectorTextWidth(Text$,Flags=#PB_VectorText_Default)
Prototype.d pVectorUnit()

Prototype func(*parms)

Structure dlparams 
  type.u 
  id.u
  *userdata
EndStructure   
;->>>>Structures 
Structure spAddPathArc 
  params.dlparams
  x1.d : y1.d : x2.d : y2.d : radius.d : flags.i
  *fAddPathArc.func
EndStructure  

Structure spAddPathBox 
  params.dlparams
  x.d : y.d : w.d : h.d : flags.i 
  *fAddPathBox.func  
EndStructure   

Structure spAddPathEllipse
  params.dlparams
  x.d : y.d : Rx.d : ry.d : sa.d : ed.d : flags.i
  *fAddPathEllipse.func
EndStructure

Structure spAddPathLine
  params.dlparams
  x.d : y.d : flags.i
  *fAddPathLine.func
EndStructure

Structure spAddPathSegments
  params.dlparams
  segments.s : flags.i
  *fAddPathSegments.func
EndStructure

Structure spAddPathText
  params.dlparams
  text.s
  *fAddPathText.func
EndStructure

Structure spBeginVectorLayer
  params.dlparams
  alpha.i
  *fBeginVectorLayer.func
EndStructure

Structure spClipPath
  params.dlparams
  flags.i
  *fClipPath.func
EndStructure

Structure spClosePath
  params.dlparams
  *fClosePath.func
EndStructure

Structure spConvertCoordinateX
  params.dlparams
  x.d : y.d : src.i : target.i
  *fConvertCoordinateX.func
EndStructure

Structure spConvertCoordinateY
  params.dlparams
  x.d : y.d : src.i : target.i
  *fConvertCoordinateY.func
EndStructure

Structure spCustomDashPath
  params.dlparams
  w.d
  Array dashArray.d(0)
  flags.i : startOffset.d
  *fCustomDashPath.func
EndStructure

Structure spDashPath
  params.dlparams
  w.d : l.d : flags.i : startoffset.d
  *fDashPath.func
EndStructure

Structure spDotPath
  params.dlparams
  w.d : dist.d : flags.i : startoffset.d
  *fDotPath.func
EndStructure

Structure spDrawVectorImage
  params.dlparams
  id.i : alpha.i : w.d : h.d
  *fDrawVectorImage.func
EndStructure

Structure spDrawVectorParagraph
  params.dlparams
  text.s : w.d : h.d : flags.i
  *fDrawVectorParagraph.func
EndStructure

Structure spDrawVectorText
  params.dlparams
  Text.s
  *fDrawVectorText.func
EndStructure

Structure spEndVectorLayer
  params.dlparams
  *fEndVectorLayer.func
EndStructure

Structure spFillPath
  params.dlparams
  flags.i
  *fFillPath.func
EndStructure

Structure spFillVectorOutput
  params.dlparams
  *fFillVectorOutput.func
EndStructure

Structure spFlipCoordinatesX
  params.dlparams
  axis.d : system.i
  *fFlipCoordinatesX.func
EndStructure

Structure spFlipCoordinatesY
  params.dlparams
  axis.d : system.i
  *fFlipCoordinatesY.func
EndStructure

Structure spIsInsidePath
  params.dlparams
  x.d : y.d : system.i
  *fIsInsidePath.func
EndStructure

Structure spIsInsideStroke
  params.dlparams
  x.d : y.d : Width.d : Flags.i : System.i
  *fIsInsideStroke.func
EndStructure

Structure spIsPathEmpty
  params.dlparams
  *fIsPathEmpty.func
EndStructure

Structure spMovePathCursor
  params.dlparams
  x.d : y.d : Flags.i
  *fMovePathCursor.func
EndStructure

Structure spPathBoundsHeight
  params.dlparams
  *fPathBoundsHeight.func
EndStructure

Structure spPathBoundsWidth
  params.dlparams
  *fPathBoundsWidth.func
EndStructure

Structure spPathBoundsX
  params.dlparams
  *fPathBoundsX.func
EndStructure

Structure spPathBoundsY
  params.dlparams
  *fPathBoundsY.func
EndStructure

Structure spPathCursorX
  params.dlparams
  *fPathCursorX.func
EndStructure

Structure spPathCursorY
  params.dlparams
  *fPathCursorY.func
EndStructure

Structure spPathLength
  params.dlparams
  *fPathLength.func
EndStructure

Structure spPathPointAngle
  params.dlparams
  Distance.d
  *fPathPointAngle.func
EndStructure

Structure spPathPointX
  params.dlparams
  Distance.d
  *fPathPointX.func
EndStructure

Structure spPathPointY
  params.dlparams
  Distance.d
  *fPathPointY.func
EndStructure

Structure spPathSegments
  params.dlparams
  *fPathSegments.func
EndStructure

Structure spResetCoordinates
  params.dlparams
  system.i
  *fResetCoordinates.func
EndStructure

Structure spResetPath
  params.dlparams
  *fResetPath.func
EndStructure

Structure spRestoreVectorState
  params.dlparams
  *fRestoreVectorState.func
EndStructure

Structure spRotateCoordinates
  params.dlparams
  x.d : y.d : Angle.d : System.i
  *fRotateCoordinates.func
EndStructure

Structure spSaveVectorState
  params.dlparams
  *fSaveVectorState.func
EndStructure

Structure spScaleCoordinates
  params.dlparams
  ScaleX.d : ScaleY.d : System.i
  *fScaleCoordinates.func
EndStructure

Structure spSkewCoordinates
  params.dlparams
  AngleX.d : AngleY.d : System.i
  *fSkewCoordinates.func
EndStructure

Structure spStartVectorDrawing
  params.dlparams
  Output.i
  *fStartVectorDrawing.func
EndStructure

Structure spStopVectorDrawing
  params.dlparams
  *fStopVectorDrawing.func
EndStructure

Structure spStrokePath
  params.dlparams
  Width.d : Flags.i
  *fStrokePath.func
EndStructure

Structure spTranslateCoordinates
  params.dlparams
  x.d : y.d : System.i
  *fTranslateCoordinates.func
EndStructure

Structure spVectorFont
  params.dlparams
  ID.i : Size.d
  *fVectorFont.func
EndStructure

Structure spVectorOutputHeight
  params.dlparams
  *fVectorOutputHeight.func
EndStructure

Structure spVectorOutputWidth
  params.dlparams
  *fVectorOutputWidth.func
EndStructure

Structure spVectorParagraphHeight
  params.dlparams
  Text.s : Width.d : Height.d
  *fVectorParagraphHeight.func
EndStructure

Structure spVectorResolutionX
  params.dlparams
  *fVectorResolutionX.func
EndStructure

Structure spVectorResolutionY
  params.dlparams
  *fVectorResolutionY.func
EndStructure

Structure spVectorSourceCircularGradient
  params.dlparams
  x.d : y.d : Radius.d : CenterX.d : CenterY.d
  *fVectorSourceCircularGradient.func
EndStructure

Structure spVectorSourceColor
  params.dlparams
  Color.i
  *fVectorSourceColor.func
EndStructure

Structure spVectorSourceGradientColor
  params.dlparams
  Color.i : Position.d
  *fVectorSourceGradientColor.func
EndStructure

Structure spVectorSourceImage
  params.dlparams
  ImageID.i : Alpha.i : Width.d : Height.d : Flags.i
  *fVectorSourceImage.func
EndStructure

Structure spVectorSourceLinearGradient
  params.dlparams
  x1.d : y1.d : x2.d : y2.d
  *fVectorSourceLinearGradient.func
EndStructure

Structure spVectorTextHeight
  params.dlparams
  Text.s : Flags.i
  *fVectorTextHeight.func
EndStructure

Structure spVectorTextWidth
  params.dlparams
  Text.s : Flags.i
  *fVectorTextWidth.func
EndStructure

Structure spVectorUnit
  params.dlparams
  *fVectorUnit.func
EndStructure

Enumeration 1
  #spAddPathArc 
  #spAddPathBox
  #spAddPathEllipse
  #spAddPathLine
  #spAddPathSegments
  #spAddPathText
  #spBeginVectorLayer
  #spClipPath
  #spClosePath
  #spConvertCoordinateX
  #spConvertCoordinateY
  #spCustomDashPath
  #spDashPath
  #spDotPath
  #spDrawVectorImage
  #spDrawVectorParagraph
  #spDrawVectorText
  #spEndVectorLayer
  #spFillPath
  #spFillVectorOutput
  #spFlipCoordinatesX
  #spFlipCoordinatesY
  #spIsInsidePath
  #spIsInsideStroke
  #spIsPathEmpty
  #spMovePathCursor
  #spPathBoundsHeight
  #spPathBoundsWidth
  #spPathBoundsX
  #spPathBoundsY
  #spPathCursorX
  #spPathCursorY
  #spPathLength
  #spPathPointAngle
  #spPathPointX
  #spPathPointY
  #spPathSegments
  #spResetCoordinates
  #spResetPath
  #spRestoreVectorState
  #spRotateCoordinates
  #spSaveVectorState
  #spScaleCoordinates
  #spSkewCoordinates
  #spStartVectorDrawing
  #spStopVectorDrawing
  #spStrokePath
  #spTranslateCoordinates
  #spVectorFont
  #spVectorOutputHeight
  #spVectorOutputWidth
  #spVectorParagraphHeight
  #spVectorResolutionX
  #spVectorResolutionY
  #spVectorSourceCircularGradient
  #spVectorSourceColor
  #spVectorSourceGradientColor
  #spVectorSourceImage
  #spVectorSourceLinearGradient
  #spVectorTextHeight
  #spVectorTextWidth
  #spVectorUnit
EndEnumeration

;->>>Runtime Procedures 
Procedure RtAddPathArc(*ptr.spAddPathArc) 
  ProcedureReturn AddPathArc(*ptr\x1,*ptr\y1,*ptr\x2,*ptr\y2,*ptr\radius,*ptr\flags)
EndProcedure 

Procedure RtAddPathBox(*ptr.spAddPathBox) 
  ProcedureReturn AddPathBox(*ptr\x,*ptr\y,*ptr\w,*ptr\h,*ptr\flags)
EndProcedure

Procedure RtAddPathEllipse(*ptr.spAddPathEllipse)
  ProcedureReturn AddPathEllipse(*ptr\x,*ptr\y,*ptr\Rx,*ptr\ry,*ptr\sa,*ptr\ed,*ptr\flags)
EndProcedure

Procedure RtAddPathLine(*ptr.spAddPathLine)
  ProcedureReturn AddPathLine(*ptr\x,*ptr\y,*ptr\flags)
EndProcedure

Procedure RtAddPathSegments(*ptr.spAddPathSegments)
  ProcedureReturn AddPathSegments(*ptr\segments,*ptr\flags)
EndProcedure

Procedure RtAddPathText(*ptr.spAddPathText) 
  ProcedureReturn AddPathText(*ptr\text) 
EndProcedure

Procedure RtBeginVectorLayer(*ptr.spBeginVectorLayer)
  ProcedureReturn BeginVectorLayer(*ptr\alpha)
EndProcedure

Procedure RtClipPath(*ptr.spClipPath)
  ProcedureReturn ClipPath(*ptr\flags)
EndProcedure

Procedure RtClosePath(*ptr.spClosePath)
  ProcedureReturn ClosePath()
EndProcedure

Procedure RtConvertCoordinateX(*ptr.spConvertCoordinateX)
  ProcedureReturn ConvertCoordinateX(*ptr\x,*ptr\y,*ptr\src,*ptr\target)
EndProcedure

Procedure RtConvertCoordinateY(*ptr.spConvertCoordinateY)
  ProcedureReturn ConvertCoordinateY(*ptr\x,*ptr\y,*ptr\src,*ptr\target)
EndProcedure

Procedure RtCustomDashPath(*ptr.spCustomDashPath)
  ProcedureReturn CustomDashPath(*ptr\w,*ptr\dashArray(),*ptr\flags,*ptr\startOffset)
EndProcedure

Procedure RtDashPath(*ptr.spDashPath)
  ProcedureReturn DashPath(*ptr\w,*ptr\l,*ptr\flags,*ptr\startoffset)
EndProcedure

Procedure RtDotPath(*ptr.spDotPath)
  ProcedureReturn DotPath(*ptr\w,*ptr\dist,*ptr\flags,*ptr\startoffset)
EndProcedure

Procedure RtDrawVectorImage(*ptr.spDrawVectorImage)
  ProcedureReturn DrawVectorImage(*ptr\id,*ptr\alpha,*ptr\w,*ptr\h)
EndProcedure

Procedure RtDrawVectorParagraph(*ptr.spDrawVectorParagraph)
  ProcedureReturn DrawVectorParagraph(*ptr\text,*ptr\w,*ptr\h,*ptr\flags)
EndProcedure

Procedure RtDrawVectorText(*ptr.spDrawVectorText)
  ProcedureReturn DrawVectorText(*ptr\Text)
EndProcedure

Procedure RtEndVectorLayer(*ptr.spEndVectorLayer)
  ProcedureReturn EndVectorLayer()
EndProcedure

Procedure RtFillPath(*ptr.spFillPath)
  ProcedureReturn FillPath(*ptr\flags)
EndProcedure

Procedure RtFillVectorOutput(*ptr.spFillVectorOutput)
  ProcedureReturn FillVectorOutput()
EndProcedure

Procedure RtFlipCoordinatesX(*ptr.spFlipCoordinatesX)
  ProcedureReturn FlipCoordinatesX(*ptr\axis,*ptr\system)
EndProcedure

Procedure RtFlipCoordinatesY(*ptr.spFlipCoordinatesY)
  ProcedureReturn FlipCoordinatesY(*ptr\axis,*ptr\system)
EndProcedure

Procedure RtIsInsidePath(*ptr.spIsInsidePath)
  ProcedureReturn IsInsidePath(*ptr\x,*ptr\y,*ptr\system)
EndProcedure

Procedure RtIsInsideStroke(*ptr.spIsInsideStroke)
  ProcedureReturn IsInsideStroke(*ptr\x,*ptr\y,*ptr\Width,*ptr\Flags,*ptr\System)
EndProcedure

Procedure RtIsPathEmpty(*ptr.spIsPathEmpty)
  ProcedureReturn IsPathEmpty()
EndProcedure

Procedure RtMovePathCursor(*ptr.spMovePathCursor)
  ProcedureReturn MovePathCursor(*ptr\x,*ptr\y,*ptr\Flags)
EndProcedure

Procedure.d RtPathBoundsHeight(*ptr.spPathBoundsHeight)
  ProcedureReturn PathBoundsHeight()
EndProcedure

Procedure.d RtPathBoundsWidth(*ptr.spPathBoundsWidth)
  ProcedureReturn PathBoundsWidth()
EndProcedure

Procedure.d RtPathBoundsX(*ptr.spPathBoundsX)
  ProcedureReturn PathBoundsX()
EndProcedure

Procedure.d RtPathBoundsY(*ptr.spPathBoundsY)
  ProcedureReturn PathBoundsY()
EndProcedure

Procedure.d RtPathCursorX(*ptr.spPathCursorX)
  ProcedureReturn PathCursorX()
EndProcedure

Procedure.d RtPathCursorY(*ptr.spPathCursorY)
  ProcedureReturn PathCursorY()
EndProcedure

Procedure.d RtPathLength(*ptr.spPathLength)
  ProcedureReturn PathLength()
EndProcedure

Procedure.d RtPathPointAngle(*ptr.spPathPointAngle)
  ProcedureReturn PathPointAngle(*ptr\Distance)
EndProcedure

Procedure.d RtPathPointX(*ptr.spPathPointX)
  ProcedureReturn PathPointX(*ptr\Distance)
EndProcedure

Procedure.d RtPathPointY(*ptr.spPathPointY)
  ProcedureReturn PathPointY(*ptr\Distance)
EndProcedure

Procedure.s RtPathSegments(*ptr.spPathSegments)
  ProcedureReturn PathSegments()
EndProcedure

Procedure RtResetCoordinates(*ptr.spResetCoordinates)
  ProcedureReturn ResetCoordinates(*ptr\system)
EndProcedure

Procedure RtResetPath(*ptr.spResetPath)
  ProcedureReturn ResetPath()
EndProcedure

Procedure RtRestoreVectorState(*ptr.spRestoreVectorState)
  ProcedureReturn RestoreVectorState()
EndProcedure

Procedure RtRotateCoordinates(*ptr.spRotateCoordinates)
  ProcedureReturn RotateCoordinates(*ptr\x,*ptr\y,*ptr\Angle,*ptr\System)
EndProcedure

Procedure RtSaveVectorState(*ptr.spSaveVectorState)
  ProcedureReturn SaveVectorState()
EndProcedure

Procedure RtScaleCoordinates(*ptr.spScaleCoordinates)
  ProcedureReturn ScaleCoordinates(*ptr\ScaleX,*ptr\ScaleY,*ptr\System)
EndProcedure

Procedure RtSkewCoordinates(*ptr.spSkewCoordinates)
  ProcedureReturn SkewCoordinates(*ptr\AngleX,*ptr\AngleY,*ptr\System)
EndProcedure

Procedure RtStartVectorDrawing(*ptr.spStartVectorDrawing)
  ProcedureReturn StartVectorDrawing(*ptr\Output)
EndProcedure

Procedure RtStopVectorDrawing(*ptr.spStopVectorDrawing)
  ProcedureReturn StopVectorDrawing()
EndProcedure

Procedure RtStrokePath(*ptr.spStrokePath)
  ProcedureReturn StrokePath(*ptr\Width,*ptr\Flags)
EndProcedure

Procedure RtTranslateCoordinates(*ptr.spTranslateCoordinates)
  ProcedureReturn TranslateCoordinates(*ptr\x,*ptr\y,*ptr\System)
EndProcedure

Procedure RtVectorFont(*ptr.spVectorFont)
  ProcedureReturn VectorFont(*ptr\ID,*ptr\Size)
EndProcedure

Procedure.d RtVectorOutputHeight(*ptr.spVectorOutputHeight)
  ProcedureReturn VectorOutputHeight()
EndProcedure

Procedure.d RtVectorOutputWidth(*ptr.spVectorOutputWidth)
  ProcedureReturn VectorOutputWidth()
EndProcedure

Procedure.d RtVectorParagraphHeight(*ptr.spVectorParagraphHeight)
  ProcedureReturn VectorParagraphHeight(*ptr\Text,*ptr\Width,*ptr\Height)
EndProcedure

Procedure.d RtVectorResolutionX(*ptr.spVectorResolutionX)
  ProcedureReturn VectorResolutionX()
EndProcedure

Procedure.d RtVectorResolutionY(*ptr.spVectorResolutionY)
  ProcedureReturn VectorResolutionY()
EndProcedure

Procedure RtVectorSourceCircularGradient(*ptr.spVectorSourceCircularGradient)
  ProcedureReturn VectorSourceCircularGradient(*ptr\x,*ptr\y,*ptr\Radius,*ptr\CenterX,*ptr\CenterY)
EndProcedure

Procedure RtVectorSourceColor(*ptr.spVectorSourceColor)
  ProcedureReturn VectorSourceColor(*ptr\Color)
EndProcedure

Procedure RtVectorSourceGradientColor(*ptr.spVectorSourceGradientColor)
  ProcedureReturn VectorSourceGradientColor(*ptr\Color,*ptr\Position)
EndProcedure

Procedure RtVectorSourceImage(*ptr.spVectorSourceImage)
  ProcedureReturn VectorSourceImage(*ptr\ImageID,*ptr\Alpha,*ptr\Width,*ptr\Height,*ptr\Flags)
EndProcedure

Procedure RtVectorSourceLinearGradient(*ptr.spVectorSourceLinearGradient)
  ProcedureReturn VectorSourceLinearGradient(*ptr\x1,*ptr\y1,*ptr\x2,*ptr\y2)
EndProcedure

Procedure.d RtVectorTextHeight(*ptr.spVectorTextHeight)
  ProcedureReturn VectorTextHeight(*ptr\Text,*ptr\Flags)
EndProcedure

Procedure.d RtVectorTextWidth(*ptr.spVectorTextWidth)
  ProcedureReturn VectorTextWidth(*ptr\Text,*ptr\Flags)
EndProcedure

Procedure.d RtVectorUnit(*ptr.spVectorUnit)
  ProcedureReturn VectorUnit()
EndProcedure

;->>>Display List Structure
Structure dlp
  StructureUnion
    *item.dlparams 
    *ptAddPathArc.spAddPathArc
    *ptAddPathBox.spAddPathBox
    *ptAddPathEllipse.spAddPathEllipse
    *ptAddPathLine.spAddPathLine
    *ptAddPathSegments.spAddPathSegments
    *ptAddPathText.spAddPathText
    *ptBeginVectorLayer.spBeginVectorLayer
    *ptClipPath.spClipPath
    *ptClosePath.spClosePath
    *ptConvertCoordinateX.spConvertCoordinateX
    *ptConvertCoordinateY.spConvertCoordinateY
    *ptCustomDashPath.spCustomDashPath
    *ptDashPath.spDashPath
    *ptDotPath.spDotPath
    *ptDrawVectorImage.spDrawVectorImage
    *ptDrawVectorParagraph.spDrawVectorParagraph
    *ptDrawVectorText.spDrawVectorText
    *ptEndVectorLayer.spEndVectorLayer
    *ptFillPath.spFillPath
    *ptFillVectorOutput.spFillVectorOutput
    *ptFlipCoordinatesX.spFlipCoordinatesX
    *ptFlipCoordinatesY.spFlipCoordinatesY
    *ptIsInsidePath.spIsInsidePath
    *ptIsInsideStroke.spIsInsideStroke
    *ptIsPathEmpty.spIsPathEmpty
    *ptMovePathCursor.spMovePathCursor
    *ptPathBoundsHeight.spPathBoundsHeight
    *ptPathBoundsWidth.spPathBoundsWidth
    *ptPathBoundsX.spPathBoundsX
    *ptPathBoundsY.spPathBoundsY
    *ptPathCursorX.spPathCursorX
    *ptPathCursorY.spPathCursorY
    *ptPathLength.spPathLength
    *ptPathPointAngle.spPathPointAngle
    *ptPathPointX.spPathPointX
    *ptPathPointY.spPathPointY
    *ptPathSegments.spPathSegments
    *ptResetCoordinates.spResetCoordinates
    *ptResetPath.spResetPath
    *ptRestoreVectorState.spRestoreVectorState
    *ptRotateCoordinates.spRotateCoordinates
    *ptSaveVectorState.spSaveVectorState
    *ptScaleCoordinates.spScaleCoordinates
    *ptSkewCoordinates.spSkewCoordinates
    *ptStartVectorDrawing.spStartVectorDrawing
    *ptStopVectorDrawing.spStopVectorDrawing
    *ptStrokePath.spStrokePath
    *ptTranslateCoordinates.spTranslateCoordinates
    *ptVectorFont.spVectorFont
    *ptVectorOutputHeight.spVectorOutputHeight
    *ptVectorOutputWidth.spVectorOutputWidth
    *ptVectorParagraphHeight.spVectorParagraphHeight
    *ptVectorResolutionX.spVectorResolutionX
    *ptVectorResolutionY.spVectorResolutionY
    *ptVectorSourceCircularGradient.spVectorSourceCircularGradient
    *ptVectorSourceColor.spVectorSourceColor
    *ptVectorSourceGradientColor.spVectorSourceGradientColor
    *ptVectorSourceImage.spVectorSourceImage
    *ptVectorSourceLinearGradient.spVectorSourceLinearGradient
    *ptVectorTextHeight.spVectorTextHeight
    *ptVectorTextWidth.spVectorTextWidth
    *ptVectorUnit.spVectorUnit
  EndStructureUnion  
  *func.func 
EndStructure 

CompilerIf #PB_Compiler_IsMainFile 
  
  Structure SVG 
    List dl.dlp()   
  EndStructure 
  
CompilerEndIf 

;->>>Macros 
Procedure SVGAddPathArc(*svg.svg,x1.d,y1.d,x2.d,y2.d,radius.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  AddPathArc(x1,y1,x2,y2,radius,flags) 
  
  AddElement(*svg\dl()) 
  *svg\dl()\ptAddPathArc = AllocateStructure(spAddPathArc) 
  *svg\dl()\ptAddPathArc\x1 = x1 
  *svg\dl()\ptAddPathArc\y1 = y1 
  *svg\dl()\ptAddPathArc\x2 = x2 
  *svg\dl()\ptAddPathArc\y2 = y2 
  *svg\dl()\ptAddPathArc\radius = radius 
  *svg\dl()\ptAddPathArc\flags = flags 
  *svg\dl()\func = @RtAddPathArc() 
  
  *svg\dl()\ptAddPathArc\params\id = id
  *svg\dl()\ptAddPathArc\params\userdata = *userdata 
  *svg\dl()\ptAddPathArc\params\type = #spAddPathArc
  
EndProcedure

Procedure SVGAddPathBox(*svg.svg,x.d,y.d,w.d,h.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  AddPathBox(x,y,w,h,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptAddPathBox = AllocateStructure(spAddPathBox) 
  *svg\dl()\ptAddPathBox\x = x 
  *svg\dl()\ptAddPathBox\y = y 
  *svg\dl()\ptAddPathBox\w = w 
  *svg\dl()\ptAddPathBox\h = h 
  *svg\dl()\ptAddPathBox\flags = flags 
  *svg\dl()\func = @RtAddPathBox()  
  
  *svg\dl()\ptAddPathBox\params\id = id
  *svg\dl()\ptAddPathBox\params\userdata = *userdata 
  *svg\dl()\ptAddPathBox\params\type = #spAddPathBox
  
EndProcedure 

Procedure SVGAddPathEllipse(*svg.svg,x.d,y.d,Rx.d,ry.d,sa.d,ed.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  AddPathEllipse(x,y,Rx,ry,sa,ed,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptAddPathEllipse = AllocateStructure(spAddPathEllipse)
  *svg\dl()\ptAddPathEllipse\x = x
  *svg\dl()\ptAddPathEllipse\y = y
  *svg\dl()\ptAddPathEllipse\Rx = Rx
  *svg\dl()\ptAddPathEllipse\ry = ry
  *svg\dl()\ptAddPathEllipse\sa = sa
  *svg\dl()\ptAddPathEllipse\ed = ed
  *svg\dl()\ptAddPathEllipse\flags = flags
  *svg\dl()\func = @RtAddPathEllipse()
  
  *svg\dl()\ptAddPathEllipse\params\id = id
  *svg\dl()\ptAddPathEllipse\params\userdata = *userdata 
  *svg\dl()\ptAddPathEllipse\params\type = #spAddPathEllipse
  
EndProcedure 

Procedure SVGAddPathLine(*svg.svg,x.d,y.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  AddPathLine(x,y,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptAddPathLine = AllocateStructure(spAddPathLine)
  *svg\dl()\ptAddPathLine\x = x
  *svg\dl()\ptAddPathLine\y = y
  *svg\dl()\ptAddPathLine\flags = flags
  *svg\dl()\func = @RtAddPathLine() 
  
  *svg\dl()\ptAddPathLine\params\id = id
  *svg\dl()\ptAddPathLine\params\userdata = *userdata 
  *svg\dl()\ptAddPathLine\params\type = #spAddPathLine
  
EndProcedure

Procedure SVGAddPathSegments(*svg.svg,segments.s,flags=#PB_Path_Default,id=0,*userdata=0)
  
  AddPathSegments(segments,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptAddPathSegments = AllocateStructure(spAddPathSegments)
  *svg\dl()\ptAddPathSegments\segments = segments
  *svg\dl()\ptAddPathSegments\flags = flags
  *svg\dl()\func = @RtAddPathSegments() 
  
  *svg\dl()\ptAddPathSegments\params\id = id
  *svg\dl()\ptAddPathSegments\params\userdata = *userdata 
  *svg\dl()\ptAddPathSegments\params\type = #spAddPathSegments
  
EndProcedure

Procedure SVGAddPathText(*svg.svg,text.s,id=0,*userdata=0) 
  
  AddPathText(text) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptAddPathText = AllocateStructure(spAddPathText) 
  *svg\dl()\ptAddPathText\text = text
  *svg\dl()\func = @RtAddPathText()
  
  *svg\dl()\ptAddPathText\params\id = id
  *svg\dl()\ptAddPathText\params\userdata = *userdata 
  *svg\dl()\ptAddPathText\params\type = #spAddPathText
  
EndProcedure

Procedure SVGBeginVectorLayer(*svg.svg,alpha=255,id=0,*userdata=0)
  
  BeginVectorLayer(alpha)
  
  AddElement(*svg\dl())
  *svg\dl()\ptBeginVectorLayer = AllocateStructure(spBeginVectorLayer)
  *svg\dl()\ptBeginVectorLayer\alpha = alpha
  *svg\dl()\func = @RtBeginVectorLayer()
  
  *svg\dl()\ptBeginVectorLayer\params\id = id
  *svg\dl()\ptBeginVectorLayer\params\userdata = *userdata 
  *svg\dl()\ptBeginVectorLayer\params\type = #spBeginVectorLayer
  
EndProcedure

Procedure SVGClipPath(*svg.svg,flags=#PB_Path_Default,id=0,*userdata=0)
  
  ClipPath(flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptClipPath = AllocateStructure(spClipPath)
  *svg\dl()\ptClipPath\flags = flags
  *svg\dl()\func = @RtClipPath()
  
  *svg\dl()\ptClipPath\params\id = id
  *svg\dl()\ptClipPath\params\userdata = *userdata 
  *svg\dl()\ptClipPath\params\type = #spClipPath
  
EndProcedure

Procedure SVGClosePath(*svg.svg,id=0,*userdata=0)
  
  ClosePath()
  
  AddElement(*svg\dl())
  *svg\dl()\ptClosePath = AllocateStructure(spClosePath)
  *svg\dl()\func = @RtClosePath()
  
  *svg\dl()\ptClosePath\params\id = id
  *svg\dl()\ptClosePath\params\userdata = *userdata 
  *svg\dl()\ptClosePath\params\type = #spClosePath
  
EndProcedure

Procedure SVGConvertCoordinateX(*svg.svg,x.d,y.d,src=0,target=#PB_Coordinate_User,id=0,*userdata=0)
  
  ConvertCoordinateX(x,y,src,target)
  
  AddElement(*svg\dl())
  *svg\dl()\ptConvertCoordinateX = AllocateStructure(spConvertCoordinateX)
  *svg\dl()\ptConvertCoordinateX\x = x
  *svg\dl()\ptConvertCoordinateX\y = y
  *svg\dl()\ptConvertCoordinateX\src = src
  *svg\dl()\ptConvertCoordinateX\target = target
  *svg\dl()\func = @RtConvertCoordinateX()
  
  *svg\dl()\ptConvertCoordinateX\params\id = id
  *svg\dl()\ptConvertCoordinateX\params\userdata = *userdata 
  *svg\dl()\ptConvertCoordinateX\params\type = #spConvertCoordinateX
  
EndProcedure 

Procedure SVGConvertCoordinateY(*svg.svg,x.d,y.d,src=0,target=#PB_Coordinate_User,id=0,*userdata=0)
  
  ConvertCoordinateY(x,y,src,target)
  
  AddElement(*svg\dl())
  *svg\dl()\ptConvertCoordinateY = AllocateStructure(spConvertCoordinateY)
  *svg\dl()\ptConvertCoordinateY\x = x
  *svg\dl()\ptConvertCoordinateY\y = y
  *svg\dl()\ptConvertCoordinateY\src = src
  *svg\dl()\ptConvertCoordinateY\target = target
  *svg\dl()\func = @RtConvertCoordinateY()
  
  *svg\dl()\ptConvertCoordinateY\params\id = id
  *svg\dl()\ptConvertCoordinateY\params\userdata = *userdata 
  *svg\dl()\ptConvertCoordinateY\params\type = #spConvertCoordinateY
  
EndProcedure 

Procedure SVGDashPath(*svg.svg,w.d,l.d,flags=0,startoffset=#PB_Path_Default,id=0,*userdata=0)
  
  DashPath(w,l,flags,startoffset)
  
  AddElement(*svg\dl())
  *svg\dl()\ptDashPath = AllocateStructure(spDashPath)
  *svg\dl()\ptDashPath\w = w
  *svg\dl()\ptDashPath\l = l
  *svg\dl()\ptDashPath\flags = flags
  *svg\dl()\ptDashPath\startoffset = startoffset
  *svg\dl()\func = @RtDashPath()
  
  *svg\dl()\ptDashPath\params\id = id
  *svg\dl()\ptDashPath\params\userdata = *userdata 
  *svg\dl()\ptDashPath\params\type = #spDashPath
  
EndProcedure

Procedure SVGDotPath(*svg.svg,w.d,dist.d,flags=0,startoffset=#PB_Coordinate_User,id=0,*userdata=0)
  
  DotPath(w,dist,flags,startoffset)
  
  AddElement(*svg\dl())
  *svg\dl()\ptDotPath = AllocateStructure(spDotPath)
  *svg\dl()\ptDotPath\w = w
  *svg\dl()\ptDotPath\dist = dist
  *svg\dl()\ptDotPath\flags = flags
  *svg\dl()\ptDotPath\startoffset = startoffset
  *svg\dl()\func = @RtDotPath()
  
  *svg\dl()\ptDotPath\params\id = id
  *svg\dl()\ptDotPath\params\userdata = *userdata 
  *svg\dl()\ptDotPath\params\type = #spDotPath
  
EndProcedure

Procedure SVGDrawVectorImage(*svg.svg,imageId,alpha=255,w.d=0,h.d=0,id=0,*userdata=0)
  
  DrawVectorImage(imageId,alpha,w,h)
  
  AddElement(*svg\dl())
  *svg\dl()\ptDrawVectorImage = AllocateStructure(spDrawVectorImage)
  *svg\dl()\ptDrawVectorImage\id = imageId
  *svg\dl()\ptDrawVectorImage\alpha = alpha
  *svg\dl()\ptDrawVectorImage\w = w
  *svg\dl()\ptDrawVectorImage\h = h
  *svg\dl()\func = @RtDrawVectorImage()
  
  *svg\dl()\ptDrawVectorImage\params\id = id
  *svg\dl()\ptDrawVectorImage\params\userdata = *userdata 
  *svg\dl()\ptDrawVectorImage\params\type = #spDrawVectorImage
  
EndProcedure

Procedure SVGDrawVectorParagraph(*svg.svg,text.s,w.d,h.d,flags=#PB_VectorParagraph_Left,id=0,*userdata=0)
  
  DrawVectorParagraph(text,w,h,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptDrawVectorParagraph = AllocateStructure(spDrawVectorParagraph)
  *svg\dl()\ptDrawVectorParagraph\text = text
  *svg\dl()\ptDrawVectorParagraph\w = w
  *svg\dl()\ptDrawVectorParagraph\h = h
  *svg\dl()\ptDrawVectorParagraph\flags = flags
  *svg\dl()\func = @RtDrawVectorParagraph()
  
  *svg\dl()\ptDrawVectorParagraph\params\id = id
  *svg\dl()\ptDrawVectorParagraph\params\userdata = *userdata 
  *svg\dl()\ptDrawVectorParagraph\params\type = #spDrawVectorParagraph
  
EndProcedure

Procedure SVGDrawVectorText(*svg.svg,text.s,id=0,*userdata=0)
  
  DrawVectorText(text)
  
  AddElement(*svg\dl())
  *svg\dl()\ptDrawVectorText = AllocateStructure(spDrawVectorText)
  *svg\dl()\ptDrawVectorText\Text = text
  *svg\dl()\func = @RtDrawVectorText()
  
  *svg\dl()\ptDrawVectorText\params\id = id
  *svg\dl()\ptDrawVectorText\params\userdata = *userdata 
  *svg\dl()\ptDrawVectorText\params\type = #spDrawVectorText
  
EndProcedure

Procedure SVGEndVectorLayer(*svg.svg,id=0,*userdata=0)
  
  EndVectorLayer()
  
  AddElement(*svg\dl())
  *svg\dl()\ptEndVectorLayer = AllocateStructure(spEndVectorLayer)
  *svg\dl()\func = @RtEndVectorLayer()
  
  *svg\dl()\ptEndVectorLayer\params\id = id
  *svg\dl()\ptEndVectorLayer\params\userdata = *userdata 
  *svg\dl()\ptEndVectorLayer\params\type = #spEndVectorLayer
  
EndProcedure 

Procedure SVGFillPath(*svg.svg,flags=#PB_Path_Default,id=0,*userdata=0)
  
  FillPath(flags) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptFillPath = AllocateStructure(spFillPath)
  *svg\dl()\ptFillPath\flags = flags
  *svg\dl()\func = @RtFillPath()
  
  *svg\dl()\ptFillPath\params\id = id
  *svg\dl()\ptFillPath\params\userdata = *userdata 
  *svg\dl()\ptFillPath\params\type = #spFillPath
  
EndProcedure

Procedure SVGFillVectorOutput(*svg.svg,id=0,*userdata=0)
  
  FillVectorOutput()
  
  AddElement(*svg\dl())
  *svg\dl()\ptFillVectorOutput = AllocateStructure(spFillVectorOutput)
  *svg\dl()\func = @RtFillVectorOutput()
  
  *svg\dl()\ptFillVectorOutput\params\id = id
  *svg\dl()\ptFillVectorOutput\params\userdata = *userdata 
  *svg\dl()\ptFillVectorOutput\params\type = #spFillVectorOutput
  
EndProcedure 

Procedure SVGFlipCoordinatesX(*svg.svg,axis.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  FlipCoordinatesX(axis,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptFlipCoordinatesX = AllocateStructure(spFlipCoordinatesX)
  *svg\dl()\ptFlipCoordinatesX\axis = axis
  *svg\dl()\ptFlipCoordinatesX\system = system
  *svg\dl()\func = @RtFlipCoordinatesX()
  
  *svg\dl()\ptFlipCoordinatesX\params\id = id
  *svg\dl()\ptFlipCoordinatesX\params\userdata = *userdata 
  *svg\dl()\ptFlipCoordinatesX\params\type = #spFlipCoordinatesX
  
EndProcedure

Procedure SVGFlipCoordinatesY(*svg.svg,axis.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  FlipCoordinatesY(axis,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptFlipCoordinatesY = AllocateStructure(spFlipCoordinatesY)
  *svg\dl()\ptFlipCoordinatesY\axis = axis
  *svg\dl()\ptFlipCoordinatesY\system = system
  *svg\dl()\func = @RtFlipCoordinatesY()
  
  *svg\dl()\ptFlipCoordinatesY\params\id = id
  *svg\dl()\ptFlipCoordinatesY\params\userdata = *userdata 
  *svg\dl()\ptFlipCoordinatesY\params\type = #spFlipCoordinatesY
  
EndProcedure

Procedure SVGIsInsidePath(*svg.svg,x.d,y.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  Protected result = IsInsidePath(x,y,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptIsInsidePath = AllocateStructure(spIsInsidePath)
  *svg\dl()\ptIsInsidePath\x = x
  *svg\dl()\ptIsInsidePath\y = y
  *svg\dl()\ptIsInsidePath\system = system
  *svg\dl()\func = @RtIsInsidePath()
  
  *svg\dl()\ptIsInsidePath\params\id = id
  *svg\dl()\ptIsInsidePath\params\userdata = *userdata 
  *svg\dl()\ptIsInsidePath\params\type = #spIsInsidePath
  
  ProcedureReturn result 
  
EndProcedure 

Procedure SVGIsInsideStroke(*svg.svg,x.d,y.d,width.d,flags=#PB_Path_Default,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  Protected result = IsInsideStroke(x,y,width,flags,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptIsInsideStroke = AllocateStructure(spIsInsideStroke)
  *svg\dl()\ptIsInsideStroke\x = x
  *svg\dl()\ptIsInsideStroke\y = y
  *svg\dl()\ptIsInsideStroke\Width = width
  *svg\dl()\ptIsInsideStroke\Flags = flags
  *svg\dl()\ptIsInsideStroke\System = system
  *svg\dl()\func = @RtIsInsideStroke() 
  
  *svg\dl()\ptIsInsideStroke\params\id = id
  *svg\dl()\ptIsInsideStroke\params\userdata = *userdata 
  *svg\dl()\ptIsInsideStroke\params\type = #spIsInsideStroke
  
  ProcedureReturn result 
  
EndProcedure 

Procedure SVGIsPathEmpty(*svg.svg,id=0,*userdata=0)
  
  Protected result = IsPathEmpty() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptIsPathEmpty = AllocateStructure(spIsPathEmpty)
  *svg\dl()\func = @RtIsPathEmpty() 
  
  *svg\dl()\ptIsPathEmpty\params\id = id
  *svg\dl()\ptIsPathEmpty\params\userdata = *userdata 
  *svg\dl()\ptIsPathEmpty\params\type = #spIsPathEmpty
  
  ProcedureReturn result 
  
EndProcedure 

Procedure SVGMovePathCursor(*svg.svg,x.d,y.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  MovePathCursor(x,y,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptMovePathCursor = AllocateStructure(spMovePathCursor)
  *svg\dl()\ptMovePathCursor\x = x
  *svg\dl()\ptMovePathCursor\y = y
  *svg\dl()\ptMovePathCursor\Flags = flags
  *svg\dl()\func = @RtMovePathCursor()
  
  *svg\dl()\ptMovePathCursor\params\id = id
  *svg\dl()\ptMovePathCursor\params\userdata = *userdata 
  *svg\dl()\ptMovePathCursor\params\type = #spMovePathCursor
  
EndProcedure

Procedure.d SVGPathBoundsHeight(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathBoundsHeight()
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathBoundsHeight = AllocateStructure(spPathBoundsHeight)
  *svg\dl()\func = @RtPathBoundsHeight()
  
  *svg\dl()\ptPathBoundsHeight\params\id = id
  *svg\dl()\ptPathBoundsHeight\params\userdata = *userdata 
  *svg\dl()\ptPathBoundsHeight\params\type = #spPathBoundsHeight
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGPathBoundsWidth(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathBoundsWidth()
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathBoundsWidth = AllocateStructure(spPathBoundsWidth)
  *svg\dl()\func = @RtPathBoundsWidth() 
  
  *svg\dl()\ptPathBoundsWidth\params\id = id
  *svg\dl()\ptPathBoundsWidth\params\userdata = *userdata 
  *svg\dl()\ptPathBoundsWidth\params\type = #spPathBoundsWidth
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathBoundsX(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathBoundsX() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathBoundsX = AllocateStructure(spPathBoundsX)
  *svg\dl()\func = @RtPathBoundsX() 
  
  *svg\dl()\ptPathBoundsX\params\id = id
  *svg\dl()\ptPathBoundsX\params\userdata = *userdata 
  *svg\dl()\ptPathBoundsX\params\type = #spPathBoundsX
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathBoundsY(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathBoundsY() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathBoundsY = AllocateStructure(spPathBoundsY)
  *svg\dl()\func = @RtPathBoundsY() 
  
  *svg\dl()\ptPathBoundsY\params\id = id
  *svg\dl()\ptPathBoundsY\params\userdata = *userdata 
  *svg\dl()\ptPathBoundsY\params\type = #spPathBoundsY
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGPathCursorX(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathCursorX() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathCursorX = AllocateStructure(spPathCursorX)
  *svg\dl()\func = @RtPathCursorX() 
  
  *svg\dl()\ptPathCursorX\params\id = id
  *svg\dl()\ptPathCursorX\params\userdata = *userdata 
  *svg\dl()\ptPathCursorX\params\type = #spPathCursorX
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathCursorY(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathCursorY() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathCursorY = AllocateStructure(spPathCursorY)
  *svg\dl()\func = @RtPathCursorY() 
  
  *svg\dl()\ptPathCursorY\params\id = id
  *svg\dl()\ptPathCursorY\params\userdata = *userdata 
  *svg\dl()\ptPathCursorY\params\type = #spPathCursorY
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathLength(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = PathLength() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathLength = AllocateStructure(spPathLength)
  *svg\dl()\func = @RtPathLength() 
  
  *svg\dl()\ptPathLength\params\id = id
  *svg\dl()\ptPathLength\params\userdata = *userdata 
  *svg\dl()\ptPathLength\params\type = #spPathLength
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathPointAngle(*svg.svg,distance.d,id=0,*userdata=0)
  
  Protected result.d = PathPointAngle(distance) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathPointAngle = AllocateStructure(spPathPointAngle)
  *svg\dl()\ptPathPointAngle\Distance = distance
  *svg\dl()\func = @RtPathPointAngle() 
  
  *svg\dl()\ptPathPointAngle\params\id = id
  *svg\dl()\ptPathPointAngle\params\userdata = *userdata 
  *svg\dl()\ptPathPointAngle\params\type = #spPathPointAngle
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGPathPointX(*svg.svg,distance.d,id=0,*userdata=0)
  
  Protected result.d = PathPointX(distance)
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathPointX = AllocateStructure(spPathPointX)
  *svg\dl()\ptPathPointX\Distance = distance
  *svg\dl()\func = @RtPathPointX()
  
  *svg\dl()\ptPathPointX\params\id = id
  *svg\dl()\ptPathPointX\params\userdata = *userdata 
  *svg\dl()\ptPathPointX\params\type = #spPathPointX
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGPathPointY(*svg.svg,distance.d,id=0,*userdata=0)
  
  Protected result.d = PathPointY(distance) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathPointY = AllocateStructure(spPathPointY)
  *svg\dl()\ptPathPointY\Distance = distance
  *svg\dl()\func = @RtPathPointY() 
  
  *svg\dl()\ptPathPointY\params\id = id
  *svg\dl()\ptPathPointY\params\userdata = *userdata 
  *svg\dl()\ptPathPointY\params\type = #spPathPointY
  
  ProcedureReturn result 
  
EndProcedure

Procedure.s SVGPathSegments(*svg.svg,id=0,*userdata=0)
  
  Protected result.s = PathSegments() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptPathSegments = AllocateStructure(spPathSegments)
  *svg\dl()\func = @RtPathSegments() 
  
  *svg\dl()\ptPathSegments\params\id = id
  *svg\dl()\ptPathSegments\params\userdata = *userdata 
  *svg\dl()\ptPathSegments\params\type = #spPathSegments
  
  ProcedureReturn result 
  
EndProcedure 

Procedure SVGResetCoordinates(*svg.svg,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  ResetCoordinates(system) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptResetCoordinates = AllocateStructure(spResetCoordinates)
  *svg\dl()\ptResetCoordinates\system = system
  *svg\dl()\func = @RtResetCoordinates()
  
  *svg\dl()\ptResetCoordinates\params\id = id
  *svg\dl()\ptResetCoordinates\params\userdata = *userdata 
  *svg\dl()\ptResetCoordinates\params\type = #spResetCoordinates
  
EndProcedure

Procedure SVGResetPath(*svg.svg,id=0,*userdata=0)
  
  ResetPath()
  
  AddElement(*svg\dl())
  *svg\dl()\ptResetPath = AllocateStructure(spResetPath)
  *svg\dl()\func = @RtResetPath()
  
  *svg\dl()\ptResetPath\params\id = id
  *svg\dl()\ptResetPath\params\userdata = *userdata 
  *svg\dl()\ptResetPath\params\type = #spResetPath
  
EndProcedure 

Procedure SVGRestoreVectorState(*svg.svg,id=0,*userdata=0)
  
  RestoreVectorState()
  
  AddElement(*svg\dl())
  *svg\dl()\ptRestoreVectorState = AllocateStructure(spRestoreVectorState)
  *svg\dl()\func = @RtRestoreVectorState()
  
  *svg\dl()\ptRestoreVectorState\params\id = id
  *svg\dl()\ptRestoreVectorState\params\userdata = *userdata 
  *svg\dl()\ptRestoreVectorState\params\type = #spRestoreVectorState
  
EndProcedure

Procedure SVGRotateCoordinates(*svg.svg,x.d,y.d,angle.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  RotateCoordinates(x,y,angle,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptRotateCoordinates = AllocateStructure(spRotateCoordinates)
  *svg\dl()\ptRotateCoordinates\x = x
  *svg\dl()\ptRotateCoordinates\y = y
  *svg\dl()\ptRotateCoordinates\Angle = angle
  *svg\dl()\ptRotateCoordinates\System = system
  *svg\dl()\func = @RtRotateCoordinates()
  
  *svg\dl()\ptRotateCoordinates\params\id = id
  *svg\dl()\ptRotateCoordinates\params\userdata = *userdata 
  *svg\dl()\ptRotateCoordinates\params\type = #spRotateCoordinates
  
EndProcedure 

Procedure SVGSaveVectorState(*svg.svg,id=0,*userdata=0)
  
  SaveVectorState()
  
  AddElement(*svg\dl())
  *svg\dl()\ptSaveVectorState = AllocateStructure(spSaveVectorState)
  *svg\dl()\func = @RtSaveVectorState()
  
  *svg\dl()\ptSaveVectorState\params\id = id
  *svg\dl()\ptSaveVectorState\params\userdata = *userdata 
  *svg\dl()\ptSaveVectorState\params\type = #spSaveVectorState
  
EndProcedure

Procedure SVGScaleCoordinates(*svg.svg,scaleX.d,scaleY.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  ScaleCoordinates(scaleX,scaleY,system) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptScaleCoordinates = AllocateStructure(spScaleCoordinates)
  *svg\dl()\ptScaleCoordinates\ScaleX = scaleX
  *svg\dl()\ptScaleCoordinates\ScaleY = scaleY
  *svg\dl()\ptScaleCoordinates\System = system
  *svg\dl()\func = @RtScaleCoordinates()
  
  *svg\dl()\ptScaleCoordinates\params\id = id
  *svg\dl()\ptScaleCoordinates\params\userdata = *userdata 
  *svg\dl()\ptScaleCoordinates\params\type = #spScaleCoordinates
  
EndProcedure

Procedure SVGSkewCoordinates(*svg.svg,angleX.d,angleY.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  SkewCoordinates(angleX,angleY,system)
  
  AddElement(*svg\dl())
  *svg\dl()\ptSkewCoordinates = AllocateStructure(spSkewCoordinates)
  *svg\dl()\ptSkewCoordinates\AngleX = angleX
  *svg\dl()\ptSkewCoordinates\AngleY = angleY
  *svg\dl()\ptSkewCoordinates\System = system
  *svg\dl()\func = @RtSkewCoordinates()
  
  *svg\dl()\ptSkewCoordinates\params\id = id
  *svg\dl()\ptSkewCoordinates\params\userdata = *userdata 
  *svg\dl()\ptSkewCoordinates\params\type = #spSkewCoordinates
  
EndProcedure

Procedure SVGStartVectorDrawing(*svg.svg,output,id=0,*userdata=0)
  
  StartVectorDrawing(output) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptStartVectorDrawing = AllocateStructure(spStartVectorDrawing)
  *svg\dl()\ptStartVectorDrawing\Output = output
  *svg\dl()\func = @RtStartVectorDrawing()
  
  *svg\dl()\ptStartVectorDrawing\params\id = id
  *svg\dl()\ptStartVectorDrawing\params\userdata = *userdata 
  *svg\dl()\ptStartVectorDrawing\params\type = #spStartVectorDrawing
  
EndProcedure

Procedure SVGStopVectorDrawing(*svg.svg,id=0,*userdata=0)
  
  StopVectorDrawing() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptStopVectorDrawing = AllocateStructure(spStopVectorDrawing)
  *svg\dl()\func = @RtStopVectorDrawing()
  
  *svg\dl()\ptStopVectorDrawing\params\id = id
  *svg\dl()\ptStopVectorDrawing\params\userdata = *userdata 
  *svg\dl()\ptStopVectorDrawing\params\type = #spStopVectorDrawing
  
EndProcedure

Procedure SVGStrokePath(*svg.svg,width.d,flags=#PB_Path_Default,id=0,*userdata=0)
  
  StrokePath(width,flags) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptStrokePath = AllocateStructure(spStrokePath)
  *svg\dl()\ptStrokePath\Width = width
  *svg\dl()\ptStrokePath\Flags = flags
  *svg\dl()\func = @RtStrokePath() 
  
  *svg\dl()\ptStrokePath\params\id = id
  *svg\dl()\ptStrokePath\params\userdata = *userdata 
  *svg\dl()\ptStrokePath\params\type = #spStrokePath
  
EndProcedure

Procedure SVGTranslateCoordinates(*svg.svg,x.d,y.d,system=#PB_Coordinate_User,id=0,*userdata=0)
  
  TranslateCoordinates(x,y,system) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptTranslateCoordinates = AllocateStructure(spTranslateCoordinates)
  *svg\dl()\ptTranslateCoordinates\x = x
  *svg\dl()\ptTranslateCoordinates\y = y
  *svg\dl()\ptTranslateCoordinates\System = system
  *svg\dl()\func = @RtTranslateCoordinates() 
  
  *svg\dl()\ptTranslateCoordinates\params\id = id
  *svg\dl()\ptTranslateCoordinates\params\userdata = *userdata 
  *svg\dl()\ptTranslateCoordinates\params\type = #spTranslateCoordinates
  
EndProcedure 

Procedure SVGVectorFont(*svg.svg,fontId,size=0,id=0,*userdata=0)
  
  VectorFont(fontId,size) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorFont = AllocateStructure(spVectorFont)
  *svg\dl()\ptVectorFont\ID = fontId
  *svg\dl()\ptVectorFont\Size = size
  *svg\dl()\func = @RtVectorFont() 
  
  *svg\dl()\ptVectorFont\params\id = id
  *svg\dl()\ptVectorFont\params\userdata = *userdata 
  *svg\dl()\ptVectorFont\params\type = #spVectorFont
  
EndProcedure 

Procedure.d SVGVectorOutputHeight(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = VectorOutputHeight() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorOutputHeight = AllocateStructure(spVectorOutputHeight)
  *svg\dl()\func = @RtVectorOutputHeight() 
  
  *svg\dl()\ptVectorOutputHeight\params\id = id
  *svg\dl()\ptVectorOutputHeight\params\userdata = *userdata 
  *svg\dl()\ptVectorOutputHeight\params\type = #spVectorOutputHeight
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGVectorOutputWidth(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = VectorOutputWidth() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorOutputWidth = AllocateStructure(spVectorOutputWidth)
  *svg\dl()\func = @RtVectorOutputWidth() 
  
  *svg\dl()\ptVectorOutputWidth\params\id = id
  *svg\dl()\ptVectorOutputWidth\params\userdata = *userdata 
  *svg\dl()\ptVectorOutputWidth\params\type = #spVectorOutputWidth
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGVectorParagraphHeight(*svg.svg,text.s,width.d,height.d,id=0,*userdata=0)
  
  Protected result.d = VectorParagraphHeight(text,width,height) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorParagraphHeight = AllocateStructure(spVectorParagraphHeight)
  *svg\dl()\ptVectorParagraphHeight\Text = text
  *svg\dl()\ptVectorParagraphHeight\Width = width
  *svg\dl()\ptVectorParagraphHeight\Height = height
  *svg\dl()\func = @RtVectorParagraphHeight() 
  
  *svg\dl()\ptVectorParagraphHeight\params\id = id
  *svg\dl()\ptVectorParagraphHeight\params\userdata = *userdata 
  *svg\dl()\ptVectorParagraphHeight\params\type = #spVectorParagraphHeight
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGVectorResolutionX(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = VectorResolutionX() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorResolutionX = AllocateStructure(spVectorResolutionX)
  *svg\dl()\func = @RtVectorResolutionX() 
  
  *svg\dl()\ptVectorResolutionX\params\id = id
  *svg\dl()\ptVectorResolutionX\params\userdata = *userdata 
  *svg\dl()\ptVectorResolutionX\params\type = #spVectorResolutionX
  
  ProcedureReturn result 
  
EndProcedure 

Procedure.d SVGVectorResolutionY(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = VectorResolutionY() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorResolutionY = AllocateStructure(spVectorResolutionY)
  *svg\dl()\func = @RtVectorResolutionY() 
  
  *svg\dl()\ptVectorResolutionY\params\id = id
  *svg\dl()\ptVectorResolutionY\params\userdata = *userdata 
  *svg\dl()\ptVectorResolutionY\params\type = #spVectorResolutionY
  
  ProcedureReturn result 
  
EndProcedure 

Procedure SVGVectorSourceCircularGradient(*svg.svg,x.d,y.d,radius.d,centerX.d=0,centerY.d=0,id=0,*userdata=0)
  
  VectorSourceCircularGradient(x,y,radius,centerX,centerY)
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorSourceCircularGradient = AllocateStructure(spVectorSourceCircularGradient)
  *svg\dl()\ptVectorSourceCircularGradient\x = x
  *svg\dl()\ptVectorSourceCircularGradient\y = y
  *svg\dl()\ptVectorSourceCircularGradient\Radius = radius
  *svg\dl()\ptVectorSourceCircularGradient\CenterX = centerX
  *svg\dl()\ptVectorSourceCircularGradient\CenterY = centerY
  *svg\dl()\func = @RtVectorSourceCircularGradient()
  
  *svg\dl()\ptVectorSourceCircularGradient\params\id = id
  *svg\dl()\ptVectorSourceCircularGradient\params\userdata = *userdata 
  *svg\dl()\ptVectorSourceCircularGradient\params\type = #spVectorSourceCircularGradient
  
EndProcedure 

Procedure SVGVectorSourceColor(*svg.svg,color,id=0,*userdata=0)
  
  VectorSourceColor(color)
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorSourceColor = AllocateStructure(spVectorSourceColor)
  *svg\dl()\ptVectorSourceColor\Color = color
  *svg\dl()\func = @RtVectorSourceColor()
  
  *svg\dl()\ptVectorSourceColor\params\id = id 
  *svg\dl()\ptVectorSourceColor\params\userdata = *userdata
  *svg\dl()\ptVectorSourceColor\params\type = #spVectorSourceColor 
  
EndProcedure

Procedure SVGVectorSourceGradientColor(*svg.svg,color,position.d,id=0,*userdata=0)
  
  VectorSourceGradientColor(color,position)
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorSourceGradientColor = AllocateStructure(spVectorSourceGradientColor)
  *svg\dl()\ptVectorSourceGradientColor\Color = color
  *svg\dl()\ptVectorSourceGradientColor\Position = position
  *svg\dl()\func = @RtVectorSourceGradientColor()
  
  *svg\dl()\ptVectorSourceGradientColor\params\id = id
  *svg\dl()\ptVectorSourceGradientColor\params\userdata = *userdata 
  *svg\dl()\ptVectorSourceGradientColor\params\type = #spVectorSourceGradientColor
  
EndProcedure

Procedure SVGVectorSourceImage(*svg.svg,imageID,alpha=255,width.d=0,height.d=0,flags=#PB_VectorImage_Default,id=0,*userdata=0)
  
  VectorSourceImage(imageID,alpha,width,height,flags)
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorSourceImage = AllocateStructure(spVectorSourceImage)
  *svg\dl()\ptVectorSourceImage\ImageID = imageID
  *svg\dl()\ptVectorSourceImage\Alpha = alpha
  *svg\dl()\ptVectorSourceImage\Width = width
  *svg\dl()\ptVectorSourceImage\Height = height
  *svg\dl()\ptVectorSourceImage\Flags = flags
  *svg\dl()\func = @RtVectorSourceImage()
  
  *svg\dl()\ptVectorSourceImage\params\id = id
  *svg\dl()\ptVectorSourceImage\params\userdata = *userdata 
  *svg\dl()\ptVectorSourceImage\params\type = #spVectorSourceImage
  
EndProcedure 

Procedure SVGVectorSourceLinearGradient(*svg.svg,x1.d,y1.d,x2.d,y2.d,id=0,*userdata=0)
  
  VectorSourceLinearGradient(x1,y1,x2,y2)
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorSourceLinearGradient = AllocateStructure(spVectorSourceLinearGradient)
  *svg\dl()\ptVectorSourceLinearGradient\x1 = x1
  *svg\dl()\ptVectorSourceLinearGradient\y1 = y1
  *svg\dl()\ptVectorSourceLinearGradient\x2 = x2
  *svg\dl()\ptVectorSourceLinearGradient\y2 = y2
  *svg\dl()\func = @RtVectorSourceLinearGradient()
  
  *svg\dl()\ptVectorSourceLinearGradient\params\id = id
  *svg\dl()\ptVectorSourceLinearGradient\params\userdata = *userdata 
  *svg\dl()\ptVectorSourceLinearGradient\params\type = #spVectorSourceLinearGradient
  
EndProcedure 

Procedure.d SVGVectorTextHeight(*svg.svg,text.s,flags=#PB_VectorText_Default,id=0,*userdata=0)
  
  Protected result.d = VectorTextHeight(text,flags) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorTextHeight = AllocateStructure(spVectorTextHeight)
  *svg\dl()\ptVectorTextHeight\Text = text
  *svg\dl()\ptVectorTextHeight\Flags = flags
  *svg\dl()\func = @RtVectorTextHeight()
  
  *svg\dl()\ptVectorTextHeight\params\id = id
  *svg\dl()\ptVectorTextHeight\params\userdata = *userdata 
  *svg\dl()\ptVectorTextHeight\params\type = #spVectorTextHeight
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGVectorTextWidth(*svg.svg,text.s,flags=#PB_VectorText_Default,id=0,*userdata=0)
  
  Protected result.d = VectorTextWidth(text,flags) 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorTextWidth = AllocateStructure(spVectorTextWidth)
  *svg\dl()\ptVectorTextWidth\Text = text
  *svg\dl()\ptVectorTextWidth\Flags = flags
  *svg\dl()\func = @RtVectorTextWidth()
  
  *svg\dl()\ptVectorTextWidth\params\id = id
  *svg\dl()\ptVectorTextWidth\params\userdata = *userdata 
  *svg\dl()\ptVectorTextWidth\params\type = #spVectorTextWidth
  
  ProcedureReturn result 
  
EndProcedure

Procedure.d SVGVectorUnit(*svg.svg,id=0,*userdata=0)
  
  Protected result.d = VectorUnit() 
  
  AddElement(*svg\dl())
  *svg\dl()\ptVectorUnit = AllocateStructure(spVectorUnit)
  *svg\dl()\func = @RtVectorUnit() 
  
  *svg\dl()\ptVectorUnit\params\id = id
  *svg\dl()\ptVectorUnit\params\userdata = *userdata 
  *svg\dl()\ptVectorUnit\params\type = #spVectorUnit
  
  ProcedureReturn result 
  
EndProcedure

;=>>>Test 
CompilerIf #PB_Compiler_IsMainFile 
  
  Global mSVG.svg,cw.d,ch.d  
  Global *svg.svg = @msvg  
  
  If StartVectorDrawing(SvgVectorOutput("test.svg", 400, 200))
    LoadFont(0,"Arial",24,#PB_Font_Italic | #PB_Font_Bold ) 
    txt$ = "Hello" 
    
    SVGVectorFont(*svg,FontID(0),36)  
    SVGAddPathBox(*svg,50, 50, 200, 50)
    SVGAddPathBox(*SVG,150, 75, 200, 50)
    SVGVectorSourceColor(*svg,RGBA(255, 128, 0, 255))
    SVGStrokePath(*svg,10)
    cw = 200 - SVGVectorTextWidth(*svg,Txt$) /2
    ch = 100 -  SVGVectorTextHeight(*svg,Txt$) /2 
    
    SVGMovePathCursor(*svg,200 - SVGVectorTextWidth(*svg,Txt$) /2,ch) 
    SVGVectorSourceColor(*SVG,RGBA(0,255, 0, 255))
    SVGDrawVectorText(*svg,txt$)
    
    SVGVectorFont(*svg,FontID(0), 25)
    SVGVectorSourceColor(*svg,RGBA(0, 0, 0, 80),123)
    Text$ = "The quick brown fox jumps over the lazy dog"
    cw = 200 - VectorTextWidth(Text$) /2
    ch = 100 - VectorTextHeight(Text$) /2 
    
    SVGRotateCoordinates(*svg,200, 100, 5,#PB_Coordinate_User,123)
    For i = 1 To 6
      SVGMovePathCursor(*svg,cw,ch,#PB_Path_Default)
      SVGDrawVectorText(*svg,Text$)
      SVGRotateCoordinates(*svg,200, 100, 30)
    Next i
    
    SVGVectorFont(*svg,FontID(0), 36)
    SVGVectorSourceColor(*svg,RGBA(255, 128, 0, 255))
    SVGResetCoordinates(*svg)
    SVGMovePathCursor(*svg,10,10) 
    SVGDrawVectorText(*svg,"Hello World",123)
    
    StopVectorDrawing() 
    
    Define sfx.d=1,sfy.d=1
    Define w,h,ct  
    
    ;draw display list to canvas 
    OpenWindow(0,0,0,400,200,"test txt",#PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget ) 
    CanvasGadget(0,0,0,400,200)
    StartVectorDrawing(CanvasVectorOutput(0)) 
    AddPathBox(0, 0, DesktopScaledX(WindowWidth(0)),DesktopScaledY(WindowHeight(0)))
    VectorSourceColor($ffffffff)
    FillPath()
    sfx = DesktopScaledX(WindowWidth(0)) / 400.0 
    sfy = DesktopScaledY(WindowHeight(0)) / 200.0 
    ScaleCoordinates(sfx,sfy)
    
    ForEach *svg\dl() 
      *svg\dl()\func(*svg\dl()\item)
    Next   
    
    StopVectorDrawing()
    AddWindowTimer(0,1,15)     
    Repeat 
      event = WaitWindowEvent() 
      Select event 
        Case #PB_Event_SizeWindow
          ResizeGadget(0,0,0,WindowWidth(0),WindowHeight(0)) 
          StartVectorDrawing(CanvasVectorOutput(0)) 
          AddPathBox(0, 0, DesktopScaledX(WindowWidth(0)),DesktopScaledY(WindowHeight(0)))
          VectorSourceColor($ffffffff)
          FillPath()
          sfx = DesktopScaledX(WindowWidth(0)) / 400.0 
          sfy = DesktopScaledY(WindowHeight(0)) / 200.0 
          ScaleCoordinates(sfx,sfy)
          ;draw the display list 
          ForEach *svg\dl() 
            *svg\dl()\func(*svg\dl()\item)
          Next 
          StopVectorDrawing()  
        Case #PB_Event_Gadget 
          If EventType() = #PB_EventType_MouseWheel         
            dir = GetGadgetAttribute(0,#PB_Canvas_WheelDelta)
            If dir < 1 
              sfx / 1.2 
              sfy / 1.2
            Else 
              sfx * 1.2
              sfy * 1.2
            EndIf 
            bcolor = 1 
          EndIf 
        Case #PB_Event_Timer
          If StartVectorDrawing(CanvasVectorOutput(0)) ;modify the display list outputs 
            
            w = DesktopScaledX(WindowWidth(0))  
            h = DesktopScaledY(WindowHeight(0))  
            AddPathBox(0, 0, w,h)
            VectorSourceColor($ffffffff)
            FillPath()
            w/2 : h/2 
            TranslateCoordinates(w-(200*sfx),h-(100*sfy))
            ScaleCoordinates(sfx,sfy)
            ForEach *svg\dl() 
              If *svg\dl()\item\id=123   
                If *svg\dl()\item\type = #spRotateCoordinates 
                  *ptr.spRotateCoordinates = *svg\dl()\item 
                  *ptr\Angle = ct 
                  ct+1 
                  ct%360  
                ElseIf *svg\dl()\item\type = #spVectorSourceColor 
                  If bcolor  
                    *col.spVectorSourceColor = *svg\dl()\item  
                    *col\Color = RGBA(Random(255),Random(255),Random(255),127)
                    bcolor=0 
                  EndIf 
                ElseIf *svg\dl()\item\type = #spDrawVectorText 
                  *txt.spDrawVectorText = *svg\dl()\item 
                  *txt\Text = Left("Runtime vector drawing display lists",ct%39) 
                EndIf
              EndIf    
              *svg\dl()\func(*svg\dl()\item)
            Next 
            StopVectorDrawing() 
          EndIf
          
        Case #PB_Event_CloseWindow  
          Break 
      EndSelect 
    ForEver    
    
    ;RunProgram("test.svg") 
    
  EndIf 
  
CompilerEndIf  



and a dumb question how do you clear the contents of a canvas gadget?

Re: vector drawing display list

Posted: Wed Oct 01, 2025 10:03 pm
by infratec
idle wrote: Wed Oct 01, 2025 9:10 pm and a dumb question how do you clear the contents of a canvas gadget?
Box(0, 0, w, h , #White) :?:

Re: vector drawing display list

Posted: Wed Oct 01, 2025 10:10 pm
by Michael Vogel
...or FillVectorOutput()

Re: vector drawing display list

Posted: Wed Oct 01, 2025 10:55 pm
by idle
I had double buffering in my old canvas so you could draw and flip.

Re: vector drawing display list

Posted: Thu Oct 02, 2025 12:47 am
by skywalk
Does the canvas have layers you can enable/disable?
Or must we code that action?

Re: vector drawing display list

Posted: Thu Oct 02, 2025 5:03 am
by idle
skywalk wrote: Thu Oct 02, 2025 12:47 am Does the canvas have layers you can enable/disable?
Or must we code that action?
No but the vector lib has layers. BeginVectorLayer()
I will eventually be adding a DOM so you will be able to turn layers on or off, select or modify elements, insert elements, do animation and event callbacks though I'm still thinking of the implementation and need to look around and see what's already there like StarGate's canvas lib.

One thing that was pointed out to me, was about the syntax or the description of pathsegments and I don't know if it was a suggestion or not. But I realize you could easily store the path Segments "M x y L x y Z" from the xml and then draw them with DrawPath so you could easily use that to do a "display list" and cut out the need to reparse the xml. Which was part of the goal, but it still has to parse the segment string which is very slow compared to using a display list of the functions which also adds runtime support to the vector lib.

Re: vector drawing display list

Posted: Thu Oct 02, 2025 8:56 am
by pjay
This is really nice. 8)

What's missing though, is some love for DPI awareness - you clearly still have good eyesight :lol:

Re: vector drawing display list

Posted: Thu Oct 02, 2025 9:34 am
by idle
pjay wrote: Thu Oct 02, 2025 8:56 am This is really nice. 8)

What's missing though, is some love for DPI awareness - you clearly still have good eyesight :lol:
Sorry I didn't even think about that for the demo and no I just stick my nose up to the screen and squint.
fixed

Re: vector drawing display list

Posted: Thu Oct 02, 2025 10:46 am
by Fred
That's useful !

Re: vector drawing display list

Posted: Thu Oct 02, 2025 12:21 pm
by idle
Fred wrote: Thu Oct 02, 2025 10:46 amThat's useful !
I will also add a *userdata parameter to the wrapper functions so you can acces it while walking the display list, then you can use that to do things like conditional rendering based or dynamicly edit the display list. If you call the wrapper functions it will call the vector functions and add the instructions at that point. So you can use it in many ways and do all kinds of things with it.

Re: vector drawing display list

Posted: Thu Oct 02, 2025 10:49 pm
by idle
WIP Idea added dlparams so you can set an id on a display list command which allows you to modify the instruction
look closely when you move the mouse wheel, it modifies the rotation angle of the "quick brown fox.." and changes the color

This will help facilitate doing animations in SVG and also provides a generic way to use for other tasks
I will work out how to wrap it so it's easier to use rather than via raw pointers

Any Thoughts on this welcome


edit: see 1st post