Skip to content
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
merged 11 commits into from
Jun 11, 2017

Conversation

default0
Copy link
Contributor

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.

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 default0 mentioned this pull request Jun 11, 2017
1 task
Removed unnecessary usings and used null propagation where suggested
@default0 default0 changed the title Effects Add Effect API Jun 11, 2017
@default0 default0 changed the title Add Effect API Add simplified API for applying visual effects to drawables Jun 11, 2017
Copy link
Collaborator

@Tom94 Tom94 left a 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

@peppy
Copy link
Sponsor Member

peppy commented Jun 11, 2017

I definitely approve of the API for this. Will need to read through the code in more detail, though

@Tom94 Tom94 merged commit 83ee0bf into ppy:master Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants