Forum
    • Categories
    • Register
    • Login

    Ellipse Masking // Mask makes shape dark.

    Scheduled Pinned Locked Moved Scripting
    11 Posts 5 Posters 38 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.
    • ChazroxC
      Chazrox
      last edited by

      @ustk Help please πŸ™

      David HealeyD dannytaurusD ustkU 4 Replies Last reply Reply Quote 0
      • David HealeyD
        David Healey @Chazrox
        last edited by

        @Chazrox Masks have a bug where they don't scale so I would avoid using them for now

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - HISE tutorials
        My Patreon - More HISE tutorials

        1 Reply Last reply Reply Quote 1
        • dannytaurusD
          dannytaurus @Chazrox
          last edited by

          @Chazrox I gave your post to Claude, here's the response. Might be helpful, I don't know! πŸ˜‚

          The issue is almost certainly the layer mode you opened before the mask, not the mask call itself.

          g.applyMask() only works inside a layer (g.beginLayer(...)), and the boolean you pass to beginLayer is what makes or breaks this:

          • g.beginLayer(false) draws your shape onto a fresh transparent layer. The mask then cuts that shape, and anything outside the ellipse becomes transparent. This is what you want.
          • g.beginLayer(true) makes the layer draw on top of the parent backdrop. Now the mask multiplies the whole composite (your grip plus the background under it) down toward black. Where the ellipse does not cover, everything gets darkened instead of cut, so the grip goes dark and almost disappears. That matches your screenshots exactly.

          Under the hood applyMask multiplies all four channels (R, G, B and alpha) by the mask coverage. On a transparent layer that gives a clean cut (masked pixels go fully transparent). On a draw-on-parent layer it just darkens.

          So the fix is to wrap it like this:

          g.beginLayer(false);   // fresh transparent layer, not drawOnParent
          
          // ... draw your pointer grip here ...
          
            var pgMaskPath = Content.createPath();
            pgMaskPath.addEllipse([0, 0, 1, 1]);
            g.applyMask(pgMaskPath, [cx - pgMaskR, cy - pgMaskR, pgMaskR * 2, pgMaskR * 2], false);
          
            g.endLayer();
          

          Two other things worth a quick check:

          1. Make sure pgMaskR is in pixels in the same coordinate space as the grip. If it ends up as a small fraction, the ellipse is tiny and masks almost everything to zero, which also reads as "dark".
          2. Your invert flag is false, so the mask keeps what is inside the ellipse. Flip it to true if you actually meant to keep the outside.

          Try beginLayer(false) first - that is the usual culprit for the darkening.

          Meat Beats: https://meatbeats.com
          Klippr Video: https://klippr.video

          ChazroxC 1 Reply Last reply Reply Quote 1
          • dannytaurusD
            dannytaurus @Chazrox
            last edited by dannytaurus

            @Chazrox But also, as David said, I thought masks were still buggy so keep that in mind as well.

            Meat Beats: https://meatbeats.com
            Klippr Video: https://klippr.video

            1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @Chazrox
              last edited by ustk

              @Chazrox I second Dave on this, masks are wild beats that don't let you control them easily...
              Zoom issues and more. I recently managed to fix the zoom issue but it was causing exported plugin to crash (at least i suspected this) and I haven't had the time yet to give it to an AI to chew...

              Now your problem, try to begin the layer before any drawing and it'll work. I don't know why though, wild beasts I said... I used it freely in te middle of a paint routine before with no issues but it was another day in parad'Hise...

              Hise made me an F5 dude, any other app just suffers...

              ChazroxC 1 Reply Last reply Reply Quote 1
              • Oli UllmannO
                Oli Ullmann @Chazrox
                last edited by

                @Chazrox
                @ustk

                And another one... 😁

                masks.png

                ustkU ChazroxC 2 Replies Last reply Reply Quote 1
                • ustkU
                  ustk @Oli Ullmann
                  last edited by

                  @Oli-Ullmann πŸ‘ 🀣

                  Hise made me an F5 dude, any other app just suffers...

                  1 Reply Last reply Reply Quote 1
                  • ChazroxC
                    Chazrox @Oli Ullmann
                    last edited by

                    @Oli-Ullmann πŸ’€ Faaaah πŸ˜‚

                    1 Reply Last reply Reply Quote 1
                    • ChazroxC
                      Chazrox @ustk
                      last edited by

                      @ustk I was having the scaling problem when I use obj.area as the mask area. Defining the area to the exact shape worked for me on other layers. The scaling problem wasnt happening with those layers so I thought it was fixed….then I tried to do this and met β€œthe beast”. πŸ˜‚

                      tbh I’ll keep trying to find a way for a little bit.
                      If I come back with a black eye just dont say you told me so. haha

                      1 Reply Last reply Reply Quote 1
                      • ChazroxC
                        Chazrox @dannytaurus
                        last edited by

                        @dannytaurus I guess it is a little weird. Thanks for sacrificing your tokens for me! ha πŸ™πŸ½ I owe you one.

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

                        12

                        Online

                        2.4k

                        Users

                        13.8k

                        Topics

                        120.2k

                        Posts