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/blenkernel | |
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/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 354a5265f90..a5c8f5c905d 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -285,6 +285,10 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) break; ibuf->index= index; + if(ima->flag & IMA_CM_PREDIVIDE) + ibuf->flags |= IB_cm_predivide; + else + ibuf->flags &= ~IB_cm_predivide; /* this function accepts link==NULL */ BLI_insertlinkbefore(&ima->ibufs, link, ibuf); @@ -2304,9 +2308,17 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ /* since its possible to access the buffer from the image directly, set the profile [#25073] */ ibuf->profile= (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE; - ibuf->dither= dither; + if(iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) { + ibuf->flags |= IB_cm_predivide; + ima->flag |= IMA_CM_PREDIVIDE; + } + else { + ibuf->flags &= ~IB_cm_predivide; + ima->flag &= ~IMA_CM_PREDIVIDE; + } + ima->ok= IMA_OK_LOADED; return ibuf; |