-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simplified API for applying visual effects to drawables #813
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Extracts the math functions used for the blur effect into a new class to expose them and thus allow their reuse in other components.
Allows applying effects to drawables
This rename is necessary to introduce an EdgeEffect class later that can be used to apply an EdgeEffect to a drawable.
default0
changed the title
Add Effect API
Add simplified API for applying visual effects to drawables
Jun 11, 2017
Tom94
approved these changes
Jun 11, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. I personally like this API, but I'll hold off with merging until there is a second opinion, because I was involved in drafting this up. @peppy @smoogipooo
I definitely approve of the API for this. Will need to read through the code in more detail, though |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
An initial draft and a few useful/encouraging examples for an API to allow application of effects to drawables.
The basic idea is to have an Effect object that when applied to a drawable, returns a new drawable (fe a container containing the target drawable) that displays the original drawable with the effect.
This design was chosen after some discussion with @Tom94.
His idea was originally to simply have Containers that wrap drawables, to make the resulting draw graph more obvious. However, this prevents easy re-use of effects (since the Containers have to ensure that only one drawable is contained by them) for no particular gain other than being able to use the initialization syntax when creating a big draw graph.
To allow having a markup-esque structure with effects, the example of TextFlowContainer was used, that is, when applying an effect, there is an additional delegate parameter that can be used to make further changes to the created drawable.