Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include <stdio.h></stdio.h>
Toshihiro Shimizu 890ddd
#include <stdlib.h></stdlib.h>
Toshihiro Shimizu 890ddd
#include <string.h></string.h>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define _TOONZ_PROTOTYPES_
Toshihiro Shimizu 890ddd
#include "toonz.h"
Toshihiro Shimizu 890ddd
#include "file.h"
Toshihiro Shimizu 890ddd
#include "version.h"
Toshihiro Shimizu 890ddd
#include "security.h"
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void main(int argc, char *argv[]) {
Shinya Kitaoka 120a6e
  char outname[512], inname[512], *boh;
Shinya Kitaoka 120a6e
  int len, i, j, total;
Shinya Kitaoka 120a6e
  IMAGE *img = 0, *newimg = 0;
Shinya Kitaoka 120a6e
  struct cmap_color *cmap;
Shinya Kitaoka 120a6e
  struct gl_color *gl_buffer;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  toonz_init(DUMMY_KEY_SLOT, (int *)&argc, argv);
Shinya Kitaoka 120a6e
  InibisciDongle();
Shinya Kitaoka 120a6e
  unprotect_lib();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (argc < 3) {
Shinya Kitaoka 120a6e
    printf(" %s error: missing argument\n", argv[0]);
Shinya Kitaoka 120a6e
    printf(" usage: %s infile outfile\n", argv[0]);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (*argv[1] == '-') {
Shinya Kitaoka 120a6e
    printf("bad filename <%s> \n", argv[1]);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  strcpy(inname, argv[1]);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  len = strlen(argv[2]);
Shinya Kitaoka 120a6e
  if (len < 4 || (STR_NE(argv[2] + len - 4, ".tzu") &&
Shinya Kitaoka 120a6e
                  STR_NE(argv[2] + len - 4, ".tzp"))) {
Shinya Kitaoka 120a6e
    printf("%s error: file %s is not tz(up)\n", argv[0], argv[2]);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  strcpy(outname, argv[2]);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  printf(">> Loading %s\n", inname);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  img = img_read(inname);
Shinya Kitaoka 120a6e
  if (!img) {
Shinya Kitaoka 120a6e
    printf("file %s not found\n", inname);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  printf(">> Immagine di dimensioni: %dx%d\n", img->pixmap.xsize,
Shinya Kitaoka 120a6e
         img->pixmap.ysize);
Shinya Kitaoka 120a6e
  printf(">Con savebox: %dx%d di dim %d,%d\n", img->pixmap.xD, img->pixmap.yD,
Shinya Kitaoka 120a6e
         img->pixmap.xSBsize, img->pixmap.ySBsize);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  printf(">> Writing %s\n", outname);
Shinya Kitaoka 120a6e
  if (!img_write_tzup(outname, img)) {
Shinya Kitaoka 120a6e
    printf("non sono stato in grado di scrivere: %s\n", outname);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  printf(">> Adesso che l'ho scritto lo rileggo \n");
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  newimg = img_read_tzup(outname);
Shinya Kitaoka 120a6e
  if (!newimg) {
Shinya Kitaoka 120a6e
    printf("file %s not found\n", inname);
Shinya Kitaoka 120a6e
    exit(0);
Toshihiro Shimizu 890ddd
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  printf(">> Immagine di dimensioni: %dx%d con %dx%d, %dx%d\n",
Shinya Kitaoka 120a6e
         newimg->pixmap.xsize, newimg->pixmap.ysize, newimg->pixmap.xD,
Shinya Kitaoka 120a6e
         newimg->pixmap.yD, newimg->pixmap.xSBsize, newimg->pixmap.ySBsize);
Shinya Kitaoka 120a6e
  total = newimg->pixmap.xsize * newimg->pixmap.ysize;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
#ifdef QUANDO_SERVE
Shinya Kitaoka 120a6e
  gl_buffer = (struct gl_color *)calloc(total, sizeof(struct gl_color));
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (i = 0; i < total; i++)
Shinya Kitaoka 120a6e
    if (newimg->pixmap.buffer[i] != 2063) {
Shinya Kitaoka 120a6e
      gl_buffer[i].red   = 0;
Shinya Kitaoka 120a6e
      gl_buffer[i].green = 0;
Shinya Kitaoka 120a6e
      gl_buffer[i].blue  = 0;
Shinya Kitaoka 120a6e
      gl_buffer[i].matte = 255;
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      gl_buffer[i].red   = 255;
Shinya Kitaoka 120a6e
      gl_buffer[i].green = 255;
Shinya Kitaoka 120a6e
      gl_buffer[i].blue  = 255;
Shinya Kitaoka 120a6e
      gl_buffer[i].matte = 0;
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  newimg->type          = RGB;
Shinya Kitaoka 120a6e
  newimg->pixmap.buffer = (unsigned short *)gl_buffer;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
newimg->cmap.name = NIL;
Shinya Kitaoka 120a6e
newimg->cmap.size = 2048;
Shinya Kitaoka 120a6e
newimg->cmap.offset = 2048;
Shinya Kitaoka 120a6e
newimg->cmap.color_n  = 32;
Shinya Kitaoka 120a6e
newimg->cmap.pencil_n = 4;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
newimg->cmap.buffer = (struct cmap_color*)
Shinya Kitaoka 120a6e
                malloc(sizeof(struct cmap_color)*newimg->cmap.size);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
cmap = newimg->cmap.buffer;
Shinya Kitaoka 120a6e
j = 0;
Shinya Kitaoka 120a6e
for(i=0; i<newimg->cmap.size; i++)</newimg->
Shinya Kitaoka 120a6e
{
Shinya Kitaoka 120a6e
cmap[i].red   = j;
Shinya Kitaoka 120a6e
cmap[i].green = j;
Shinya Kitaoka 120a6e
cmap[i].blue  = j;
Shinya Kitaoka 120a6e
j+=17;
Shinya Kitaoka 120a6e
if(j>255) j=0;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
newimg->cmap.names = NIL;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
force_to_rgb(newimg, NIL);
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  boh = "MAMMA.tif";
Shinya Kitaoka 120a6e
  printf(">> Writing %s\n", boh);
Shinya Kitaoka 120a6e
  if (!img_write_tzup(boh, newimg)) {
Shinya Kitaoka 120a6e
    printf("non sono stato in grado di scrivere: %s\n", boh);
Shinya Kitaoka 120a6e
    exit(0);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  printf(">> Riprovami e non te ne pentirai!! <<\n");
Toshihiro Shimizu 890ddd
}