-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Added accurate_alpha parameter to fix blending #37503
Conversation
Oh i forgot clang_format again |
core/image.h
Outdated
void blend_rect(const Ref<Image> &p_src, const Rect2 &p_src_rect, const Point2 &p_dest, bool accurate_alpha = false); | ||
void blend_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, const Rect2 &p_src_rect, const Point2 &p_dest, bool accurate_alpha = false); |
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.
Parameters in C++ prototypes are prefixed with p_
, so this should be p_accurate_alpha
.
I'm not sure that the parameter's name properly conveys what it involves, but otherwise the code looks OK. Please also add the relevant documentation to |
|
Well, why would anyone want inaccurate blending in a function named "blend"? :) |
According to the issue discussing this, this is what i understood. Usually in a game, you blend against a fully opaque background. In those cases, the result without the fix is the same as if it had the fix, because |
Not sure if it is applicable for this case, but maybe |
Well, i think the output without the fix could be thought as the value in "premultiplied alpha". And as the fix divides by alpha, it could be thought that the fix is converting premultiplied to straight. So perhaps the parameter could be called "p_straight_alpha" as you suggest. |
Should i rename the parameter to any of those options? |
Should i use |
Is there any chance this will be merged before 3.2.2? It would be really helpful for Pixelorama. |
Superseded by #39200. |
Fixes #31124