HISE Logo Forum
    • Categories
    • Register
    • Login

    Added getTrimmedBounds()

    Scheduled Pinned Locked Moved C++ Development
    boundsareapanel
    5 Posts 3 Posters 380 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.
    • d.healeyD
      d.healey
      last edited by

      This function is similar to getLocalBounds except you can specify an individual reduction for the top, left, bottom, and right of the rectangle.

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

      ustkU 1 Reply Last reply Reply Quote 4
      • ustkU
        ustk @d.healey
        last edited by

        @d-healey Hmm that is a very interesting one ;)

        Can't help pressing F5 in the forum...

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

          @ustk Peek 2022-02-02 18-47.gif

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

          Christoph HartC 1 Reply Last reply Reply Quote 3
          • Christoph HartC
            Christoph Hart @d.healey
            last edited by

            @d-healey Not sure if this needs to be part of the component class though. If you want to do some rectangle processing, you can easily write some helper functions in HiseScript. I've written a few helper classes that mimic the juce::Rectangle class:

            namespace Rect
            {
            	inline function reduced(area, amount)
            	{
            		return [ area[0] + amount, 
            				 area[1] + amount, 
            				 area[2] - 2 * amount, 
            				 area[3] - 2 * amount];
            	}
            	
            	inline function withSizeKeepingCentre(area, width, height)
            	{
            		return [ area[0] + (area[2] - width) / 2, 
            				 area[1] + (area[3] - height) / 2, 
            				 width, 
            				 height];
            	}
            	
            	inline function removeFromLeft(area, amount)
            	{
            		area[0] += amount;
            		area[2] -= amount;
            		return [area[0] - amount, area[1], amount, area[3]];
            	}
            	
            	inline function removeFromRight(area, amount)
            	{
            		area[2] -= amount;
            		return [area[0] + area[2], area[1], amount, area[3]];
            	}
            	
            	inline function removeFromTop(area, amount)
            	{
            		area[1] += amount;
            		area[3] -= amount;
            		return [area[0], area[1] - amount, area[2], amount];
            	}
            	
            	inline function removeFromBottom(area, amount)
            	{
            		area[3] -= amount;
            
            		return [area[0], area[1] + area[3], area[2], amount];
            	
            	}
            	
            	inline function translated(area, xDelta, yDelta)
            	{
            		return [area[0] + xDelta, area[1] + yDelta, area[2], area[3]];
            	}
            }
            

            Especially the removeFromXXX() methods are super awesome for layouting because you can slice the interface area.

            d.healeyD 1 Reply Last reply Reply Quote 2
            • d.healeyD
              d.healey @Christoph Hart
              last edited by

              @christoph-hart Are there any downsides to including in the component class?

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

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

              30

              Online

              1.7k

              Users

              11.8k

              Topics

              102.3k

              Posts