From 7154e84ee1d5a6086eb47b499712d4bbc8a05a8f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 28 Nov 2007 12:32:25 +0000 Subject: [PATCH] Images now have option to be tagged "convert to premul". Option available in the Image (properties) panel. --- source/blender/blenkernel/intern/image.c | 3 +++ source/blender/makesdna/DNA_image_types.h | 2 +- source/blender/src/buttons_shading.c | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index bb60c221839..be63ce734be 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1560,6 +1560,9 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra) if ((ima->packedfile == NULL) && (G.fileflags & G_AUTOPACK)) ima->packedfile = newPackedFile(str); } + + if(ima->flag & IMA_DO_PREMUL) + converttopremul(ibuf); } else ima->ok= 0; diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 8a5a7ce4a4c..d5e4b7a1142 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -108,7 +108,7 @@ typedef struct Image { #define IMA_REFLECT 16 #define IMA_NOCOLLECT 32 #define IMA_ANTIALI 64 - +#define IMA_DO_PREMUL 128 /* tpageflag */ #define IMA_TILES 1 diff --git a/source/blender/src/buttons_shading.c b/source/blender/src/buttons_shading.c index 1a071813d8a..03fce824f7f 100644 --- a/source/blender/src/buttons_shading.c +++ b/source/blender/src/buttons_shading.c @@ -1174,9 +1174,12 @@ void uiblock_image_panel(uiBlock *block, Image **ima_pp, ImageUser *iuser, but= uiDefButBitS(block, TOG, IMA_FIELDS, imagechanged, "Fields", 10, 90, 100, 20, &ima->flag, 0, 0, 0, 0, "Click to enable use of fields in Image"); uiButSetFunc(but, image_field_test, ima, iuser); uiDefButBitS(block, TOG, IMA_STD_FIELD, B_NOP, "Odd", 10, 70, 100, 20, &ima->flag, 0, 0, 0, 0, "Standard Field Toggle"); - uiBlockEndAlign(block); + uiBlockBeginAlign(block); + uiBlockSetFunc(block, image_reload_cb, ima, iuser); uiDefButBitS(block, TOG, IMA_ANTIALI, B_NOP, "Anti", 10, 35, 100, 20, &ima->flag, 0, 0, 0, 0, "Toggles Image anti-aliasing, only works with solid colors"); + uiDefButBitS(block, TOG, IMA_DO_PREMUL, imagechanged, "Premul", 110, 35, 100, 20, &ima->flag, 0, 0, 0, 0, "Toggles premultiplying alpha"); + uiBlockEndAlign(block); if( ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { sprintf(str, "(%d) Frames:", iuser->framenr);