32 #define MSG_NOSIGNAL 0
35 #include <sys/socket.h>
36 #include <netinet/in.h>
37 #include <arpa/inet.h>
43 #define MSG_NOSIGNAL 0
47 #define MSG_NOSIGNAL 0
50 #define MAXLINE 256*256
135 int ret,bytes_left,first_byte;
137 if(
s == NULL)
return -1;
141 while(bytes_left > 0)
148 ret = write(1,&buf[first_byte],bytes_left);
182 if(inifile == NULL) use_stdout = 0;
184 if(
s != NULL && *
s == 1) use_stdout = 1;
189 sprintf(command,
"rlsvgcat %s",infile);
190 ret = rlsvg.
spawn(command);
191 if(ret < 0)
return -1;
196 if(
id != 0 &&
s != NULL)
198 sprintf(command,
"gsvgRead(%d)\n",
id);
199 tcpsend(command,strlen(command));
202 while((line = rlsvg.
readLine()) != NULL)
210 sprintf(command,
"/usr/bin/rlsvgcat %s",infile);
211 ret = system(command);
212 if(ret == -1)
return -1;
216 sprintf(outfile,
"PVTMP%d.svg",*
s);
217 sprintf(command,
"/usr/bin/rlsvgcat %s %s",infile,outfile);
218 ret = system(command);
219 if(ret == -1)
return -1;
224 sprintf(command,
"\n<svgend></svgend>\n");
225 tcpsend(command,strlen(command));
244 if(
s==NULL) sprintf(filename,
"PVTEMP%s",infile);
245 else sprintf(filename,
"PVTEMP%d%s",*
s,infile);
246 sprintf(cmd,
"rlsvgcat %s %s",infile,filename);
248 if(ret < 0)
return -1;
249 fin = fopen(filename,
"r");
250 if(fin == NULL)
return -1;
251 sprintf(command,
"gsvgRead(%d)\n",
id);
252 tcpsend(command,strlen(command));
253 while(fgets(line,
sizeof(line)-1,fin) != NULL)
255 cptr = strchr(line,0x0d);
256 if(cptr != NULL) *cptr =
'\0';
257 cptr = strchr(line,0x0a);
258 if(cptr != NULL) *cptr =
'\0';
263 sprintf(command,
"\n<svgend></svgend>\n");
264 tcpsend(command, strlen(command));;
292 printf(
"rlSvgAnimator: ERROR please use setSocket first\n");
297 sprintf(buf,
"gupdateSVG(%d)\n",
id);
310 int len = strlen(objectname);
315 sprintf(buf,
"gsvgPrintf(%d)\n",
id);
317 sprintf(buf,
"%s\n",objectname);
319 sprintf(buf,
"%s\n",tag);
324 _vsnprintf(text,
MAXBUF - 1, format, ap);
327 vsprintf(text, format, ap);
330 vsnprintf(text,
MAXBUF - 1, format, ap);
348 sprintf(buf,
"gsvgRecursivePrintf(%d)\n",
id);
350 sprintf(buf,
"%s\n",objectname);
352 sprintf(buf,
"%s\n",tag);
357 _vsnprintf(text,
MAXBUF - 1, format, ap);
360 vsprintf(text, format, ap);
363 vsnprintf(text,
MAXBUF - 1, format, ap);
377 sprintf(buf,
"gsvgSearchAndReplace(%d)\n",
id);
379 sprintf(buf,
"%s\n",objectname);
381 sprintf(buf,
"%s\n",tag);
383 sprintf(buf,
"%s\n",before);
385 sprintf(buf,
"%s\n",after);
395 sprintf(buf,
"gsvgRecursiveSearchAndReplace(%d)\n",
id);
397 sprintf(buf,
"%s\n",objectname);
399 sprintf(buf,
"%s\n",tag);
401 sprintf(buf,
"%s\n",before);
403 sprintf(buf,
"%s\n",after);
412 int len = strlen(objectname);
417 sprintf(buf,
"gsvgTextPrintf(%d)\n",
id);
419 sprintf(buf,
"%s\n",objectname);
424 _vsnprintf(text,
MAXBUF - 1, format, ap);
427 vsprintf(text, format, ap);
430 vsnprintf(text,
MAXBUF - 1, format, ap);
446 sprintf(buf,
"gsvgRemoveStyleOption(%d)\n",
id);
448 sprintf(buf,
"%s\n",objectname);
450 sprintf(buf,
"%s\n",
"style=");
452 sprintf(buf,
"%s\n",option);
462 sprintf(buf,
"gsvgRecursiveRemoveStyleOption(%d)\n",
id);
464 sprintf(buf,
"%s\n",objectname);
466 sprintf(buf,
"%s\n",
"style=");
468 sprintf(buf,
"%s\n",option);
478 sprintf(buf,
"gsvgChangeStyleOption(%d)\n",
id);
480 sprintf(buf,
"%s\n",objectname);
482 sprintf(buf,
"%s\n",
"style=");
484 sprintf(buf,
"%s\n",option);
486 sprintf(buf,
"%s\n",value);
496 sprintf(buf,
"gsvgRecursiveChangeStyleOption(%d)\n",
id);
498 sprintf(buf,
"%s\n",objectname);
500 sprintf(buf,
"%s\n",
"style=");
502 sprintf(buf,
"%s\n",option);
504 sprintf(buf,
"%s\n",value);
514 sprintf(buf,
"gsvgSetStyleOption(%d)\n",
id);
516 sprintf(buf,
"%s\n",objectname);
518 sprintf(buf,
"%s\n",
"style=");
520 sprintf(buf,
"%s\n",value);
530 sprintf(buf,
"gsvgRecursiveSetStyleOption(%d)\n",
id);
532 sprintf(buf,
"%s\n",objectname);
534 sprintf(buf,
"%s\n",
"style=");
536 sprintf(buf,
"%s\n",value);
543 rlDebugPrintf(
"rlSvgAnimator.show state=%d objectname=%s\n",state,objectname);
548 sprintf(buf,
"gsvgShow(%d,%d)\n",
id,state);
551 sprintf(buf,
"%s\n",objectname);
576 float a11, a12, a13, a21, a22, a23, a31, a32, a33, cx, cy;
582 a11 = sx*((float) cos(alpha));
583 a12 = -sx*((float) sin(alpha));
584 a13 = (x0 - cx)*((
float) cos(alpha)) - (y0 - cy)*((float) sin(alpha)) + cx;
585 a21 = sx*((float) sin(alpha));
586 a22 = sx*((float) cos(alpha));
587 a23 = (x0 - cx)*((
float) sin(alpha)) + (y0 - cy)*((float) cos(alpha)) + cy;
592 return svgPrintf(objectname,
"transform=",
"matrix(%f,%f,%f,%f,%f,%f)",a11,a21,a12,a22,a13,a23);
641 char myline[
MAXLINE],*cptr, *cptr2;
646 cptr = strchr(myline,
'\n');
647 if(cptr != NULL) *cptr =
'\0';
649 if(myline[0] ==
'>' || strncmp(myline,
"/>",2) == 0)
664 else if(myline[0] ==
'<')
667 else if(strncmp(myline,
"id=",3) == 0)
669 cptr = strchr(myline,
'=');
673 cptr2 = strchr(cptr,
'\"');
674 if(cptr2 != NULL) *cptr2 =
'\0';
681 cptr = strchr(myline,
'=');
686 cptr2 = strrchr(cptr,
'\"');
687 if(cptr2 != NULL) *cptr2 =
'\0';
702 fin = fopen(infile,
"r");
703 if(fin == NULL)
return -1;
704 while(fgets(line,
sizeof(line)-1,fin) != NULL)
717 if(main_object == NULL)
return -1;
798 if (newScale > 1000) newScale = 1000.0f;
813 float newScale, scale1, scale2, rectWidth, rectHeight;
825 if(scale1 < scale2) newScale = scale1;
826 else newScale = scale2;