HISE Logo Forum
    • Categories
    • Register
    • Login

    Add This to HISE's API?

    Scheduled Pinned Locked Moved Feature Requests
    3 Posts 2 Posters 305 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.
    • clevername27C
      clevername27
      last edited by clevername27

      // Brighten or dim a widget using + or - from 0.0 to 0.1. Unlike the HISE "withBrightness" code, this function can 
      // also increase brightness. The loops are all unrolled in the code here for those who are learning.(Otherwise, 
      // this routine could be done in just a couple lines.)
      
      inline function WithSignedBrightness(uint32Colour, brightnessAdjustment) {
      
      	// Convert the uint32Colour to an array of component floats.
      	local colourArray = Colours.toVec4 (uint32Colour);
      	
      	// Do red.
      	local componentRed = colourArray[0];	
      	componentRed += brightnessAdjustment;
      	if (componentRed < 0.0) componentRed = 0.0;	if (componentRed > 1.0) componentRed = 1.0;
      	colourArray[0] = componentRed;
      
      	// Do blue.
      	local componentBlue = colourArray[1];	
      	componentBlue += brightnessAdjustment;
      	if (componentBlue < 0.0) componentBlue = 0.0; if (componentBlue > 1.0) componentBlue = 1.0;
      	colourArray[1] = componentBlue;
      	
      	// Do green.
      	local componentGreen = colourArray[2];	
      	componentGreen += brightnessAdjustment;
      	if (componentGreen < 0.0) componentGreen = 0.0;	if (componentGreen > 1.0) componentGreen = 1.0;
      	colourArray[2] = componentGreen;
      
      	// Convert the array of floats back into a uint32Colour.
      	local NewColour = Colours.fromVec4(colourArray);
      	
      	// Return our new colour.
      	return NewColour;
      };
      
      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @clevername27
        last edited by

        @clevername27 withMultipliedBrightness() can make stuff brighter, no?

        clevername27C 1 Reply Last reply Reply Quote 1
        • clevername27C
          clevername27 @Christoph Hart
          last edited by

          @Christoph-Hart https://youtu.be/JQH2rmQ5-vk?si=tgGTwfUe_1Swmi81

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

          20

          Online

          1.8k

          Users

          12.1k

          Topics

          105.3k

          Posts