Coder Social home page Coder Social logo

Comments (4)

peterdk avatar peterdk commented on June 11, 2024

I did some tinkering with the code, and instead of the Xtransfermode in the PromptText, I just clip the text in MaterialTapTargetPrompt class with a new property of PromptBackground that supplies the background's path. Now hardware layer works as well, and no weird effects. I would say that is a better approach.

 //Draw the text
            Path backgroundPath = mPromptOptions.getPromptBackground().getPath();
            if (backgroundPath != null) {
                canvas.save();

                canvas.clipPath(backgroundPath, Region.Op.INTERSECT );
            }
            mPromptOptions.getPromptText().draw(canvas);
            if (backgroundPath != null) {
                canvas.restore();
            }

I can make a more official PR for it, and testing with the other backgrounds as well and implementing the path for them.

from materialtaptargetprompt.

peterdk avatar peterdk commented on June 11, 2024

I created a PR, it fixes the issue. Let me know if it is acceptable or needs changing.

from materialtaptargetprompt.

danilodanicomendes avatar danilodanicomendes commented on June 11, 2024

Damn, seems like I only thought of my use case with that xfermode change. Sorry about that.
To fix this, keeping PorterDuff, would definitely add a lot of complexity (if fixable at all)

I looked at your PR and I do agree that this is a better approach and more bullet proof for other use cases.

from materialtaptargetprompt.

peterdk avatar peterdk commented on June 11, 2024

No problem, it was nice seeing someone having the same intent to fix the issue! You can't account for all cases, and I assume it worked for your case.

from materialtaptargetprompt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.