Example #1
0
char *poster_tos(poster p)
{
  char buf[256];
  memset(buf,'\0',256);
  char *s1 = v3_tos(p.upper_left);
  char *s2 = rgb_tos(p.shine);
  snprintf(buf,256,"poster(%s,%.2fx%.2f,<FN>,%s)",
	   s1,p.w,p.h,s2);
  free(s1);
  free(s2);
  return strdup(buf);
}
Example #2
0
char *sphere_tos(sphere *s)
{
    char buf[128];
    int i;
    for (i=0; i<127; i++)
        buf[i] = '\0';
    char *cen = vec_tos(s->center);
    char *col= rgb_tos(s->color);
    sprintf(buf, "Center: %s\nRadius: %lf\nColor: %s",
            cen, s->radius, col);
    free(cen);
    free(col);
    return strdup(buf);
}