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/render/intern | |
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/render/intern')
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 7713dcffc5c..555d5c12a86 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1154,7 +1154,7 @@ void RE_ResultGet32(Render *re, unsigned int *rect) } else if(rres.rectf) { int profile_from= (re->r.color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB; - int predivide= 0; + int predivide= (re->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE); int dither= 0; IMB_buffer_byte_from_float((unsigned char*)rect, rres.rectf, @@ -2556,7 +2556,7 @@ static void do_render_seq(Render * re) * render engine delivers */ int profile_to= (re->r.color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB; int profile_from= (ibuf->profile == IB_PROFILE_LINEAR_RGB)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB; - int predivide= 0; + int predivide= (re->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE); if (!rr->rectf) rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf"); @@ -2995,7 +2995,8 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie } } else { - ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.im_format.planes, 0); + int flags = (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE)? IB_cm_predivide: 0; + ImBuf *ibuf= IMB_allocImBuf(rres.rectx, rres.recty, scene->r.im_format.planes, flags); /* if not exists, BKE_write_ibuf makes one */ ibuf->rect= (unsigned int *)rres.rect32; |