SVG Image tracing
-
I am trying to get SVG image tracking to work so I can trace an SVG logo. I found a thread:
https://forum.hise.audio/topic/6648/native-svg-import/2?_=1689096473430
In this thread @Christoph-Hart provided some great code for creating a flashing rotating icon.
SVG rotating logo:
const var atom = "243.nT6K8CF9.zzA.HQSp7AXGQO9msCBhJy1H+SMHfvbQbEcQ+2dyntPJAvIbmX.DL.gppGBqWQIsVp8DKFr162FctP0i0NLnwubgFWZVLTVHC3bIAdqhcRa+.c1TeTnVl4.gg8pt0ZOAkaW6QTtURRPbt.Z+qHhR4+3+Y9ztTFaX3iAvPWztikIdS+ASpsx8ZwXiiDWbjZOZVv8iPbCgpp0ZUnfzYAiag68pTDfvZcZu9HODwPn5KPFf.mRTo0Atn.7GvH.epfHf4tEuaMyPlj.CLYAhfW1KvVQ.pG9DiBrfFaaa.lrDIfMHEgpFwlRQzHLq2d."
It looks like the SVG data is in base 64 form.
Is this how we need to format the data for SVGs?Is there a tool that you use to convert SVG format to base 64?
-
@TNTHM Tools -> Convert SVG to Path data
Select Base64 SVG
Drag your SVG file in the window and copy the result -
@ustk Thank you!!
-
@ustk Can we use SVG data directly? Or does it need to be in Base 64?
-
@TNTHM Nope, you have to either convert it to Base64 or a Path, depending on your use case.
-
@ustk Any idea what this does?
-
@d-healey Yep it simply draws a Base64 SVG, so a SVG that has been converted with the tool above
-
@d-healey @TNTHM Sorry guys I forgot to mention the SVG object has to be created from the Base64 prior to drawing it...
HiseSnippet 1081.3ocsV0sbZaDEdE1JSLsoSyL8APiuBO3pQXSv3ISmZ9S.wfQfHXatIyhzJoMVZWYoUPfN4cnOf8gnuAs6h.CNwiaByTt.z4mOoOcNmuyhQD0BEGSi.RGLbdHBH8ixlyILuZdPLAztNP5mj6BiYnHkTWUmGBiiQ1.Io8ZJbHcv9fke96euJzGRrPabA.inXKTGb.lswqwEWh880g1ng3fsxt3EssnjZTeZBmO6IqABgV2AcQWAEokQFH8hF1XFMxjAYnXdNUo1yM8nyHo4OBGim3iDFE.l7aTp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k30+W4hjmFyI6.lS2ALE2ALuYGvTZGvb1Nfo7yhQ7WPpjv2fmJG3NLZrbMjjTCBjOYsbJD7u.LDRu4.
-
@ustk Is it necessary to convert it to Base64 SVG with the tool in HISE, or is there a way to script the conversion?
I notice that the SVG data is tagged with 243 at the beginning when using the HISE converter. Is this a conversion that is unique to HISE that we cannot perform with script?
-
@TNTHM Nope, it's uses the SVG parser from Juce and applies a Base64 conversion.
Then the object is reconverted to a path before drawing
The number at the beginning is inherent to any Base64 conversion, it appears in snippets too.