HISE Logo Forum
    • Categories
    • Register
    • Login

    Drop Shadow for Text

    Scheduled Pinned Locked Moved Feature Requests
    10 Posts 3 Posters 700 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.
    • A
      aaronventure
      last edited by

      Currently it's not possible to drop-shadow text, as text cannot be added to a path object. Goes for paint routines and LAF.

      The missing method would either draw drop shadow for the text, could use the same parameters like drawAlignedText, with added radius of course.

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

        @aaronventure Does addDropShadowFromAlpha work?

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

        A Christoph HartC 2 Replies Last reply Reply Quote 0
        • A
          aaronventure @d.healey
          last edited by

          @d-healey on a panel paint routine no, that's meant for inset shadow, shading on top of the text itself.

          Also it breaks if you zoom past 200%, at least in HISE :face_with_tears_of_joy:

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

            Yes, this should work:

            const var Panel1 = Content.getComponent("Panel1");
            
            Panel1.setPaintRoutine(function(g)
            {
            	g.setColour(Colours.red);
            	g.setFont("Lato Bold", 24.0);
            	g.drawAlignedText("FUNKY", this.getLocalBounds(0), "centred");
            	g.addDropShadowFromAlpha(Colours.red, 15);
            	g.setColour(Colours.white);
            	g.drawAlignedText("FUNKY", this.getLocalBounds(0), "centred");
            });
            

            The melatonin blur has a text shadow renderer, so in the long run this will find its way into the HISE Graphics API, but it's not on my immediate TODO list.

            Christoph HartC A 3 Replies Last reply Reply Quote 2
            • Christoph HartC
              Christoph Hart @Christoph Hart
              last edited by

              Also it breaks if you zoom past 200%

              Everything breaks if you zoom past 200% (with retina displays you're then at 400% zoom and I had to cap it somewhere).

              1 Reply Last reply Reply Quote 1
              • A
                aaronventure @Christoph Hart
                last edited by

                @Christoph-Hart Alright gotcha, this is good enough for now.

                It seems like the shadow is always the same size no matter the zoom (drop shadow from path scales with zoom properly) and there's a size cap as well?

                1 Reply Last reply Reply Quote 0
                • A
                  aaronventure @Christoph Hart
                  last edited by

                  @Christoph-Hart If you have a graphic that uses more than one color but want to simulate a glow, there's no clear best method without resorting to the blur function (which is bit of a mess).

                  Option 1: Use a separate panel for each color. Not ideal, hot mess to iterate.

                  Option 2: Use layers with g.dropShadowFromAlpha. Putting anything in a layer rasterises it, which means clarity with anything other than non-rotated rectangles suffers when zooming. There's also the dropShadowFromAlpha bug where it doesn't scale if it's called from within a layer https://github.com/christophhart/HISE/issues/525

                  I hear your comment about a future dropShadowFromText implementation using melatonin blur, and that would pretty much cover it all.

                  Until then, how crazy would it be to add a g.dropShadowFromAlphaColoured that doesn't take a color because it samples the colors it causes drop shadows for, but takes opacity instead?

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

                    The future is now.

                    Link Preview Image
                    HISE | Scripting | Graphics

                    Panel drawing functions

                    favicon

                    (docs.hise.audio)

                    A 2 Replies Last reply Reply Quote 3
                    • A
                      aaronventure @Christoph Hart
                      last edited by

                      @Christoph-Hart Oh boy. Instant docs, too!

                      Thanks. This was the final missing piece for creating glowing effects.

                      That library looks spankin'. These benchmarks look really good. JUCE looks horrible in there for standard drop shadows too.

                      1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @Christoph Hart
                        last edited by aaronventure

                        @Christoph-Hart Any chance this can make it to other drop shadow methods soon? I'm profiling my UI right now and the hungriest call is by far drawDropShadowFromAlpha. Using one of the two blur options is a few times worse.

                        Btw the Perfetto implementation gets me all hot and bothered!

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

                        30

                        Online

                        1.8k

                        Users

                        12.1k

                        Topics

                        104.9k

                        Posts