HISE Logo Forum
    • Categories
    • Register
    • Login

    How Do You Use "withMultipliedAlpha"?

    Scheduled Pinned Locked Moved Solved General Questions
    8 Posts 3 Posters 191 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

      How Do You Use "withMultipliedAlpha"? (I've read the docs, but am still unclear.) Thank you.

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

        No idea, to me it seems to behave no differently than the .withAlpha function. Possibly this function is for use with images that have an alpha channel, but I'm just guessing.

        This is from the AI

        withMultipliedAlpha is a method of the Colour class in JUCE (a cross-platform C++ library for audio processing and GUI development). It returns a new Colour object that is the same as the original, but with its alpha value multiplied by a given factor.

        The alpha value of a Colour object represents its transparency, with a value of 1.0 being fully opaque and a value of 0.0 being fully transparent. Multiplying the alpha value by a factor less than 1.0 will reduce the overall transparency of the colour, while multiplying it by a factor greater than 1.0 will increase the transparency.

        But my test project doesn't seem to do anything special compared to withAlpha

        HiseSnippet 1001.3ocsV8taaaCDmzIJq1aoXcnO.DEX.x.dt1qMYCnXnNwNovnKoByoA6aczRTVDlhTPjJItE8a64YuB6YYuA6MX6HkbrxpmWqAl+fgNd+62c7teRA4pPlVqxQ3lWrHigveg2jERSxvDJWhFOBguu2YTsgkSJO53EYTslEgv3cdg8.bycQte+4yOlJnxP1piPnKU7P1OxS4lUmFL3kbg3TZD6BdZMqe5fwgJ4PkPU.3YGudnLZ3b5L14TqYM7P38NIhaT4SLTCSC1brJZwjD00xR6ujq4SELqPezDHPkGiFlvEQAKqUMBg2MXUkuSYk+Puy3Q7aOeUG3KcJHq7ndO.2XSPp+m.jv0fztkP5AdSBy4YlUZr34y8FKgKjXJzpqCkRaQMjM7Fp.Kjltoz4rSyAga8v+vd85Pf+Z+rVsf1s1PthlSBnRlnO4GHK8bFyLTklojff+iJU+HqOkO1UyLAPCx7SpBCWx7iKjgFtR5Oqcq20poMlgtaRWLsOn6dM2jbjHKg5u7johBVGRutGz9YjG+3JCIbM4fdeMgZMsUyVMm0MFFXNRH7qGoyJDFdlfyhJiYY55PdoTMsuE+WRgn62tMf52e2p0Yx+Zw5z5pUtT.0FYYsQTRmNqa4JAjwJe5.QExkqxq5O4rLa6w2lbHRaLS1lYULGREhovTu+cSEDkZf3bkg8JouKcsdeKx+TUb7Z0UEKAKespsKi4axQeYQ5TVd8h0ZHLsd2Uf893VABKaI0LTIGK4lWkwpjOUIhri11m+vEFTUOEd50iGQMT6NT0YfcYrbC2BG7H1U.IT4FUSuQL8biJC3St8h.frwoc+k6a16PDGR887JuOQ2rhm5hAKVILZv07HSBB6gODiPIL9rDiUpC1AwaSw9ko39UoXhfGwxc43y7bW00Rw.VsT7K2LPaVX6e64LDkxihDr.klauepQ.+6.Oc1D9acbpu6g+1K9i29qOOsNGMBkRuoNkstHNleiibE1wR0F.aiSANWD9q7dslQhXwTXQinmCwA1FlyhtP4rWSuhMVFjyfoWK8C5C4u.lSUTgfZtKcp88FUJrEPcNLKOkDJrE0A4m.GauMxw9wBwG3EvMgIqGiMVCFgQu+OvX0al126j3XVnYE.206zedaeMz+Q5KIzmcFEFEfACuyKRm.7pgLH6RXUPaGtaXmsKk6YkscfILYjS3ufeUJ6akwUJ6uTILDFlqdSXIsh8ce2ycBfIo6U8Mgu4.jI8QNpFvOudc6YG74uILzV9eSeDZ897sagOOYK74oagOGrE9b3V3y2sE978azG6W.cTgQkVtN.GDbhiyEiOQRgIK2TH5uAfoXXKB
        

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

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

          @d-healey It's pretty self explanatory - that's why ChatGPT managed to answer it correctly...

          • withAlpha() sets the alpha value regarding of what alpha value was before, so withAlpha(0x66000000, 0.5) yields 0x80000000
          • withMultipliedAlpha() multiplies the existing alpha value, so withMultipliedAlpha(0x66000000, 0.5) yields 0x33000000
          d.healeyD clevername27C 2 Replies Last reply Reply Quote 2
          • d.healeyD
            d.healey @Christoph Hart
            last edited by

            @Christoph-Hart So why doesn't my example do anything interesting?

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

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

              @Christoph-Hart said in How Do You Use "withMultipliedAlpha"?:

              @d-healey It's pretty self explanatory - that's why ChatGPT managed to answer it correctly...

              • withAlpha() sets the alpha value regarding of what alpha value was before, so withAlpha(0x66000000, 0.5) yields 0x80000000
              • withMultipliedAlpha() multiplies the existing alpha value, so withMultipliedAlpha(0x66000000, 0.5) yields 0x33000000

              What would the syntax be? I'm thinking something like this (but not this):

              g.setColour(Colour::withMultipliedAlpha(g.get("itemColour"), 0.5);

              1 Reply Last reply Reply Quote 0
              • clevername27C
                clevername27 @d.healey
                last edited by clevername27

                @d-healey I think this is simply one of the Great Mysteries of HISE. 🐥

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

                  I know that HISE has a few places of mystery, but this isn't one of them.

                  You use the Colour class with Colours.withXXX(), the first argument is always a colour and the second a float number that does something with it. This is directly taken from the JUCE API and as self-explanatory as it can get.

                  So why doesn't my example do anything interesting?

                  If you change the function to withAlpha, you'll notice that the blue gets 100% alpha, instead of 50% alpha max when the knob is turned up.

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

                    @Christoph-Hart Thank you, Chris.

                    1 Reply Last reply Reply Quote 0
                    • clevername27C clevername27 has marked this topic as solved on
                    • First post
                      Last post

                    49

                    Online

                    1.7k

                    Users

                    11.7k

                    Topics

                    102.2k

                    Posts