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

Alpha-blending #728

Open
SergMariaDB opened this issue Feb 16, 2023 · 4 comments
Open

Alpha-blending #728

SergMariaDB opened this issue Feb 16, 2023 · 4 comments
Labels
cat/feature New feature or functionality

Comments

@SergMariaDB
Copy link

Is your feature request related to a problem? Please describe.

Alpha-blending seem chellengable for this enormous support of the different types of channels.

Describe the solution you'd like

How about start on support the same RGB views?

C++ Example

template
auto alpha_blend(const ViewT& view1, const ViewT& view2, ptr_diff_t x=0, ptr_diff_t y=0){
...
}

#include <boost/gil.hpp>
namespace gil = boost::gil;
int main
{
    ...
    auto v3 = alpha_blend(v1, v2);
    ...
}

Describe alternatives you've considered

I imagine using boost::compute for this.

Additional context

https://stackoverflow.com/questions/746899/how-to-calculate-an-rgb-colour-by-specifying-an-alpha-blending-amount

@mloskot mloskot added the cat/feature New feature or functionality label Feb 16, 2023
@mloskot
Copy link
Member

mloskot commented Feb 16, 2023

How about start on support the same RGB views?

There is nothing wrong with features specific or limited to narrow set of specific pixel/view types.
Starting small with a proof of concept, well tested, documented...it's actually a common and appreciated practice, and not only in GIL, I guess.

@ohhmm
Copy link

ohhmm commented Feb 16, 2023

Consider it for GSOC. Thanks.

@SergMariaDB
Copy link
Author

Found one alpha-blending implementation for boost::gil here https://github.com/boost-gil/gil-contributions-archive/blob/sandbox/boost/gil/extension/toolbox/blend.hpp

Here's boost::compute based image generation sample: https://github.com/ohhmm/generator/blob/5ecaa727352d34fd0b0f134c9b8ceed4a202f475/picture-pattern-generate/generator.cpp#L55

Any plans to use boost::compute for boost::gil?

@mloskot
Copy link
Member

mloskot commented Feb 20, 2023

Yes, the github.com/boost-gill is our sister org. I forgot there are some blending implementations indeed.

Any plans to use boost::compute for boost::gil?

No plans, AFAIK, but it's possible:

GIL can accept variety of features via extensions, including domain-specific features, features with new dependencies, features with non-Boost externals as dependencies. So, I'd suggest to consider the Boost.Compute-based blending as an extension first.
It is easy to move features from extension to core, but once a feature is in core, then removing it is not easy. See more on core vs extensions #668

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat/feature New feature or functionality
Projects
None yet
Development

No branches or pull requests

3 participants