Images: change alpha settings to support channel packing

This also replaces the Use Alpha setting. We now have these alpha modes:

* Straight: store RGB and alpha channels separately with alpha acting as a
  mask, also known as unassociated alpha.
* Premultiplied: transparent RGB pixels are multiplied by the alpha channel.
  The natural format for renders.
* Channel Packed: different images are packed in the RGB and alpha channels,
  and they should not influence each other. Channel packing is commonly used
  by game engines to save memory.
* None: ignore alpha channel from the file and make image fully opaque.

Cycles OSL does not correctly support Channel Packed and None yet, we are
missing fine control over the OpenImageIO texture cache to do that.

Fixes T53672
This commit is contained in:
2019-05-18 20:52:20 +02:00
parent 3b23b5c638
commit 7aaa7aa9dd
21 changed files with 200 additions and 100 deletions

View File

@@ -476,6 +476,9 @@ int imb_get_anim_type(const char *name);
*/
bool IMB_isfloat(struct ImBuf *ibuf);
/* Do byte/float and colorspace conversions need to take alpha into account? */
bool IMB_alpha_affects_rgb(const struct ImBuf *ibuf);
/* create char buffer, color corrected if necessary, for ImBufs that lack one */
void IMB_rect_from_float(struct ImBuf *ibuf);
void IMB_float_from_rect(struct ImBuf *ibuf);