generated from treeform/nimtemplate
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Hi,
I really like your ideas from fidget, but I was getting a bunch of errors with exported code (and even your more complex included demos) so I thought I would try to load the SVG on it's own, so at least the static parts would be all set, and I could add in dynamic parts. I am trying to make a UI (for a steamdeck-OS looking app) using an SVG outputted from figma:
And I get errors like this:
Error: unhandled exception: Missing SVG resource paint0_radial_3_427 [PixieError]
For things like this:
<rect width="1440" height="900" fill="url(#paint0_radial_3_427)" fill-opacity="0.2"/>That are in <defs> like this:
<radialGradient id="paint0_radial_3_427" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(48 106) rotate(23.0285) scale(1304.99 2087.99)">
<stop stop-color="white"/>
<stop offset="1" stop-color="white" stop-opacity="0"/>
</radialGradient>I thought it might be that it was using urls before the <defs> (figma puts them at the end) but re-arranging it did not help. If I remove all the fill="url(#WHATEVER)" stuff, it works, but is missing all the fills, obviously.
Here is the code I am using (window-scaling stuff from boxy#56):
import boxy, opengl, windy
let windowSize = ivec2(1440, 900)
let window = newWindow("Boxy Example", windowSize)
makeContextCurrent(window)
loadExtensions()
let bxy = newBoxy()
bxy.addImage("details", readImage("details.svg"))
let ratio = windowSize.x / windowSize.y
var scale = 1.0
var offset = vec2(0, 0)
var vs:Vec2
let ws = windowSize.vec2
window.onFrame = proc() =
vs = window.size.vec2
if vs.x > (vs.y * ratio):
scale = vs.y / ws.y
offset.x = (vs.x - (ws.x * scale)) / 2
offset.y = 0
else:
scale = vs.x / ws.x
offset.y = (vs.y - (ws.y * scale)) / 2
offset.x = 0
bxy.beginFrame(window.size)
bxy.saveTransform()
bxy.translate(offset)
bxy.scale(scale)
bxy.drawImage("details", vec2(0, 0))
bxy.restoreTransform()
bxy.endFrame()
window.swapBuffers()
while not window.closeRequested:
pollEvents()Metadata
Metadata
Assignees
Labels
No labels