Page 2 of 2

Re: slow drawing

Posted: Thu Jul 16, 2020 11:03 pm
by netmaestro
wilbert wrote:it's a bit strange because the VectorDrawing library and this gdrawing.pbi file both seem to use GDI+
I had the same thought but I didn't express it because at the time I had icing all over my fingers.

Re: slow drawing

Posted: Fri Jul 17, 2020 6:24 am
by Olli
I agree too, but GDI+, exactly as Scintilla in the past, has an internal feature which asks anything in the network.

Re: slow drawing

Posted: Fri Jul 17, 2020 8:30 am
by ludoke
I don't know if it is slower or faster, but Danilo's examples are a big help.
I still have so much to discover and learn.

Re: slow drawing

Posted: Fri Jul 17, 2020 10:39 am
by Olli
Personnally, I just made a remover of the native Norton anti-virus installer... And GDI strangely lost this surprising latency.

Re: slow drawing comparing

Posted: Thu Jul 30, 2020 7:20 pm
by ludoke
addpathline and AddPathCircle are the slowest.
The time is changeable ?
discovered some more,it is strange that drawing a circle seems faster than drawing a line

Code: Select all

OpenWindow(0,0,0,1800,900,"")
CanvasGadget(0, 0,0,1800,900)
    x.d = 500
    y.d =400
start.q = ElapsedMilliseconds()
;speedtest drawing arc 
StartVectorDrawing(CanvasVectorOutput(0))
  For i=1 To 25000
    x=400:y=300:a=100:b=200
    MovePathCursor(x,y)
   ; AddPathLine(a,b);613ms
    AddPathCircle(400,300,100,0,330);2789ms 
    VectorSourceColor(0)
    StrokePath(2)
  Next
StopVectorDrawing()
finish.q = ElapsedMilliseconds()
MessageRequester("Time Taken for 25K lines drawn:", Str(finish-start))
;-------------------------------------------------------------------------
;speedtest  with linxy
start.q = ElapsedMilliseconds()
StartDrawing(CanvasOutput(0))
  For i=1 To 25000  
    x=400:y=300:a=100:b=200 ;46ms
    LineXY(x,y,a,b,0)
  Next
StopDrawing()
finish.q = ElapsedMilliseconds()
MessageRequester("Time Taken for 25K lines drawn:", Str(finish-start))
;--------------------------------------------------------------------------
;speedtest for arcs with linexy
x_old.d=0
y_old.d=0
x1.d=0:y1.d=0
start.q = ElapsedMilliseconds()
StartDrawing(CanvasOutput(0))
LineXY(100,100,1000,100,0)
    
    radius=200
    start_arc=0: arc=start_arc:end_arc=290 
       x1=Cos(Radian(arc))*radius
       y1=-Sin(Radian(arc))*radius  ;negative for the quadrant
       x_old=x1:y_old=y1
     For i=1 To 25000  ; arcs =4 to 18ms  time is changeable ?
     While arc <=end_arc     
       x1=Cos(Radian(arc))*radius
       y1=-Sin(Radian(arc))*radius  
       LineXY(x+x_old,y+y_old,x+x1,y+y1,0)
       x_old=x1:y_old=y1:arc=arc+1
      Wend
     Next
StopDrawing()
finish.q = ElapsedMilliseconds()
MessageRequester("Time Taken for 25K lines drawn:", Str(finish-start))
Repeat:Until WaitWindowEvent()=#PB_Event_CloseWindow

Re: slow drawing

Posted: Thu Jul 30, 2020 7:28 pm
by Saki
Hi,
but for your application it should really be fast enough.
What do you want to do with many thousands of lines and circles in a split second ?

There are beautiful benchmark programs, check them out and have fun :wink:

Best Regards Saki

Re: slow drawing

Posted: Thu Jul 30, 2020 7:51 pm
by ludoke
Saki,
I try to make a gcode viewer,a gcode file can contain hundreds of thousands of lines.
I would like such a file on the screen so I can rotate it, zoom, move. But I still have a lot to discover.
I'm also trying to find something to do this in 3D.

Re: slow drawing

Posted: Thu Jul 30, 2020 8:20 pm
by Demivec
ludoke wrote:Saki,
I try to make a gcode viewer,a gcode file can contain hundreds of thousands of lines.
I would like such a file on the screen so I can rotate it, zoom, move. But I still have a lot to discover.
I'm also trying to find something to do this in 3D.
Are you planning to convert/interpret the gcode into data for the rendering and then store this separately so that only the rendering data has to be used for rotations, zooming, etc without the need to keep referencing the gcode for each rendering?

Re: slow drawing

Posted: Fri Jul 31, 2020 9:14 am
by srod
ludoke wrote:Saki,
I try to make a gcode viewer,a gcode file can contain hundreds of thousands of lines.
I would like such a file on the screen so I can rotate it, zoom, move. But I still have a lot to discover.
I'm also trying to find something to do this in 3D.
It's probably no coincidence that most gcode viewers use OpenGL, or some such, for this kind og thing, although this could be for cross-platform reasons if nothing else. If you are showing toolpaths and the like then you would likely wish to throw up different orientations and, well, I wouldn't have thought that the vector library would be the way to go. Just depends how far you need to go down this path?