X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=swfs%2Fsimple_viewer.c;h=4710cdf2a31c239c37bb83329b11a54b3dc08540;hb=f1c3b824bd3c239e5395265c5c45134987aa9192;hp=b9055338b76cde6696b090704cdcf9554e874018;hpb=b41fab3fc66be1dc29efd5c65cabd54a6a63cc17;p=swftools.git diff --git a/swfs/simple_viewer.c b/swfs/simple_viewer.c index b905533..4710cdf 100644 --- a/swfs/simple_viewer.c +++ b/swfs/simple_viewer.c @@ -32,6 +32,9 @@ RGBA button_colors[6]= int useDefineButton2 = 0; // set this to 1 to use DefineButton2 Tags // instead of DefineButton1 #define SUBTITLES 1 +//#define USE_WATERMARK 1 // set this flag to print-protect your swfs + +#define ID_WATERMARK 64 int main (int argc,char ** argv) { SWF swf; @@ -82,6 +85,31 @@ int main (int argc,char ** argv) m.tx = 0; //move m.ty = 0; swf_ObjectPlace(tag, 23, 1,&m,0,"viewport"); + +#ifdef USE_WATERMARK + + // Insert Alpha watermark to avoid printing + + tag = swf_InsertTag(tag,ST_DEFINESHAPE3); + swf_ShapeNew(&s); + rgb.r = rgb.g = rgb.b = 0xff; + rgb.a = 0x08; + fs1 = swf_ShapeAddSolidFillStyle(s,&rgb); + swf_SetU16(tag,ID_WATERMARK); + r.xmin = r.ymin = 0; + r.xmax = 20*width; + r.ymax = 20*height; + swf_SetRect(tag,&r); // cover whole viewport + swf_SetShapeHeader(tag,s); + swf_ShapeSetAll(tag,s,0,0,0,fs1,0); + swf_ShapeSetLine(tag,s,20*width,0); + swf_ShapeSetLine(tag,s,0,20*height); + swf_ShapeSetLine(tag,s,-20*width,0); + swf_ShapeSetLine(tag,s,0,-20*height); + swf_ShapeSetEnd(tag); + swf_ShapeFree(s); + +#endif // USE_WATERMARK for(count=0;count<6;count++) { @@ -117,31 +145,25 @@ int main (int argc,char ** argv) swf_ShapeFree(s); // clean shape structure (which isn't needed anymore after writing the tag) } - a1 = swf_ActionStart(tag); - action_SetTarget("viewport"); - action_PreviousFrame(); - action_SetTarget(""); - action_End(); - swf_ActionEnd(); - - a2 = swf_ActionStart(tag); - action_SetTarget("viewport"); - action_NextFrame(); - action_SetTarget(""); - action_End(); - swf_ActionEnd(); - - a3 = swf_ActionStart(tag); - action_SetTarget("viewport"); - action_Stop(); - action_SetTarget(""); + a1 = action_SetTarget(0, "viewport"); + a1 = action_PreviousFrame(a1); + a1 = action_SetTarget(a1, ""); + a1 = action_End(a1); + + a2 = action_SetTarget(0, "viewport"); + a2 = action_NextFrame(a2); + a2 = action_SetTarget(a2,""); + a2 = action_End(a2); + + a3 = action_SetTarget(0,"viewport"); + a3 = action_Stop(a3); + a3 = action_SetTarget(a3,""); #ifdef SUBTITLES - action_PushString("/:subtitle"); - action_PushString(""); //reset variable - action_SetVariable(); + a3 = action_PushString(a3,"/:subtitle"); + a3 = action_PushString(a3,""); //reset variable + a3 = action_SetVariable(a3); #endif - action_End(); - swf_ActionEnd(); + a3 = action_End(a3); for(t=0;t<2;t++) { @@ -185,10 +207,19 @@ int main (int argc,char ** argv) m.tx = 0; //move m.ty = 0; tag = swf_InsertTag(tag,ST_PLACEOBJECT2); - swf_ObjectPlace(tag, 30, 2,&m,0,0); + swf_ObjectPlace(tag, 30, 3,&m,0,0); m.tx = button_sizex*30; tag = swf_InsertTag(tag,ST_PLACEOBJECT2); - swf_ObjectPlace(tag, 31, 3,&m,0,0); + swf_ObjectPlace(tag, 31, 4,&m,0,0); + +#ifdef USE_WATERMARK + + // place watermark + + tag = swf_InsertTag(tag,ST_PLACEOBJECT2); + swf_ObjectPlace(tag, ID_WATERMARK, 2, &m, 0,0); + +#endif // USE_WATERMARK swf_ActionFree(a1); swf_ActionFree(a2); @@ -222,7 +253,7 @@ int main (int argc,char ** argv) m.tx = m.ty = 0; } tag = swf_InsertTag(tag,ST_PLACEOBJECT2); - swf_ObjectPlace(tag, 0x77, 4,&m,0,0); + swf_ObjectPlace(tag, 0x77, 5,&m,0,0); #endif tag = swf_InsertTag(tag,ST_SHOWFRAME);