-
Notifications
You must be signed in to change notification settings - Fork 61
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
Implement color blending #39
Conversation
4b78a5b
to
139a1ef
Compare
☔ The latest upstream changes (presumably #43) made this pull request unmergeable. Please resolve the merge conflicts. |
Currently missing blend modes are:
Currently missing tests:
|
☔ The latest upstream changes (presumably #51) made this pull request unmergeable. Please resolve the merge conflicts. |
aca8dcc
to
62dd815
Compare
I decided to add a warning to the |
2e86d00
to
cdc3aae
Compare
This is finally close to being complete. I'll just write better descriptions for some items, and divide the |
That's about it, I think. The only thing left is that I'm considering combining @sidred, would you mind taking a look at this? It's quite big, so I would really appreciate a second pair of eyes. |
Sure will do in a bit |
Just thinking out loud here. Feel free to disregard this. Is there a case for separating the blending into a separate crate like how serde does with serde, serde_json etc? Advantages of separating are better compile times and package can be independently updated. Rough compile times with
Blending branch
The downside is that it'll be a bit harder to maintain, whenever the base crate is updated, need to make sure that the blending crate is also updated. |
Moving parts of the crate into some sort of utility crate is a possible scenario, but I'm not sure we are there yet. I would rather put it behind a Cargo feature to make it optional, which will only make testing more complex, but that's already automated. The build time is still reasonable for Rust with optimizations (it's heavy stuff), and I would like to wait and let the library grow and solidify a bit more before making such a decision. |
Any particular reason for this instead of using the flt function? I guess they both should be optimized away in any case.
|
Good question. I was only using |
Everything else looks good to me!! |
Looks like https://www.w3.org/TR/compositing-1/ is going to be a superset of the svg compositing
|
Nice! Thank you for taking a look at this. I'll make some more changes, so I'll notify you when I've pushed them. I have been thinking about giving you r+ permission (allowing you to talk to Homu), in case you want to do this regularly, on the condition that you do r+ your own PRs (I'll do the same) and that you follow the same rules and regulations as we have done so far. That is:
What do you say? Are you up for it? We can start by reviewing each other's.
Interesting. I think it's a bit too much for this particular PR, but it's worth considering in the future, unless it's better suited for an image manipulation library. |
It'll be good to have write permission to the library. I still don't see myself merging any changes without review, at least for the foreseeable future. |
This won't give you full write permissions. Only the ability to merge or reject PRs (see http://homu.io). It would be nice to allow access to issues, as well, but I can't do that without giving full permissions to do anything. Having full write permission should otherwise not be necessary, since we are making the important changes through PRs. The only thing left is the occasional release commit, which isn't as fun as it sounds. One thing we could consider is to create an organization, which will decouple this from me personally, but I think we can start like this and see where it goes. I may change my mind if the number of issues grows to an uncontrollable volume before GitHub improves the permission system. In any case, you are hereby promoted to reviewer. |
I think that was all of them.
|
I have optimistically squashed everything and removed the [wip] tag, so it's ready for merge. An advice is to wait with the r+ until after the tests has passed. That will make Homu merge it straight away, instead of scheduling an additional test run. |
Are you going to merge this? |
I got the impression that we should start reviewing and merging each other's PRs, but I may also have misunderstood your reaction. Do you want to do that or should I continue merging my own stuff? |
Yeah, I wasn't sure if you wanted me to merge. Just confirming :) |
Alright :) It should be good to go, unless I missed something. |
looks good. @homu r+ |
📌 Commit 376dc7f has been approved by |
Implement color blending This introduces the `Blend` trait, which implements proper color blending for colors where it makes sense. The introduction of this trait includes: * Implementation of OpenGL style blending, with blending equations and blending parameters. * Implementation of most of the [SVG composition operators](https://www.w3.org/TR/SVGCompositing/#containerElementCompositingOperators) (also common in photo manipulation software). * Introduction of a type for premultiplied alpha, which is useful for lengthy composition chains. * Introduction of the `ComponentWise` trait, with functions for repeatedly performing actions on each component of a color. It's restricted to colors where all of the components are of the same type. Closes #3.
⚡ Test exempted - status |
Great, thanks! I may just as well do the release straight away. Time to break some eggs, unless any urgent bug fixes has to go first. |
This introduces the
Blend
trait, which implements proper color blending for colors where it makes sense. The introduction of this trait includes:ComponentWise
trait, with functions for repeatedly performing actions on each component of a color. It's restricted to colors where all of the components are of the same type.Closes #3.