CVSROOT: /sources/gnash Module name: gnash Changes by: Zou Lunkai <zoulunkai> 07/06/24 05:44:14
Modified files: . : ChangeLog Added files: testsuite/misc-ming.all: morph_test1.c Log message: 1st testcase for morphs CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3607&r2=1.3608 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/morph_test1.c?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3607 retrieving revision 1.3608 diff -u -b -r1.3607 -r1.3608 --- ChangeLog 24 Jun 2007 00:44:55 -0000 1.3607 +++ ChangeLog 24 Jun 2007 05:44:13 -0000 1.3608 @@ -1,3 +1,9 @@ +2007-06-24 Zou Lunkai <[EMAIL PROTECTED]> + + * testsuite/misc-ming.all/morph_test1.c: first testcase for morphs, + need a testrunner for checking the renderer, but might be enough for + testing GC at the moment. + 2007-06-23 Sandro Santilli <[EMAIL PROTECTED]> * server/as_value.h: include <iostream> for proper definition Index: testsuite/misc-ming.all/morph_test1.c =================================================================== RCS file: testsuite/misc-ming.all/morph_test1.c diff -N testsuite/misc-ming.all/morph_test1.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/misc-ming.all/morph_test1.c 24 Jun 2007 05:44:14 -0000 1.1 @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +/* + * zou lunkai [EMAIL PROTECTED] + * + * test morphs +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <ming.h> + +#include "ming_utils.h" + +#define OUTPUT_VERSION 6 +#define OUTPUT_FILENAME "morph_test1.swf" + +void make_shape(SWFShape sh, int x, int y, int width, int height, byte r, byte g, byte b); + +void +make_shape(SWFShape sh, int x, int y, int width, int height, byte r, byte g, byte b) +{ + SWFFillStyle fs = SWFShape_addSolidFillStyle(sh, r, g, b, 255); + SWFShape_setLineStyle(sh, 1, r, g, b, 255); + SWFShape_setLeftFillStyle(sh, fs); + SWFShape_movePenTo(sh, x, y); + SWFShape_drawLineTo(sh, x, y+height); + SWFShape_drawLineTo(sh, x+width, y+height); + SWFShape_drawLineTo(sh, x+width, y); + SWFShape_drawLineTo(sh, x, y); +} + +int +main(int argc, char** argv) +{ + + SWFMovie mo; + SWFMovieClip dejagnuclip; + SWFMorph morph; + SWFShape startShape, endShape; + SWFDisplayItem it; + float ratio; + + + const char *srcdir="."; + if ( argc>1 ) + srcdir=argv[1]; + else + { + fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); + return 1; + } + + Ming_init(); + mo = newSWFMovieWithVersion(OUTPUT_VERSION); + SWFMovie_setDimension(mo, 800, 600); + SWFMovie_setRate (mo, 12.0); + + // _root.frame1 + dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); + SWFMovie_add(mo, (SWFBlock)dejagnuclip); + add_actions(mo, " x1=0; x2=0; x3=0; x4=0; x5=0; x6=0; x7=0; x8=0; x9=0; x10=0; "); + SWFMovie_nextFrame(mo); + + // _root.frame2, define and place a morph + morph = newSWFMorphShape(); + startShape = SWFMorph_getShape1(morph); + make_shape(startShape, 0, 0, 100, 100, 255, 0 ,0); + endShape = SWFMorph_getShape2(morph); + make_shape(endShape, 700, 500, 100, 100, 0, 255 ,0); + + it = SWFMovie_add(mo, (SWFBlock)morph); + SWFMovie_nextFrame(mo); + + // update the morph with different ratios + for(ratio=0; ratio<1.01; ratio+=0.2) + { + SWFDisplayItem_remove(it); + it = SWFMovie_add(mo, (SWFBlock)morph); + SWFDisplayItem_setRatio(it, ratio); + SWFMovie_nextFrame(mo); + } + + //Output movie + puts("Saving " OUTPUT_FILENAME ); + SWFMovie_save(mo, OUTPUT_FILENAME); + + return 0; +} + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit