diff options
author | Ton Roosendaal <ton@blender.org> | 2005-01-07 21:07:13 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-01-07 21:07:13 +0300 |
commit | 3e38a951dd46938c45489551b1c0164eb0e7d100 (patch) | |
tree | 907bd900355d4db8ef09f6b216ade180e53413e8 | |
parent | ac82b483807ac5d6b68d8f03dc955c03643c8a18 (diff) |
Bug fix #2104
When using Sequencer for Alpha-Over images, it was assuming "Key" alpha by
default, and converting images to "Premul" (= multiplying RGB with alpha).
This isn't very nice, also because alpha generated by MBlur in Blender
always is of type Premul already.
Solution; make this an option. In the Nkey panel for strips you can set
or disable Premul now. As extra also added the "Filter" and "Mul" options,
as already there for Movie strips. Can easily be extended to more options
for various postprocess effects.
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 10 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_sequence_types.h | 1 | ||||
-rw-r--r-- | source/blender/src/drawseq.c | 24 | ||||
-rw-r--r-- | source/blender/src/sequence.c | 11 |
4 files changed, 31 insertions, 15 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 3a8fdb69d7a..37e21e39279 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -4596,6 +4596,8 @@ static void do_versions(Main *main) if(main->versionfile <= 235) { Tex *tex= main->tex.first; Scene *sce= main->scene.first; + Sequence *seq; + Editing *ed; while(tex) { if(tex->nabla==0.0) tex->nabla= 0.025; @@ -4603,6 +4605,14 @@ static void do_versions(Main *main) } while(sce) { sce->r.postsat= 1.0; + ed= sce->ed; + if(ed) { + WHILE_SEQ(&ed->seqbase) { + if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE) seq->flag |= SEQ_MAKE_PREMUL; + } + END_SEQ + } + sce= sce->id.next; } } diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index bd4a02dd0b2..d8f53b7de7f 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -161,6 +161,7 @@ typedef struct GlowVars { #define SEQ_OVERLAP 8 #define SEQ_FILTERY 16 #define SEQ_MUTE 32 +#define SEQ_MAKE_PREMUL 64 /* seq->type WATCH IT: BIT 3!!! */ #define SEQ_IMAGE 0 diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c index 8f9b85a1ec1..be271622215 100644 --- a/source/blender/src/drawseq.c +++ b/source/blender/src/drawseq.c @@ -605,13 +605,12 @@ static void draw_extra_seqinfo(void) } #define SEQ_BUT_PLUGIN 1 -#define SEQ_BUT_MOVIE 2 +#define SEQ_BUT_RELOAD 2 #define SEQ_BUT_EFFECT 3 void do_seqbuttons(short val) { extern Sequence *last_seq; - StripElem *se; switch(val) { case SEQ_BUT_PLUGIN: @@ -619,17 +618,12 @@ void do_seqbuttons(short val) free_imbuf_effect_spec(CFRA); break; - case SEQ_BUT_MOVIE: - se= last_seq->curelem; - if(se && se->ibuf ) { - IMB_freeImBuf(se->ibuf); - se->ibuf= 0; - } + case SEQ_BUT_RELOAD: + free_imbuf_seq(); // frees all break; case SEQ_BUT_EFFECT: new_stripdata(last_seq); calc_sequence(last_seq); - allqueue(REDRAWSEQ, 0); break; } @@ -673,6 +667,9 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefBut(block, LABEL, 0, "Type: Image", 10,140,150,20, 0, 0, 0, 0, 0, ""); uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, ""); + uiDefButS(block, TOG|BIT|6, SEQ_BUT_RELOAD, "Convert to Premul", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha"); + uiDefButS(block, TOG|BIT|4, SEQ_BUT_RELOAD, "FilterY", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields"); + uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors"); } else if(last_seq->type==SEQ_META) { @@ -693,8 +690,9 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefBut(block, LABEL, 0, "Type: Movie", 10,140,150,20, 0, 0, 0, 0, 0, ""); uiDefBut(block, TEX, B_NOP, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, ""); - uiDefButS(block, TOG|BIT|4, SEQ_BUT_MOVIE, "FilterY ", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, ""); - uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Mul:", 10,70,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, ""); + uiDefButS(block, TOG|BIT|6, SEQ_BUT_RELOAD, "Make Premul Alpha ", 10,90,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Converts RGB values to become premultiplied with Alpha"); + uiDefButS(block, TOG|BIT|4, SEQ_BUT_RELOAD, "FilterY ", 10,70,150,19, &last_seq->flag, 0.0, 21.0, 100, 0, "For video movies to remove fields"); + uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Mul:", 10,50,150,19, &last_seq->mul, 0.001, 5.0, 100, 0, "Multiply colors"); } else if(last_seq->type==SEQ_SOUND) { @@ -703,8 +701,8 @@ static void seq_panel_properties(short cntrl) // SEQ_HANDLER_PROPERTIES uiDefBut(block, TEX, 0, "Name: ", 10,120,150,19, last_seq->name+2, 0.0, 21.0, 100, 0, ""); uiDefButS(block, TOG|BIT|5, B_NOP, "Mute", 10,90,120,19, &last_seq->flag, 0.0, 21.0, 100, 0, ""); - uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Gain (dB):", 10,70,150,19, &last_seq->level, -96.0, 6.0, 100, 0, ""); - uiDefButF(block, NUM, SEQ_BUT_MOVIE, "Pan:", 10,50,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, ""); + uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Gain (dB):", 10,70,150,19, &last_seq->level, -96.0, 6.0, 100, 0, ""); + uiDefButF(block, NUM, SEQ_BUT_RELOAD, "Pan:", 10,50,150,19, &last_seq->pan, -1.0, 1.0, 100, 0, ""); } else if(last_seq->type>=SEQ_EFFECT) { uiDefBut(block, LABEL, 0, "Type: Effect", 10,140,150,20, 0, 0, 0, 0, 0, ""); diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index e30edf6b874..068d559916b 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -1899,9 +1899,14 @@ void do_build_seqar_cfra(ListBase *seqbase, Sequence ***seqar, int cfra) if(se->ibuf==0) se->ok= 0; else { - if(se->ibuf->depth==32 && se->ibuf->zbuf==0) converttopremul(se->ibuf); + if(seq->flag & SEQ_MAKE_PREMUL) { + if(se->ibuf->depth==32 && se->ibuf->zbuf==0) converttopremul(se->ibuf); + } seq->strip->orx= se->ibuf->x; seq->strip->ory= se->ibuf->y; + if(seq->flag & SEQ_FILTERY) IMB_filtery(se->ibuf); + if(seq->mul==0.0) seq->mul= 1.0; + if(seq->mul != 1.0) multibuf(se->ibuf, seq->mul); } } } @@ -1924,7 +1929,9 @@ void do_build_seqar_cfra(ListBase *seqbase, Sequence ***seqar, int cfra) if(se->ibuf==0) se->ok= 0; else { - if(se->ibuf->depth==32) converttopremul(se->ibuf); + if(seq->flag & SEQ_MAKE_PREMUL) { + if(se->ibuf->depth==32) converttopremul(se->ibuf); + } seq->strip->orx= se->ibuf->x; seq->strip->ory= se->ibuf->y; if(seq->flag & SEQ_FILTERY) IMB_filtery(se->ibuf); |