diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-28 18:25:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-28 18:25:26 +0400 |
commit | 47d6d187710988f42960e28b73b59069afc2f240 (patch) | |
tree | 867b659349fb37f657168c18db55c6fc0151856d /source/blender/imbuf/intern/imageprocess.c | |
parent | bad03bcfb1c3aadb8ca85575abf84766766ed48f (diff) |
Changed a way how RGB images are saving from RGBA
Before alpha channel was simply ignored causing bad looking
straight colors which is pretty much useless.
Now saving RGB would alpha-over image on top of black color,
which makes final image look really nice. It's also very
such the same what other graphics software does this.
In the future we could easily support configurable backdrop
color, which would be really the same as other SW does it.
Also, it'll probably worth adding the same mode to RGB
display of image editor.
Diffstat (limited to 'source/blender/imbuf/intern/imageprocess.c')
-rw-r--r-- | source/blender/imbuf/intern/imageprocess.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 59282c9d207..26dd0f2977a 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -367,9 +367,9 @@ void IMB_alpha_under_color_byte(unsigned char *rect, int x, int y, float backcol else { int mul = 255 - cp[3]; - cp[0] += mul * backcol[0] / 255; - cp[1] += mul * backcol[1] / 255; - cp[2] += mul * backcol[2] / 255; + cp[0] = (cp[0] * cp[3] >> 8) + mul * backcol[0] / 255; + cp[1] = (cp[1] * cp[3] >> 8) + mul * backcol[1] / 255; + cp[2] = (cp[2] * cp[3] >> 8) + mul * backcol[2] / 255; } cp[3] = 255; |