HISE Logo Forum
    • Categories
    • Register
    • Login

    loadImage - use in inline function

    Scheduled Pinned Locked Moved General Questions
    8 Posts 3 Posters 288 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.
    • DanHD
      DanH
      last edited by DanH

      I was previously loading this image via LAF but now I have to draw my knob in an inline function so how do I get the image back in? The below results in the image being undefined.... Obviously it's expecting a string

      const var HaloSlider = Engine.loadImageIntoPool("{PROJECT_FOLDER}H3 KB BACK 1.png");
      
      inline function drawModSlider(g, obj)
      {
      
      		g.drawImage(HaloSlider, obj.area, 10, 0);
      

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @DanH
        last edited by

        @DanH If this is a paint routine you load the image into the panel, if it's a look and feel function you load the image into the laf object.

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

        DanHD 1 Reply Last reply Reply Quote 0
        • DanHD
          DanH @d.healey
          last edited by

          @d-healey Is it either of those though? I'm drawing a Slider, so not a panel, and I'm not using LAF (I don't think?!)

          DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
          https://dhplugins.com/ | https://dcbreaks.com/
          London, UK

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @DanH
            last edited by

            @DanH I'll need to see more code to know what you're doing

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

            Christoph HartC DanHD 2 Replies Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @d.healey
              last edited by

              I'm pretty sure you'll be passing inline function drawModSlider(g, obj) into a registerFunction() call of a a LAF object, otherwise it won't do anything.

              DanHD 1 Reply Last reply Reply Quote 0
              • DanHD
                DanH @d.healey
                last edited by

                @d-healey

                //KnobLaf3.loadImage("{PROJECT_FOLDER}H3 KB BACK 1.png", "H3KBBK");
                const var HaloSlider = Engine.loadImageIntoPool("{PROJECT_FOLDER}H3 KB BACK 1.png");
                
                inline function drawModSlider(g, obj)
                {
                	local ar = Rectangle(obj.area).reduced(THICKNESS/2 + 2);
                	local n = Rectangle(0.0, 0.0, 1.0, 1.0);
                
                	local track = Content.createPath(); track.setBounds(n);
                	track.addArc(n, START-0.05, START + ARC_WIDTH+0.05);
                	
                	
                	if(obj.modulationDragState)
                	{
                		if(obj.modulationDragState == 2)
                		{
                			g.setColour(obj.itemColour1);
                		}
                		else
                		{
                			g.setColour(0x44FFFFFF);
                		}
                		
                		g.fillEllipse(ar.reduced(-THICKNESS/2 - 1));
                	}
                	
                	g.setColour(0x77000000);
                	g.drawPath(track, ar, THICKNESS);
                	
                	
                	local modRange = Content.createPath(); modRange.setBounds(n);
                	modRange.addArc(n, START + obj.modMinValue * ARC_WIDTH,
                					   START + obj.modMaxValue * ARC_WIDTH);
                					   
                	g.setColour(0x22FFFFFF);
                	g.drawPath(modRange, ar, THICKNESS - 2);
                	
                	local value = Content.createPath(); value.setBounds(n);
                	value.addArc(n, START + obj.valueNormalized * ARC_WIDTH,
                					START + Math.range(obj.scaledValue + obj.addValue, 0.0, 1.0) * ARC_WIDTH);
                					
                	g.setColour(obj.itemColour1);
                	g.drawPath(value, ar, THICKNESS - 4);
                	
                	local thumb = Content.createPath(); thumb.setBounds(n);
                	thumb.addArc(n, START + obj.valueNormalized * ARC_WIDTH - 0.01,
                					START + obj.valueNormalized * ARC_WIDTH + 0.01);
                	
                	g.setColour(Colours.white);
                	g.drawPath(thumb, ar, p);
                	
                	g.drawAlignedText(obj.valueAsText, ar, "centred");
                	g.setColour(0x55FFFFFF);
                	g.drawAlignedText(obj.text, ar, "centredBottom");
                }
                

                DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                https://dhplugins.com/ | https://dcbreaks.com/
                London, UK

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @DanH
                  last edited by

                  @DanH I don't see anywhere that you're applying the function to a component, but 99% sure it's going to be laf.

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

                  1 Reply Last reply Reply Quote 0
                  • DanHD
                    DanH @Christoph Hart
                    last edited by

                    @Christoph-Hart said in loadImage - use in inline function:

                    registerFunction()

                    ah ok that makes more sense 😆

                    I can see it now

                    DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
                    https://dhplugins.com/ | https://dcbreaks.com/
                    London, UK

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

                    30

                    Online

                    1.9k

                    Users

                    12.3k

                    Topics

                    107.1k

                    Posts