[Bf-committers] Blurred Edge for Sweep Effect

Johnny Matthews bf-committers@blender.org
Thu, 24 Jun 2004 09:41:37 -0500


------=_Part_119_8530632.1088088097808
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Here is a patch that enables the sweep effect to have a blurred edge
which has  a width that can be set in the properties floating panel
for the effect. This patch only has the blur working for the
Left->Right sweep, but the other sweeps can be added as well. Tell me
what you think!

Johnny

------=_Part_119_8530632.1088088097808
Content-Type: text/plain; name="blur.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="blur.patch"

? Copy of config.opts
? blender.exp
? blender.lib
? config.opts
? go.bat
? vc70.pdb
? source/creator/winbuildinfo.h
? source/icons/winblender.res
Index: source/blender/include/BSE_sequence.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BSE_sequence.h=
,v
retrieving revision 1.7
diff -u -r1.7 BSE_sequence.h
--- source/blender/include/BSE_sequence.h=0923 Jun 2004 22:11:56 -0000=091.=
7
+++ source/blender/include/BSE_sequence.h=0924 Jun 2004 14:34:43 -0000
@@ -104,7 +104,7 @@
       DO_LEFT_DOWN_RIGHT_UP_IN, DO_LEFT_UP_RIGHT_DOWN_OUT,
       DO_LEFT_UP_RIGHT_DOWN_IN, DO_DIAG_OUT, DO_DIAG_IN, DO_DIAG_OUT_2,
       DO_DIAG_IN_2};
-int check_zone(int x, int y, int xo, int yo, struct Sequence *seq, float f=
acf0);
+float check_zone(int x, int y, int xo, int yo, struct Sequence *seq, float=
 facf0);
 void init_sweep_effect(struct Sequence *seq);
 void do_sweep_effect(struct Sequence *seq, float facf0, float facf1, int x=
, int y, unsigned int *rect1, unsigned int *rect2, unsigned int *out);
=20
Index: source/blender/makesdna/DNA_sequence_types.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_sequence_=
types.h,v
retrieving revision 1.10
diff -u -r1.10 DNA_sequence_types.h
--- source/blender/makesdna/DNA_sequence_types.h=0923 Jun 2004 22:11:57 -00=
00=091.10
+++ source/blender/makesdna/DNA_sequence_types.h=0924 Jun 2004 14:34:43 -00=
00
@@ -140,6 +140,8 @@
=20
 /* ************* Effect Variable Structs ********* */
 typedef struct SweepVars {
+=09float edgeWidth;
+=09float pad1,pad2,pad3;
 =09short sweeptype;
 } SweepVars;
=20
Index: source/blender/src/drawseq.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawseq.c,v
retrieving revision 1.17
diff -u -r1.17 drawseq.c
--- source/blender/src/drawseq.c=0923 Jun 2004 22:11:57 -0000=091.17
+++ source/blender/src/drawseq.c=0924 Jun 2004 14:34:44 -0000
@@ -717,6 +717,34 @@
 =09=09=09strcpy(formatstring, "Select Sweep Type %t|Left to Right %x0|Righ=
t to Left %x1|Bottom to Top %x2|Top to Bottom %x3|Top left to Bottom right%=
x4|Bottom right to Top left %x5|Bottom left to Top right %x6|Top right to B=
ottom left %x7|Horizontal out %x8|Horizontal in %x9|Vertical out %x10|Verti=
cal in %x11|Hor/Vert out %x12|Hor/Vert in %x13|Bottom left to Top right out=
 %x14|Top left to Bottom right in %x15|Top left to Bottom right out %x16|Bo=
ttom left to Top right in %x17|Diagonal out %x18|Diagonal in %x19|Diagonal =
out 2 %x20|Diagonal in 2 %x21|");
=20
 =09=09=09uiDefButS(block, MENU,SEQ_BUT_EFFECT, formatstring,=0910,90,220,2=
2, &sweep->sweeptype, 0, 0, 0, 0, "What type of sweep should be performed")=
;
+=09=09   switch (sweep->sweeptype) {
+=09=09      case DO_LEFT_RIGHT:
+=09=09=09=09uiDefButF(block, NUM,SEQ_BUT_EFFECT,"Blur:",=0910,65,220,22, &=
sweep->edgeWidth,0.0,1.0, 1, 2, "The percent width of the blur edge");
+=09=09      =09break;
+=09=09      case DO_RIGHT_LEFT:
+=09=09      case DO_DOWN_UP:
+=09=09      case DO_UP_DOWN:
+=09=09      case DO_LOWER_LEFT_UPPER_RIGHT:
+=09=09      case DO_UPPER_RIGHT_LOWER_LEFT:
+=09=09      case DO_UPPER_LEFT_LOWER_RIGHT:
+=09=09      case DO_LOWER_RIGHT_UPPER_LEFT:
+=09=09      case DO_HORZ_OUT:
+=09=09      case DO_HORZ_IN:
+=09=09      case DO_VERT_OUT:
+=09=09      case DO_VERT_IN:
+=09=09      case DO_HORZ_VERT_OUT:
+=09=09      case DO_HORZ_VERT_IN:
+=09=09      case DO_LEFT_DOWN_RIGHT_UP_OUT:
+=09=09      case DO_LEFT_DOWN_RIGHT_UP_IN:
+=09=09      case DO_LEFT_UP_RIGHT_DOWN_OUT:
+=09=09      case DO_LEFT_UP_RIGHT_DOWN_IN:
+=09=09      case DO_DIAG_OUT:
+=09=09      case DO_DIAG_IN:
+=09=09      case DO_DIAG_OUT_2:
+=09=09      case DO_DIAG_IN_2:
+=09=09         break;
+=09   =09=09}
+
 =09=09}
 =09=09else if(last_seq->type=3D=3DSEQ_GLOW){
 =09=09=09GlowVars *glow =3D (GlowVars *)last_seq->effectdata;
Index: source/blender/src/sequence.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/bf-blender/blender/source/blender/src/sequence.c,v
retrieving revision 1.11
diff -u -r1.11 sequence.c
--- source/blender/src/sequence.c=0923 Jun 2004 22:11:57 -0000=091.11
+++ source/blender/src/sequence.c=0924 Jun 2004 14:34:45 -0000
@@ -958,22 +958,26 @@
=20
=20
=20
-int check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0) {
+float check_zone(int x, int y, int xo, int yo, Sequence *seq, float facf0)=
 {
=20
    float posx, posy;
    float halfx =3D xo/2;
    float halfy =3D yo/2;
    SweepVars *sweep =3D (SweepVars *)seq->effectdata;
-
+  =20
+   int width =3D (int)(sweep->edgeWidth*xo);
 =09//printf("facf0: %f xo: %d\n", facf0, x);
 =09posx =3D facf0 * xo;
 =09posy =3D facf0 * yo;
=20
    switch (sweep->sweeptype) {
       case DO_LEFT_RIGHT:
-         if (x > posx) return 1;
-         return 0;
+=09=09 if(x > posx+width/2) return 1;=20
+         if(x < posx-width/2) return 0;
+         return (x-(posx-width/2))/width;
          break;
+        =20
+        =20
       case DO_RIGHT_LEFT:
          if (x < (xo - posx)) return 1;
          return 0;
@@ -1107,13 +1111,13 @@
 =09for(y=3D0;y<yo;y++) {
=20
       for(x=3D0;x<xo;x++) {
-
-=09=09=09if (check_zone(x,y,xo,yo,seq,facf0)) {
+=09=09=09float check =3D check_zone(x,y,xo,yo,seq,facf0);
+=09=09=09if (check) {
 =09=09=09=09if (rt1) {
-=09=09=09=09=09rt[0] =3D rt1[0];
-=09=09=09=09=09rt[1] =3D rt1[1];
-=09=09=09=09=09rt[2] =3D rt1[2];
-=09=09=09=09=09rt[3] =3D rt1[3];
+=09=09=09=09=09rt[0] =3D (int)(rt1[0]*check)+ (int)(rt2[0]*(1-check));
+=09=09=09=09=09rt[1] =3D (int)(rt1[1]*check)+ (int)(rt2[1]*(1-check));
+=09=09=09=09=09rt[2] =3D (int)(rt1[2]*check)+ (int)(rt2[2]*(1-check));
+=09=09=09=09=09rt[3] =3D (int)(rt1[3]*check)+ (int)(rt2[3]*(1-check));
 =09=09=09=09} else {
 =09=09=09=09=09rt[0] =3D 0;
 =09=09=09=09=09rt[1] =3D 0;

------=_Part_119_8530632.1088088097808--