diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-30 18:17:11 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-12-30 18:17:11 +0400 |
commit | d7d856a23de2b6751a46632130f941a71377d134 (patch) | |
tree | 67662eadc78a4145eba4f0a9e04655cb1adb9edb /source/blender/imbuf/intern/divers.c | |
parent | 424e09a2cec805aa67824385c16a1d267fb1022b (diff) |
Color management: add "Color Unpremultiply" option for images and render settings.
For premultiplied alpha images, this makes any color space conversion for the image
or render output work on color without alpha multiplied in.
This is typically useful to avoid fringing when the image was or will be composited
over a light background. If the image will be composited over a black background on
the other hand, leaving this option off will give correct results.
In an ideal world, there should never be any color space conversion on images with
alpha, since it's undefined what to do then, but in practice it's useful to have
this option.
Patch by Troy Sobotka, with changes by me.
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 8a3f6358c5b..0dfc1852e29 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -453,7 +453,8 @@ void IMB_buffer_byte_from_byte(uchar *rect_to, const uchar *rect_from, void IMB_rect_from_float(struct ImBuf *ibuf) { - int predivide= 0, profile_from; + int predivide= (ibuf->flags & IB_cm_predivide); + int profile_from; /* verify we have a float buffer */ if(ibuf->rect_float==NULL) @@ -485,7 +486,8 @@ void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y { float *rect_float; uchar *rect_byte; - int predivide= 0, profile_from; + int predivide= (ibuf->flags & IB_cm_predivide); + int profile_from; /* verify we have a float buffer */ if(ibuf->rect_float==NULL || buffer==NULL) @@ -521,7 +523,8 @@ void IMB_partial_rect_from_float(struct ImBuf *ibuf, float *buffer, int x, int y void IMB_float_from_rect(struct ImBuf *ibuf) { - int predivide= 0, profile_from; + int predivide= (ibuf->flags & IB_cm_predivide); + int profile_from; /* verify if we byte and float buffers */ if(ibuf->rect==NULL) @@ -546,7 +549,7 @@ void IMB_float_from_rect(struct ImBuf *ibuf) /* no profile conversion */ void IMB_float_from_rect_simple(struct ImBuf *ibuf) { - int predivide= 0; + int predivide= (ibuf->flags & IB_cm_predivide); if(ibuf->rect_float==NULL) imb_addrectfloatImBuf(ibuf); @@ -558,7 +561,8 @@ void IMB_float_from_rect_simple(struct ImBuf *ibuf) void IMB_convert_profile(struct ImBuf *ibuf, int profile) { - int predivide= 0, profile_from, profile_to; + int predivide= (ibuf->flags & IB_cm_predivide); + int profile_from, profile_to; if(ibuf->profile == profile) return; @@ -599,7 +603,8 @@ void IMB_convert_profile(struct ImBuf *ibuf, int profile) * if the return */ float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc) { - int predivide= 0, profile_from, profile_to; + int predivide= (ibuf->flags & IB_cm_predivide); + int profile_from, profile_to; /* determine profiles */ if(ibuf->profile == IB_PROFILE_NONE) |