11-06-2025, 09:41 PM
(06-18-2024, 05:22 PM)SpriggsySpriggs Wrote: Attached is a 7z archive of some SVGs I made on my reMarkable 2 tablet. I want to see if anyone is capable of displaying them with the SVG loading in QB64. I've tried and failed.First, your drawings aren't bad! They all displayed in Chrome, except for the last one "Sketches - page 5.svg" which doesn't display and I can hear my CPU fan kicking in.
But back to your original question, have you seen this post ARRAYTO_SVG by James D Jarvis? That might come in handy for what you're trying to do.
Also, here is some SVG-related code Google Gemini spat out, that runs and might be of use to you:
Code: (Select All)
' QB64PE 4.1.0 Program
' Draws a pool ladder graphic, similar to the provided SVG.
' We will use LINE and LINE...BF for the ladder,
' and a SIN function with LINE for the wavy water.
' Set up a 32-bit graphics screen
Screen _NewImage(640, 480, 32)
_Title "Pool Ladder"
' Define the colors from the SVG
' We'll use a dark grey for the ladder and a pool blue for the water.
Dim ladderColor As _Unsigned Long
Dim waterColor As _Unsigned Long
ladderColor = _RGB(70, 70, 70)
waterColor = _RGB(123, 175, 212)
' Clear the screen to white
Cls , _RGB(255, 255, 255)
' --- 1. Draw the Ladder ---
' We'll use LINE with the BF (Box Fill) option to draw solid rectangles.
' Define ladder geometry
Dim railLeftX As Integer
Dim railRightX As Integer
Dim rungWidth As Integer
Dim rungHeight As Integer
railLeftX = 290
railRightX = 350
rungWidth = railRightX - railLeftX
rungHeight = 8
' Draw the two main vertical rails
Line (railLeftX, 100)-(railLeftX + 10, 380), ladderColor, BF
Line (railRightX, 100)-(railRightX + 10, 380), ladderColor, BF
' Draw the three horizontal rungs
Line (railLeftX, 200)-(railRightX + 10, 200 + rungHeight), ladderColor, BF
Line (railLeftX, 260)-(railRightX + 10, 260 + rungHeight), ladderColor, BF
Line (railLeftX, 320)-(railRightX + 10, 320 + rungHeight), ladderColor, BF
' --- 2. Draw the Wavy Water Lines ---
' We'll use a SIN (sine) wave to calculate the Y position
' and a FOR...NEXT loop to draw it with LINE.
Dim x As Single
Dim y As Single
Dim yBase As Integer
Dim amplitude As Integer
Dim frequency As Single
' Define wave properties
amplitude = 10 ' How high/low the wave goes
frequency = 0.05 ' How frequent the waves are
yBase = 280 ' The vertical center of the first wave
' Draw the first wavy line
' Get the starting point
y = yBase + (Sin(100 * frequency) * amplitude)
PSet (100, y), waterColor
' Draw lines to all subsequent points
For x = 101 To 540
y = yBase + (Sin(x * frequency) * amplitude)
Line -(x, y), waterColor
' Draw a second line 1 pixel below to make it thicker
Line -(x, y + 1), waterColor
Next x
' Draw the second wavy line, slightly lower and offset
yBase = 300
' Get the starting point (offset phase with "+ 1")
y = yBase + (Sin(100 * frequency + 1) * amplitude)
PSet (100, y), waterColor
' Draw lines to all subsequent points
For x = 101 To 540
y = yBase + (Sin(x * frequency + 1) * amplitude)
Line -(x, y), waterColor
' Draw a second line 1 pixel below to make it thicker
Line -(x, y + 1), waterColor
Next x
' --- 3. Keep the window open ---
' Wait for a key press before exiting.
Print "Press any key to exit..."
Do
_Limit 100 ' Prevent 100% CPU usage
'LOOP WHILE _KEYHIT = ""
Loop Until _KeyDown(27)
End
