Progress Circle to Expedite Mouse Drawing

0
0

I am intrigued by the extension Progress Circle as a potential way to draw via a mouse on the client side.  Currently, I have successfully ported my vb.net desktop app to WiseJ.  Unfortunately, a basic process of the app is to create graphics images to depict the drawing of lines on a bitmap with the mouse movement.  This works fine inside a desktop app but the time required to transmit each frame of the mouse movement via WiseJ to the client is too long.  It occurred to me that a javascript could draw the lines in the client via mouse movements while the coordinates are entered into the server.  The complication is that the drawing of lines is meant to trace a loaded image; the user would trace the outline of a room image to transfer the positions of walls to the server.  Currently, I simply load the trace image into graphics and superimpose the lines as the mousemove handler delivers them.  It would be much faster if the trace image were static as delivered by the server to the picturebox, but any lines would be drawn on the client side and superimposed on the static graphic.  I could play with the Progress Circle extension to better understand its functionality, but I thought I’d pose the problem to you and see if you see any potential.

Here’s the code I use to create each frame of mouse movement, along with other functionality (when UseClipboard is true there is a trace image as the canvas):

Private Sub UpdateRoomDrawing()

Dim picWdth As Integer = Application.Session.picWdth
Dim picHgt As Integer = Application.Session.picHgt
picTrace.Left = Application.Session.picTraceLeft
picTrace.Top = Application.Session.picTraceTop

If Application.Session.UseClipboard Then
Dim RI As Drawing.Bitmap = Application.Session.RetainImage
Dim RetainImage As Drawing.Bitmap
If IsNothing(RI) Then
RetainImage = New Drawing.Bitmap(picWdth, picHgt, Drawing.Imaging.PixelFormat.Format32bppPArgb)
Else
RetainImage = DirectCast(RI.Clone, Drawing.Bitmap)
End If
Using g = Drawing.Graphics.FromImage(RetainImage)
DrawWalls(g)
DrawOpenNode(g)
End Using
picTrace.Image = Nothing
panRoomTrace.Visible = True
cmdTraceLock.Visible = True
zoomSlider.Visible = True
panRoomTrace.SendToBack()
panPicRoom.Visible = False
picTrace.Image = RetainImage
Else
Dim BMP As Drawing.Bitmap
BMP = New Drawing.Bitmap(picWdth, picHgt, Drawing.Imaging.PixelFormat.Format32bppPArgb)
Using g = Drawing.Graphics.FromImage(BMP)
g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
g.Clear(Drawing.Color.White)
DrawGraphBackgrnd(Application.Session.LengthOffset, Application.Session.WidthOffset, Application.Session.HeightOffset, g)
DrawWalls(g)
DrawOpenNode(g)
End Using
picRoom.Image = BMP
panRoomTrace.Visible = False
cmdTraceLock.Visible = False
zoomSlider.Visible = False
panPicRoom.Visible = True
End If

ShowMousePosition()

End Sub

 

Thanks for your consideration!

Gerry

  • You must to post comments
0
0

Hi Gerald,

if you want to use the Canvas control please consider that it uses the HTML 5 canvas which is vectorial and requires you to send HTML5 drawing calls on every refresh event. (Just like the Progress control does).
Doing this on the server will always result in a bit laggy drawing if you do it live as the mouse moves.
So in that case you might be better off drawing in Javascript but that might have its own caveats.

Best regards
Frank

  • You must to post comments
0
0

Hi Gerald,

can you please send a complete test case we can use on our side.
Either post it here or send it to supportATiceteagroup.com

Thanks in advance.

Best regards
Frank

  • Gerald Lemay
    Hi Frank, I greatly appreciate your response, however I’m not sure what you are asking for? My main curiosity was if you thought the extension provided the kind of functionality that I was seeking and worth investing my time in. Otherwise, I thought there might be an alternative plug in or widget that might be worth investigating. If you are suggesting that this might be a possible new feature suggestion, that’s great. I’m glad to provide more detail. I guess I was trying to avoid going down a a rabbit hole if you thought the Progress Circle was the wrong approach to my issue. Thanks! Gerry
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.