Picture Desktop vs Web

Hi all,

I’ve got a small Class that takes a JSON String of points of a shape (from Adobe Illustrator) and generates a Picture from it…

I’ve been using this for a while in a Desktop app. Now I have a need to use this in a web app - but it doesn’t work.

It compiles, no errors.

However, when I step through the code to the bit where the GraphicsPath is filled on the Picture - nothing happens, inspecting the picture in the IDE and it’s blank.

Is there some restriction on what you can use in a web app when it comes to Pictures / GraphicsPath etc? As I said, it compiles OK, so you’d expect it to work.

I’ve also checked that the code previous to this that parses the JSON array is retrieving its values correctly, it is.


Help please! Cheers, Dave.

I’m not a Web expert but I know that console graphics is considerably different than desktop graphics. You might have to use something like ImageMagic from MBS to get it to work properly in console/web apps.

Desktop picture is different to WebPicture. See how to convert to the later:

I’ll take a look at that Bob. Cheers

Yes, aware of that Michel. I’m doing everything in a picture, then, finally, converting to a WebPicture. My problem seems to be that

picture.Graphics.FillPath thePath
picture.Graphics.DrawPath thePath

… in a web app, doesn’t actually do anything – was wondering if anyone could confirm that this is the case / has anyone had a similar experience?

Have you tried to display the webpicture in an Imageview, to verify the picture is valid ?

No Michel, I’m inspecting the picture in the IDE, stepping through the code line by line… the picture ends up with no content. But for info, yes, I’ve converted the empty picture to a webPicture and got an empty webPicture. Sorry.

Is it the same code as your desktop app ?

100% the same. Compiles OK, no errors.

Here’s the code:

thePath = New GraphicsPath // <- class property

Var shapeJSON As New JSONItem
shapeJSON.Load(tickShapeJSON) // < valid JSON array of points to add to thePath

Var pathPointsArrayJSON As JSONItem = shapeJSON.Value("pathPoints")

Var maxX, maxY As Double

For i As Integer = 0 To pathPointsArrayJSON.Count-1
  Var thisPathPointJSON As JSONItem = pathPointsArrayJSON.ValueAt(i)
  Var anchorJSON As JSONItem = thisPathPointJSON.Value("anchor")
  Var leftDirectionJSON As JSONItem = thisPathPointJSON.Value("leftDirection")
  Var rightDirectionJSON As JSONItem = thisPathPointJSON.Value("rightDirection")
  Var x, y, cp1x, cp1y, cp2x, cp2y As Double
  x = anchorJSON.ValueAt(0)
  y = anchorJSON.ValueAt(1)
  cp1x = leftDirectionJSON.ValueAt(0)
  cp1y = leftDirectionJSON.ValueAt(1)
  cp2x = rightDirectionJSON.ValueAt(0)
  cp2y = rightDirectionJSON.ValueAt(1)
  If i = 0 Then thePath.MoveToPoint(x,y)
  x = Abs(x)
  y = Abs(y)
  cp1x = Abs(cp1x)
  cp1y = Abs(cp1y)
  cp2x = Abs(cp2x)
  cp2y = Abs(cp2y)
  If x > maxX Then maxX = x
  If y > maxY Then maxY = y
  #If DebugBuild Then // <- make sure values coming from JSON array are OK
    System.DebugLog i.ToString("#") + " x=" + x.ToString("#") + " y=" + y.ToString("#") + " cp1x=" + cp1x.ToString("#") + " cp1y=" + cp1y.ToString("#") + " cp2x=" + cp2x.ToString("#") + " cp2y=" + cp2y.ToString("#")

Var basePic As New Picture(maxX+6,maxY+6)

basePic.Graphics.DrawingColor = myDrawingColor // <- class property
basePic.Graphics.FillPath thePath, True


At the break point, I inspect ‘basePic’ and find it’s empty.

Could you draw something else to BasePic, for instance a rectangle or oval with graphics.drawrectangle for instance, just to see if the problem is with fillpath.

Absolutely Michel, just the .fillPath and .drawPath that don’t seem to do anything. I’ve submitted a bug report and the status has changed to “reproducible”.

1 Like

It’s a long shot, but if Linux desktop does not have the bug (admitting you app runs under Linux), you could use a small windowless desktop helper to generate the picture. You can send it to the web app with IPCSocket. Since IPCSocket sends strings, you will have to encodebase64.


Thanks for the suggestion Michel - I’ll wait to see what Xojo come back with before going down this more convoluted route. Regards.

I hate to tell you, but Xojo rarely fixes bugs immediately.

I know the helper thing is more complex, but it may be the only way to fix the issue rapidly.

1 Like

Do you have a case number for this on Issues?

Edit: found it #70965

1 Like

This has been my solution to loading certain picture types in web. Fire up a desktop helper to parse data as required.

1 Like

Confirming that it does nothing on windows 11.

It is already Reproducible but if you search the ISSUES, Reproducible bugs could be there YEARS.

If you need this functionality soon, you should look into workarounds. A helper app running all the time taking the drawing job sounds fine.

1 Like