X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfc.c;h=f57a98eb14c9ed656d615a0106d2d3748319ccea;hb=5480f1eae83c641a75b225db52bbfc1fcb62e6b6;hp=bdb631ab3b6fe3b260ea02d275cf82c841212161;hpb=4db7d75bc14d8b93a247ede2a3ac7a7190d31d5e;p=swftools.git diff --git a/src/swfc.c b/src/swfc.c index bdb631a..f57a98e 100644 --- a/src/swfc.c +++ b/src/swfc.c @@ -4,8 +4,20 @@ Part of the swftools package. Copyright (c) 2001 Matthias Kramm + + 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. - This file is distributed under the GPL, see file COPYING for 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include @@ -13,9 +25,7 @@ #include #include #include -#define logf logarithmf // logf is also used by ../lib/log.h #include -#undef logf #include "../config.h" #include "../lib/rfxswf.h" #include "../lib/log.h" @@ -327,10 +337,9 @@ static MATRIX s_instancepos(instance_t*i, parameters_t*p) return m; } -void s_swf(char*name, SRECT r, int version, int fps, int compress) +void s_swf(char*name, SRECT r, int version, int fps, int compress, RGBA background) { SWF*swf = (SWF*)malloc(sizeof(SWF)); - RGBA rgb; if(stackpos) syntaxerror(".swf blocks can't be nested"); @@ -341,8 +350,7 @@ void s_swf(char*name, SRECT r, int version, int fps, int compress) swf->frameRate = fps; swf->firstTag = tag = swf_InsertTag(0, ST_SETBACKGROUNDCOLOR); swf->compressed = compress; - rgb.r = 0x00;rgb.g = 0x00;rgb.b = 0x00; - swf_SetRGB(tag,&rgb); + swf_SetRGB(tag,&background); if(stackpos==sizeof(stack)/sizeof(stack[0])) syntaxerror("too many levels of recursion"); @@ -1256,6 +1264,7 @@ static int c_swf(map_t*args) int version = parseInt(lu(args, "version")); int fps = (int)(parseFloat(lu(args, "fps"))*256); int compress = 0; + RGBA color = parseColor(lu(args, "background")); if(!strcmp(name, "!default!") || override_outputname) name = outputname; @@ -1267,7 +1276,7 @@ static int c_swf(map_t*args) compress = 0; else syntaxerror("value \"%s\" not supported for the compress argument", compressstr); - s_swf(name, bbox, version, fps, compress); + s_swf(name, bbox, version, fps, compress, color); return 0; } int isRelative(char*str) @@ -1315,6 +1324,10 @@ SPOINT getPoint(SRECT r, char*name) l--; return *(SPOINT*)&mpoints.buffer[l]; } +static int c_gradient(map_t*args) +{ + return 0; +} static int c_point(map_t*args) { char*name = lu(args, "name"); @@ -1718,7 +1731,7 @@ static struct { command_func_t* func; char*arguments; } arguments[] = -{{"swf", c_swf, "bbox=autocrop version=5 fps=50 name=!default! @compress=default"}, +{{"swf", c_swf, "bbox=autocrop background=black version=5 fps=50 name=!default! @compress=default"}, {"frame", c_frame, "n=1"}, // "import" type stuff @@ -1731,6 +1744,11 @@ static struct { {"font", c_font, "name filename"}, {"soundtrack", c_soundtrack, "filename"}, + // generators of primitives + + {"point", c_point, "name x=0 y=0"}, + {"gradient", c_gradient, "name"}, + // character generators {"box", c_primitive, "name width height color=white line=1 @fill=none"}, {"circle", c_primitive, "name r color=white line=1 @fill=none"}, @@ -1757,7 +1775,6 @@ static struct { // virtual object placement {"buttonput", c_buttonput, " x=0 y=0 red=+0 green=+0 blue=+0 alpha=+0 luminance= scale= scalex=100% scaley=100% shear=0 rotate=0 above= below="}, {"texture", c_texture, " x=0 y=0 scale= scalex=100% scaley=100% shear=0 rotate=0"}, - {"point", c_point, "name x=0 y=0"}, // commands which start a block //startclip (see above) @@ -1851,7 +1868,7 @@ static map_t parseArguments(char*command, char*pattern) len = pos; /* for(t=0;ttextlen?name[pos].len:textlen)) || (type != ASSIGNMENT && !set[pos])) { if(set[pos]) { - syntaxerror("value %s set twice (old value:%s)", text, strndup(value[pos].str, value[pos].len)); + syntaxerror("value %s set twice (old value:%s)", text, strdup_n(value[pos].str, value[pos].len)); } if(type == ASSIGNMENT) readToken(); @@ -1894,8 +1911,8 @@ static map_t parseArguments(char*command, char*pattern) value[pos].len = strlen(text); #if 0//def DEBUG printf("setting parameter %s (to %s)\n", - strndup(name[pos].str, name[pos].len), - strndup(value[pos].str, value[pos].len)); + strdup_n(name[pos].str, name[pos].len), + strdup_n(value[pos].str, value[pos].len)); #endif break; } @@ -1906,7 +1923,7 @@ static map_t parseArguments(char*command, char*pattern) } #if 0//def DEBUG for(t=0;t