HISE Logo Forum
    • Categories
    • Register
    • Login

    Layers and Gaussian blurs.....

    Scheduled Pinned Locked Moved General Questions
    2 Posts 1 Posters 205 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.
    • LindonL
      Lindon
      last edited by

      Okay can anyone explain this to me?

      I'm trying to draw a button with a rectangle around its edge and some text inside - all possible,

      now I'd like to add an ellipse and to have it blurred...

      I have this code in my laf callback

      laf.registerFunction("drawToggleButton", function(g, obj)
      {
      	var a = obj.area;
      	
      	g.beginLayer(true);
      	g.setColour(obj.bgColour);
      	g.drawRect([0,10,a[2],a[3]-20],1+ obj.value);
      	g.drawAlignedText(obj.text, [0,10,a[2],a[3]-20], "centred");
      	g.endLayer();
      	if (obj.value)
      	{
      		g.beginLayer(true);
      		g.setColour(obj.itemColour1);
      		g.fillEllipse([0,a[3]-10,a[2],5]);
      		g.gaussianBlur(3);
      		g.endLayer();
      	}
      });
      

      This just blurs everything when the button is on, so I clearly dont understand how to use layers - or they are not supposed to be used to get this effect, and if not how do I do it?

      HISE Development for hire.
      www.channelrobot.com

      LindonL 1 Reply Last reply Reply Quote 0
      • LindonL
        Lindon @Lindon
        last edited by Lindon

        @lindon --and random value setting comes to the rescue again - why oh why is none of this documented anywhere?

        do this:

        laf.registerFunction("drawToggleButton", function(g, obj)
        {
        	var a = obj.area;
        	
        	g.beginLayer(true);
        	g.setColour(obj.bgColour);
        	g.drawRect([0,10,a[2],a[3]-20],1+ obj.value);
        	g.drawAlignedText(obj.text, [0,10,a[2],a[3]-20], "centred");
        	g.endLayer();
        	if (obj.value)
        	{
        		g.beginLayer(false);
        		g.setColour(obj.itemColour1);
        		g.fillEllipse([0,a[3]-10,a[2],5]);
        		g.gaussianBlur(3);
        		g.endLayer();
        	}
        });
        

        see that false there in the second layer?

        HISE Development for hire.
        www.channelrobot.com

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

        57

        Online

        1.7k

        Users

        11.7k

        Topics

        101.8k

        Posts