HISE Logo Forum
    • Categories
    • Register
    • Login

    Drawing Lines ...

    Scheduled Pinned Locked Moved Scripting
    5 Posts 3 Posters 383 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.
    • oskarshO
      oskarsh
      last edited by oskarsh

      Hey would love to understand how to properly draw lines. I cannot wrap my head around it.

      So I noticed, when just drawing one line it will always be diagonal.

      What I am doing is to add a

      p.startNewSubPath(0, 0);
      

      which should add a starting point at 0, 0

      I then want to draw a line to the middle of the screen, using

      p.lineTo(0.5, 0.5);
      

      is that even right? The line always stays vertical no matter what values I enter. The only control I get over the lines is if I add 2 lines.

      But then it does not seem to be as simple like draw line from 0, 0, to 150, 150. Maybe someone could explain how to properly draw lines in HISE. What are the ranges these paths work in?

      Here is a snippet to play around with.

      HiseSnippet 823.3ocsU00aSCCE0oaAQKLDShe.Q7TlzzT6XLPBgnrtMTErQDcLAOM44bai0bribbnTg3GLuw+.3531lTnCPUr9Pate1iu4btNRqXPdtRS7Zd1jLf3cW+ASjljdITtjz+Ph287Ogla.cfy0ASxn44PLwyasWYc30bcR4mu+hCnBpjAUtHjyUbF7FdJ2T4Mp6q4BwwzX3LdZsr2qaelR1SITEHdVyuMIixthNBNkZSqgOw6VGEyMJ8.C0.4Du0OPEOYPhZrzk+47b9kBvZzgL.ajy8wJQrEwVujdIbQbzrycNA6RT0TXM2T3A9mvi4y8WMMteYffpJpOO7ZrH7VaA30oN7ZWCdKARd0fz5NHso+.llmYphXwyc76KwWNCo3XuNTb4RZ7MO+dJLCoYmT5UvwZzXdEg62t81A3Wa8rVsvQetI3STcPDUBhNAOOXVki.SOUZlRhFgOzE9g1ZZ4ddmbvDgSHy6TEFtDBGVHYFtRFNZqfuzpYql11RwNZR34118FEiJNPUHiyC6fcBSYjsKtW9gtex2YBHDpwiz.HcIY6SVMjwz.NpinljPaBY6vD.UO84bCUaNEFOn3xxLvyZaWDABxyTg69qN5rcvbzDqoiKKKa6.5L+ecqYGs.k7TkAdqLbqV1i3WaE7qgFNbowrXWqDBPuzvVMg9OUXnrH8RPuM9tRT.ySDIJKx97ud1WcwAyMJqknR1WxMuMCjWmjgLc9iO899GRMTKkcpOLuLPa3VH3cH7IT+6HvM8ODxuxnxJycJcBkzlxnaLidaYTDNRhusuicQ9b0JBd2IUFer6XdrIYtitptI.eThotGxuqjPMrJtPPMKJrsaylF.m2KnlrJFYN2Lo91t+ap8+UHtoeD2vRVNFarDLhuUtIv3zcja3ezvg.yTAv08O9C2LKDItMKiNgZzbjO3eZQ5.bEACv+cIxRr7cuFVloyts01NAF.x3RiefelFri01aZvNyBRRoLs5BlSkY2Be6ROHljkW.0DuIDsC5PJUd0myo3kBWvXK1peqvcW0BezpV3dqZgOdUKb+UsvmrpE9z+dg16reYgQk5jMDxIQGUt1xy6HIEYfkrUxOAUuxezC
      

      HISE Developer for hire :)

      d.healeyD ulrikU 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @oskarsh
        last edited by

        @oskarsh I use g.drawHorizontalLine()

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        oskarshO 1 Reply Last reply Reply Quote 0
        • oskarshO
          oskarsh @d.healey
          last edited by

          @d-healey the vertical and horizontal line drawing works as expected but would love to draw using the path so that I can use roundCorners, getPointOnPath()

          HISE Developer for hire :)

          1 Reply Last reply Reply Quote 0
          • ulrikU
            ulrik @oskarsh
            last edited by

            @oskarsh here I use the height and width from the panel to make the lines area with "path.getBounds(1)

            Panel1.setPaintRoutine(function(g) {
            	
            	var a = this.getLocalBounds(1);
            	
            	g.setColour(Colours.yellowgreen);
            	
            	var p = Content.createPath();
            	p.clear();
            	p.startNewSubPath(0, 0);
            	p.lineTo(a[2]/2, a[3]/2);
            	
            	/*	line back to x 0, y max	
            	p.lineTo(0, a[3]);	
            		back to the start
            	p.lineTo(0, 0);
            	*/
            	
            	//	here I use the "path.getBounds()" for the area
            	var pathArea = p.getBounds(1);
            	g.drawPath(p, pathArea, 1);
            	
            })
            

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

            oskarshO 1 Reply Last reply Reply Quote 0
            • oskarshO
              oskarsh @ulrik
              last edited by

              @ulrik Thanks. I think I was missing the p.getBounds(1) for the area use.

              Also when drawing multiple lines I figured that the second line will start at the end of the last line. If you want to draw it from a point always start a new subpath.

              Thanks alot!

              HISE Developer for hire :)

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

              41

              Online

              1.7k

              Users

              11.7k

              Topics

              102.3k

              Posts