Forum
    • Categories
    • Register
    • Login

    Multi-shape and multi-colour SVG

    Scheduled Pinned Locked Moved Solved General Questions
    16 Posts 6 Posters 136 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dannytaurusD
      dannytaurus @David Healey
      last edited by dannytaurus

      @David-Healey Thanks. The text isn't a problem. I converted that to SVG and it's fine.

      It's the multiple shapes that I'm struggling with.

      I found that if I change the option from Base64 Path to Base64 SVG in the SVG tool, I do see the SVG in full in the preview. But when I paste that path code into HISE it doesn't draw the shapes.

      CleanShot 2025-12-09 at 14.58.41@2x.png

      const var pathData = "260.nT6K8CVlCT8A.H0Rk3ATIQOIYSfkMRTT9Afpx.lLtHfB6Z6ksFSUJT0vlJK.EbVJpUguquLTnXHEtqrJPciLg4S+NLGZRXbYf3.Szf9aHlOUJ2NiU7kuPTra3JBT3UJIvAhWP+M7qx3rDPg1YonTJoPtm4w5dbuWDZ.mZ80OUFQHA2M4T1eLBOfSXbhS8mXZ31fVu+5yAaOtSX8+pMvK6rzks.ZPxHJP4cLWy.j0LDpC.fgMhoviJeqv3pQkNdIFRQnm5.0HlJenz.QWMr7cPLCSLfexWqQroCgOsDH8UiH+Fv72EP+kAabjNmZAIYNHjb.xa1hrLd7DvYgazbTtKX1AfTA"
      

      Meat Beats: https://meatbeats.com
      Klippr Video: https://klippr.video

      1 Reply Last reply Reply Quote 0
      • dannytaurusD
        dannytaurus @David Healey
        last edited by

        @David-Healey Here's the SVG code:

        <svg width="48" height="18" viewBox="0 0 48 18" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M16.5003 9C21.5003 -1 26.5003 -1 31.5003 9C36.5003 19 41.5003 19 46.5003 9" stroke="black" stroke-width="3" stroke-linecap="round"/>
        <path d="M16.5003 9C21.5003 -1 26.5003 -1 31.5003 9C36.5003 19 41.5003 19 46.5003 9" stroke="#393939" stroke-linecap="round"/>
        <path d="M11.5003 9C16.5003 -1 21.5003 -1 26.5003 9C31.5003 19 36.5003 19 41.5003 9" stroke="black" stroke-width="3" stroke-linecap="round"/>
        <path d="M11.5003 9C16.5003 -1 21.5003 -1 26.5003 9C31.5003 19 36.5003 19 41.5003 9" stroke="#666666" stroke-linecap="round"/>
        <path d="M6.50034 9C11.5003 -1 16.5003 -1 21.5003 9C26.5003 19 31.5003 19 36.5003 9" stroke="black" stroke-width="3" stroke-linecap="round"/>
        <path d="M6.50034 9C11.5003 -1 16.5003 -1 21.5003 9C26.5003 19 31.5003 19 36.5003 9" stroke="#B3B3B3" stroke-linecap="round"/>
        <path d="M1.50034 9C6.50033 -1 11.5003 -1 16.5003 9C21.5003 19 26.5003 19 31.5003 9" stroke="black" stroke-width="3" stroke-linecap="round"/>
        <path d="M1.50034 9C6.50033 -1 11.5003 -1 16.5003 9C21.5003 19 26.5003 19 31.5003 9" stroke="white" stroke-linecap="round"/>
        </svg>
        
        

        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        Christoph HartC 1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @dannytaurus
          last edited by

          @dannytaurus You need to use this method instead of createPath():

          https://docs.hise.audio/scripting/scripting-api/content/index.html#createsvg

          dannytaurusD 1 Reply Last reply Reply Quote 2
          • dannytaurusD
            dannytaurus @Christoph Hart
            last edited by

            @Christoph-Hart Awesome! Thanks!

            Got it working with the help of Claude once I knew which method to use.

            Meat Beats: https://meatbeats.com
            Klippr Video: https://klippr.video

            dannytaurusD 1 Reply Last reply Reply Quote 1
            • dannytaurusD
              dannytaurus @dannytaurus
              last edited by dannytaurus

              Snippet for my own future reference, and anyone else that might need it.

              ⚠️ Don't use the icon as-is though. That's my design! 😜

              HiseSnippet 1227.3ocsVstaiZDEFRBQMtcq5J0G.TT+g2lHViuGsppqut1N9BIfSb7e1NFFfIFlg.CNwoZe15qTeCZmAeMMQ6EKU9gEmqymOmy7cPKjXBihHgBhoLlG.ED+AI84XpaMW.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0Nxt9+TNkC+53TLWzY2xQBtMFQGD.WJ2j3Yw4J3u+bFHgkiFr2F1lOiwIkVpi4W.Ljh3vQrNbFaMvBJpijpCilRIAI95GPv7LHdHMw5qVQfw6rBHKN405NsvCBhRh6wNt47WjYujLmwR5g+wxENKFt3Z9kU6fdNMIiflXE6AnOk0luOaoAVY+ITkb5PbDhNe68ceCT4Y9rT4esP70RZHpo6Kiw8dALxZH+efwkK.ekTCaanIcC.OPp4ncca2W33Wb61oGfFh3yA8i80YenfIjc5X1vQzpYikxY3x7JfNDakH7OrmkFU4xhKMptxnfOvLj7QyEW13qX+tDMLLgS9DjiXeKDSVVUH4B310Ye1F+OZZ9zT8r.ytqAlaWCL+tFXgcMvh6Zfk10.K+kCj+AYUhoD+EWaDD5o0HgwRTrAFvl.SlVE9WPzFjRm
              

              Here's the script on its own - it creates a panel and draws the logo inside:

              Content.makeFrontInterface(100, 100);
              
              // Create the SVG path using SVG tool on 'Base64 SVG' setting
              var pathData = "260.nT6K8CVlCT8A.H0Rk3ATIQOIYSfkMRTT9Afpx.lLtHfB6Z6ksFSUJT0vlJK.EbVJpUguquLTnXHEtqrJPciLg4S+NLGZRXbYf3.Szf9aHlOUJ2NiU7kuPTra3JBT3UJIvAhWP+M7qx3rDPg1YonTJoPtm4w5dbuWDZ.mZ80OUFQHA2M4T1eLBOfSXbhS8mXZ31fVu+5yAaOtSX8+pMvK6rzks.ZPxHJP4cLWy.j0LDpC.fgMhoviJeqv3pQkNdIFRQnm5.0HlJenz.QWMr7cPLCSLfexWqQroCgOsDH8UiH+Fv72EP+kAabjNmZAIYNHjb.xa1hrLd7DvYgazbTtKX1AfTA";
              const var pluginLogo = Content.createSVG(pathData);
              
              // Create a panel for the logo
              const var logoPanel = Content.addPanel("logoPanel", 2, 32);
              logoPanel.set("width", 96);
              logoPanel.set("height", 36);
              logoPanel.set("saveInPreset", false);
              
              // Draw the logo
              logoPanel.setPaintRoutine(function(g)
              {
                  var a = this.getLocalBounds(0);
                  g.drawSVG(pluginLogo, a, 1.0);
              });
              

              Meat Beats: https://meatbeats.com
              Klippr Video: https://klippr.video

              dannytaurusD ChazroxC 2 Replies Last reply Reply Quote 2
              • dannytaurusD dannytaurus marked this topic as a question
              • dannytaurusD dannytaurus has marked this topic as solved
              • dannytaurusD
                dannytaurus @dannytaurus
                last edited by

                I'll add that the beauty of using the 'Bas64 SVG' mode of the SVG tool is that your source SVG can be a mix of fills and stroked paths and they will all convert nicely to HISE format.

                Using the 'Base64 Path' mode expects filled paths only. Stroked paths are converted to fills and often look weird because the ends of the stroked path are considered to be joined as a fill.

                Meat Beats: https://meatbeats.com
                Klippr Video: https://klippr.video

                ustkU 1 Reply Last reply Reply Quote 1
                • ChazroxC
                  Chazrox @dannytaurus
                  last edited by

                  @dannytaurus crazy. So you can access these different layers colours individually in laf? (yes im being lazy and not opening the snip ha)

                  1 Reply Last reply Reply Quote 0
                  • ustkU
                    ustk @dannytaurus
                    last edited by ustk

                    @dannytaurus said in Multi-shape and multi-colour SVG:

                    Using the 'Base64 Path' mode expects filled paths only. Stroked paths are converted to fills and often look weird because the ends of the stroked path are considered to be joined as a fill.

                    Well it depends on how you create your SVG. If the origin is a stroke path then you need to draw in Hise, and if it's plain shape then you'll want to fill.

                    Both methods have their pros & cons.

                    • Base64 can have only one colour, but the colour can be dynamic
                    • SVGs can have multiple colours, but they are fixed (this answers @Chazrox as well). I also had bad experiences if your SVG has gradients, they don't translate well unfortunately.

                    In order to limit importation issues, I always save my SVGs as flat combined paths. (except if I need the SVG method in Hise of course...)

                    Hise made me an F5 dude, browser just suffers...

                    dannytaurusD 1 Reply Last reply Reply Quote 0
                    • dannytaurusD
                      dannytaurus @ustk
                      last edited by

                      @ustk Yes, both have their advantages.

                      For things like logos or complex icons, I think I'll always use Base64 SVG from now on because it has the flexibility of allowing a mix of stroked paths and solid fills, along with multiple colours.

                      If I need to use simpler vector that require a dynamic colour, like knob markers, I'll use Base64 Path.

                      Meat Beats: https://meatbeats.com
                      Klippr Video: https://klippr.video

                      1 Reply Last reply Reply Quote 0
                      • Felix WF
                        Felix W
                        last edited by

                        This is an interesting approach, but Base64 SVG doesn't seem to work on the Button component. I've tried a few methods, but they haven't worked. Does anyone have a solution?

                        //I am a new student at HISE._
                        //Windows11 & MacOS Ventura 13.6.7_

                        David HealeyD ChazroxC dannytaurusD 3 Replies Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @Felix W
                          last edited by

                          @Felix-W said in Multi-shape and multi-colour SVG:

                          This is an interesting approach, but Base64 SVG doesn't seem to work on the Button component. I've tried a few methods, but they haven't worked. Does anyone have a solution?

                          Got a snippet?

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          1 Reply Last reply Reply Quote 0
                          • ChazroxC
                            Chazrox @Felix W
                            last edited by

                            @Felix-W It does work for me. Post a snip.

                            1 Reply Last reply Reply Quote 0
                            • dannytaurusD
                              dannytaurus @Felix W
                              last edited by

                              @Felix-W Try this (put a button in the UI with name 'btn1'):

                              Content.makeFrontInterface(100, 100);
                              
                              const pathData = "260.nT6K8CVlCT8A.H0Rk3ATIQOIYSfkMRTT9Afpx.lLtHfB6Z6ksFSUJT0vlJK.EbVJpUguquLTnXHEtqrJPciLg4S+NLGZRXbYf3.Szf9aHlOUJ2NiU7kuPTra3JBT3UJIvAhWP+M7qx3rDPg1YonTJoPtm4w5dbuWDZ.mZ80OUFQHA2M4T1eLBOfSXbhS8mXZ31fVu+5yAaOtSX8+pMvK6rzks.ZPxHJP4cLWy.j0LDpC.fgMhoviJeqv3pQkNdIFRQnm5.0HlJenz.QWMr7cPLCSLfexWqQroCgOsDH8UiH+Fv72EP+kAabjNmZAIYNHjb.xa1hrLd7DvYgazbTtKX1AfTA";
                              const logoPath = Content.createSVG(pathData);
                              
                              const laf = Content.createLocalLookAndFeel();
                              
                              laf.registerFunction("drawToggleButton", function(g, obj)
                              {
                                  var a = obj.area;
                                  g.drawSVG(logoPath, a, 1);
                              });
                              
                              Content.getComponent("btn1").setLocalLookAndFeel(laf);
                              

                              Meat Beats: https://meatbeats.com
                              Klippr Video: https://klippr.video

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post

                              39

                              Online

                              2.1k

                              Users

                              13.0k

                              Topics

                              113.0k

                              Posts