Пример #1
0
Errcode pop_screen_id(LONG check_id)
{
Errcode err;

	if(--pushed_screen == 0)
	{
		if (pj_exists(screen_name))
		{
			if((err = load_pic(screen_name, vb.pencel,check_id,TRUE)) < 0)
				return(err);
			pj_delete(screen_name);
			return(Success);
		}
	}
	return(1); /* not popped */
}
JNIEXPORT jobject JNICALL Java_com_amlogic_graphics_PictureKit_loadPictureNative
  (JNIEnv* env, jclass thiz, jstring filename, jobject dec_obj) {
		
	aml_dec_para_t dec_info = {0};
	aml_image_info_t image_info = {0};
	const char* str=env->GetStringUTFChars(filename,NULL);
	jobject obj;
	dec_info.fn=(char*)str;
	dec_info.iwidth  = env->GetIntField(dec_obj, gdecoderInfo_imageWidthID);
	dec_info.iheight = env->GetIntField(dec_obj, gdecoderInfo_imageHeightID);
	dec_info.width   = env->GetIntField(dec_obj, gdecoderInfo_widthToDecoderID);
	dec_info.height  = env->GetIntField(dec_obj, gdecoderInfo_HeightToDecoderID);
	dec_info.mode 	 = env->GetIntField(dec_obj, gdecoderInfo_decodeModeID);
	dec_info.thumbpref = env->GetIntField(dec_obj,gdecoderInfo_thumbPreferID);
	dec_info.pic_type= env->GetIntField(dec_obj, gdecoderInfo_pictureTypeID);
	dec_info.colormode = COLOR_S32_ABGR;
	
	if(get_pic_info(&dec_info)==FH_ERROR_OK) {
		env->SetIntField(dec_obj, gdecoderInfo_imageWidthID,dec_info.iwidth);
		env->SetIntField(dec_obj, gdecoderInfo_imageHeightID,dec_info.iheight);
		env->SetIntField(dec_obj, gdecoderInfo_widthToDecoderID,0);
		env->SetIntField(dec_obj, gdecoderInfo_HeightToDecoderID,0);
		env->SetIntField(dec_obj, gdecoderInfo_colorModeID,0);
		env->SetIntField(dec_obj, gdecoderInfo_pictureTypeID,dec_info.pic_type);
		if(load_pic(&dec_info,&image_info)!=FH_ERROR_OK)  {
			obj=NULL;
		} else {
			obj = env->AllocObject(gImageInfo_class);
			if(obj) {
				env->SetIntField(obj, gdecoderInfo_originImageWidthID,dec_info.iwidth);
				env->SetIntField(obj, gdecoderInfo_originImageHeightID,dec_info.iheight);
				env->SetIntField(obj, gdecoderInfo_outImageWidthID,image_info.width);
				env->SetIntField(obj, gdecoderInfo_outImageHeightID,image_info.height);
				if (hasException(env)) {
					obj = NULL;
				}	
			}
		}
	}
	env->ReleaseStringUTFChars(filename,str);
	return obj;
}
JNIEXPORT jobject JNICALL Java_com_amlogic_graphics_PictureKit_loadPicture2BmNative
  (JNIEnv* env , jclass thiz, jstring filename, jobject dec_obj) {	
	aml_dec_para_t dec_info;
	aml_image_info_t image_info;
	const char* str=env->GetStringUTFChars(filename,NULL);
	memset(&dec_info,0,sizeof(aml_dec_para_t));
	memset(&image_info,0,sizeof(aml_image_info_t));
	jobject obj=NULL;
	dec_info.fn=(char*)str;
	dec_info.iwidth  = env->GetIntField(dec_obj, gdecoderInfo_imageWidthID);
	dec_info.iheight = env->GetIntField(dec_obj, gdecoderInfo_imageHeightID);
	dec_info.width   = env->GetIntField(dec_obj, gdecoderInfo_widthToDecoderID);
	dec_info.height  = env->GetIntField(dec_obj, gdecoderInfo_HeightToDecoderID);
	if(dec_info.width<=0) dec_info.width=1280;
	if(dec_info.height<=0) dec_info.height=720;
	dec_info.mode 	 = env->GetIntField(dec_obj, gdecoderInfo_decodeModeID);
	
	dec_info.thumbpref = env->GetIntField(dec_obj,gdecoderInfo_thumbPreferID);
	dec_info.pic_type= env->GetIntField(dec_obj, gdecoderInfo_pictureTypeID);
	dec_info.colormode = COLOR_S32_ABGR;
	dec_info.image_3d_mode_pref = env->GetIntField(dec_obj, gdecoderInfo_3DPrefID);
	dec_info.image_3d_lr_offset = env->GetIntField(dec_obj, gdecoderInfo_3DParam1ID);
	dec_info.image_3d_preserv = env->GetIntField(dec_obj, gdecoderInfo_3DParam2ID);
	/*ALOGD("%d===%d==%d=======\n",dec_info.image_3d_mode_pref,
			dec_info.image_3d_info.l_or_r_first,
			dec_info.image_3d_info.image_offset);*/
	
	if(get_pic_info(&dec_info)==FH_ERROR_OK) {
		env->SetIntField(dec_obj, gdecoderInfo_imageWidthID,dec_info.iwidth);
		env->SetIntField(dec_obj, gdecoderInfo_imageHeightID,dec_info.iheight);
		env->SetIntField(dec_obj, gdecoderInfo_widthToDecoderID,0);
		env->SetIntField(dec_obj, gdecoderInfo_HeightToDecoderID,0);
		env->SetIntField(dec_obj, gdecoderInfo_colorModeID,0);
		env->SetIntField(dec_obj, gdecoderInfo_pictureTypeID,dec_info.pic_type);
		if(load_pic(&dec_info,&image_info)!=FH_ERROR_OK)  obj=NULL; 
		else if(image_info.width<=0||image_info.height<=0) obj=NULL;
		else obj = create_java_bitmap(env,image_info.data,image_info.width,image_info.height,32);
		if(image_info.data) free(image_info.data);
	}
	env->ReleaseStringUTFChars(filename,str);
	return obj;
}
Пример #4
0
static test_result pic (char *res, char *raw)
{
	int i;
	test_result result = TEST_OK;

	if (load_pic (res) == TEST_FAIL)
		return TEST_FAIL;

	test_report ("drawing and comparing 50x");

	for (i = 0; i < 50; i++) {
		decode_picture (0,1);
		if ((result = compare_pic (raw)) != TEST_OK) 
			break;
	}

	free (game.pictures[0].rdata);

	return result;
}
Пример #5
0
static Errcode pop_alt_id(LONG check_id)
{
Errcode err;

	if (--pushed_alt == 0)
	{
		if (!vl.alt_cel && pj_exists(alt_name) )
		{
			if(alloc_pencel(&vl.alt_cel) >= 0)
			{
				if((err = load_pic(alt_name, vl.alt_cel, check_id,TRUE)) < 0)
				{
					pj_rcel_free(vl.alt_cel);
					vl.alt_cel = NULL;
					return(err);
				}
				pj_delete(alt_name);
			}
		}
	}
	return(0);
}
Пример #6
0
int main(int argc, char **argv)
{
    char *srcname = NULL;
    char *destname = NULL;

    printf("Picture -> C64 charset invertor!\n");
    if (argc < 2)
    {
        printf("Usage: pic2chr <lbm> <prg> + switches\n\n"
               "Switches are:\n"
               "/fXX First char to use. Default 0.\n"
               "/bXX Set background ($D021) color to XX. Default 0.\n"
               "/mXX Set multicolor 1 to XX.\n"
               "/nXX Set multicolor 2 to XX.\n"
               "/xXX Set Xsize to XX. (default 40)\n"
               "/yXX Set Ysize to XX. (default 25)\n"
               "/d   Don't search for duplicates\n"
               "/c   Don't save colormap\n"
               "/1   Singlecolor\n"
               "/s   Don't save screendata\n"
               "/t   Don't save chars\n");
        return 1;
    }

    printf("* PROCESSING COMMAND LINE\n");
    for (c = 1; c < argc; c++)
    {
        if ((argv[c][0] == '-') || (argv[c][0] == '/'))
        {
            char cmd = tolower(argv[c][1]);
            switch (cmd)
            {
            case 'f':
                sscanf(&argv[c][2], "%d", &firstchar);
                break;

            case '1':
                singlecolor = 1;
                break;

            case 'b':
                sscanf(&argv[c][2], "%d", &bgcol);
                break;

            case 'm':
                sscanf(&argv[c][2], "%d", &multi1);
                break;

            case 'n':
                sscanf(&argv[c][2], "%d", &multi2);
                break;

            case 'c':
                nocolors = 1;
                break;

            case 't':
                nochars = 1;
                break;

            case 's':
                noscreen = 1;
                break;

            case 'd':
                nodup = 1;
                break;

            case 'x':
                sscanf(&argv[c][2], "%d", &cols);
                break;

            case 'y':
                sscanf(&argv[c][2], "%d", &rows);
                break;
            }
        }
        else
        {
            if (srcname == NULL)
            {
                srcname = argv[c];
            }
            else
            {
                if (destname == NULL)
                {
                    destname = argv[c];
                }
            }
        }
    }
    if ((!srcname) || (!destname))
    {
        printf("  Source & destination filenames needed!\n");
        return 1;
    }

    printf("* LOADING PICTURE\n");
    if (!load_pic(srcname))
    {
        printf("Could not open input!\n");
        return 1;
    }
    if ((useheight > 0) && (useheight < sc.sizey)) sc.sizey = useheight;
    if (sc.sizex != 320)
    {
        printf("Picture must be 320 pixels wide!\n");
        return 1;
    }
    if (sc.sizey & 7)
    {
        printf("Picture height must be multiple of 8!\n");
        return 1;
    }

    printf("* CREATING DESTINATION FILE\n");
    handle = fopen(destname, "wb");
    if (!handle)
    {
        printf("Shit happened!\n");
        return 1;
    }
    if (process())
    {
        printf("Out of memory while processing!\n");
        fclose(handle);
        return 1;
    }
    printf("* CLOSING DESTINATION & EXITING\n");
    fclose(handle);
    return 0;
}
Пример #7
0
/* load all pics */
void load_pictures()
{
	int i;

	sur_logo = load_pic("img/stall_logo.png");
	sur_wave1 = load_pic("img/wave1.png");
	sur_wave2 = load_pic("img/wave2.png");
	sur_wave3 = load_pic("img/wave3.png");
	sur_wave_cleared = load_pic("img/wave_cleared.png");
	sur_sprites = load_pic("img/sprites1.png");
	sur_enemy = load_pic("img/enemy48x39.png");
	sur_enemy_bullet = load_pic("img/blue_bullet.png");

	/* load bgs into wave_t objects */
	waves[0].bg = load_pic("img/bg_wave1.png");
	waves[1].bg = load_pic("img/bg_wave2.png");
	waves[2].bg = load_pic("img/bg_wave3.png");
	waves[3].bg = load_pic("img/bg_wave4.png");
	waves[4].bg = load_pic("img/bg_wave5.png");

	waves[0].enemy = load_pic("img/enemies1.png");
	waves[1].enemy = load_pic_alpha("img/enemies2.png");

	/* load boss bgs */
	sur_boss1 = load_pic("img/bg_boss1.png");

	/* load array of bonuses */
	sur_bonus[0] = load_pic("img/bonus_armor_breaker.png");
	sur_bonus[1] = load_pic("img/bonus_triple_shot.png");
	sur_bonus[2] = load_pic_alpha("img/bonus_defshield.png");
	sur_bonus[3] = load_pic("img/bonus_random_bomb.png");
	sur_bonus[4] = load_pic("img/bonus_ram.png");
	sur_bonus[5] = load_pic("img/bonus_missiles.png");
	sur_bonus[6] = load_pic("img/bonus_acc.png");

	sur_bonus_ram[0] = load_pic("img/bonus_ram_00.png");
	sur_bonus_ram[1] = load_pic("img/bonus_ram_01.png");
	sur_bonus_ram[2] = load_pic("img/bonus_ram_02.png");

	/* bonuses on_player */
	bonus_defshield.img = load_pic("img/defshield1.png");

//	sur_test_anim = load_pic("img/test_animation.png");
//	sur_blades = load_pic("img/strip_saucer_blades.png");
}
Пример #8
0
int main(int argc, char *argv[])
{
  image myPic;
  imageInfo picInfo;
  int count;
  char *outputType = NULL;
  int err;
  int aCrop = NO;
  int left = -1, right = -1, top = -1, bottom = -1;
  double xscale = 1, yscale = 1;
  double xs2, ys2;
  int xdim = 0, ydim = 0;
  int ditherMode = ' ';
  int mMono = NO;
  int outType = NO;
  int scaletofit = NO;
  int numBits = 1;
  char *outFile = NULL;
  char *type = NULL, *ext = NULL;
  char *p;
  int nv;
  double darken = 0;
  double contrast = 0;
  double rotate = 0;
  struct stat sbuf;
  int blend = NO;
  static char filename[MAXPATHLEN + 1] = "";
  int negative = NO;
  int enhance = NO;
  formatInfo fInfo;
  

  count = getargs(argc, argv, "nbosabLiRiTiBixdydXiYidcmbpbsbbiDdSbKdfseird",
		   &negative, &outputType, &aCrop, &left, &right, &top,
		   &bottom, &xscale, &yscale, &xdim, &ydim, &ditherMode,
		   &mMono, &outType, &scaletofit, &numBits, &darken,
		   &blend, &contrast, &outFile, &enhance, &rotate
		   );

  if (count < 0 || count == argc) {
    if (count < 0 && -count != '-')
      fprintf(stderr, "Bad flag: %c\n", -count);
    fprintf(stderr, "Usage: %s [-options] filename\n"
	     "  options:\n"
	     "\tn: make negative\n"
	     "\to: string indicating output format\n"
	     "\ta: auto crop non plotting areas\n"
	     "\tL, R, T, B: specify where to crop picture\n"
	     "\tx, y: specify scale factor in that direction\n"
	     "\tX, Y: specify dimension of picture in that direction\n"
	     "\td: select dither method: (D)ither, (T)hreshold, or (H)alftone\n"
	     "\tm: convert image to monochrome\n"
	     "\tp: dither image for output to printer\n"
	     "\ts: scale image to fill up specified screen\n"
	     "\tb: number of bits to dither to\n"
	     "\tD: how much to brighten image\n"
	     "\tK: contrast level\n"
	     "\tS: blend pixels together when scaling\n"
	     "\tf: file name to save to\n"
	     "\te: contrast for enhance image\n"
	     "\tr: number of degrees to rotate\n"
	     , *argv);
    exit(1);
  }

  for (; count < argc; count++) {
    if ((err = load_pic(argv[count], &myPic))) {
      fprintf(stderr, "Cannot load file %s\nError: %s\n", argv[count], picErrorStr(err));
      exit(1);
    }
    
    if (!getImageInfo(argv[count], &picInfo))
      type = picInfo.extension;

    if (!outputType) 
      outputType =  type;

    if (!infoForFormat(outputType, &fInfo)) {
      ext = fInfo.extension;
      if (scaletofit && !xdim && !ydim && fInfo.maxWidth && fInfo.maxHeight) {
	xdim = fInfo.maxWidth;
	ydim = fInfo.maxHeight;
      }
    }
    
    if (mMono)
      makeMono(&myPic);
    
    if (left >= 0 || right >= 0 || top >= 0 || bottom >= 0) {
      if (left < 0)
	left = 0;
      if (right < 0)
	right = myPic.width - 1;
      if (top < 0)
	top = 0;
      if (bottom < 0)
	bottom = myPic.height - 1;
      cropImage(left, top, right, bottom, &myPic);
    }
    
    if (aCrop)
      autoCropImage(&myPic, 40);

    if (rotate)
      rotateImage(&myPic, (rotate * -3.141592) / 180.0);
    
    xs2 = xscale;
    ys2 = yscale;
    if (scaletofit) {
      if (!ydim && xdim) {
	xs2 = (double) xdim / ((double) myPic.width * xscale) * xscale;
	ys2 = ((double) xdim / ((double) myPic.width * xscale)) * yscale;
      }
      else if (ydim) {
	xs2 = ((double) ydim / ((double) myPic.height * yscale)) * xscale;
	ys2 = (double) ydim / ((double) myPic.height * yscale) * yscale;
	if (xdim && (myPic.width * xs2) > xdim) {
	  xs2 = (double) xdim / ((double) myPic.width * xscale) * xscale;
	  ys2 = ((double) xdim / ((double) myPic.width * xscale)) * yscale;
	}
      }
    }
    else {
      if (xdim)
	xs2 = (double) xdim / (double) myPic.width;
      if (ydim)
	ys2 = (double) ydim / (double) myPic.height;
    }
    xscale = xs2;
    yscale = ys2;

    scaleImage(xscale, yscale, blend, &myPic);

    if (darken || contrast)
      adjustImage(&myPic, contrast, darken);
    if (enhance) {
      makeMono(&myPic);
      enhanceImage(&myPic, enhance);
    }
    
    handle_dithering(ditherMode, &myPic, outType, numBits);
    if (negative)
      negateImage(&myPic);

    if (outFile) {
      strcpy(filename, outFile);
      if (!stat(filename, &sbuf) && (sbuf.st_mode & S_IFDIR)) {
	if (filename[strlen(filename) - 1] != '/')
	  strcat(filename, "/");
	if ((p = strrchr(argv[count], '/')))
	  strcat(filename, p + 1);
	else
	  strcat(filename, argv[count]);
      }
    }
    else
      strcpy(filename, argv[count]);
    
    p = change_extension(filename, type, ext, 0);
    nv = 2;
    while (!stat(p, &sbuf)) {
      p = change_extension(filename, type, ext, nv);
      nv++;
    }

    if ((err = save_pic(p, outputType, &myPic))) {
      fprintf(stderr, "Cannot save file %s\nError: %s\n", p, picErrorStr(err));
      exit(1);
    }

    fprintf(stderr, "Saved %s as %s\n", argv[count], p);

    freeImage(&myPic);
  }

  exit(0);
  return 0;
}
Пример #9
0
static int load_fli_overlay(char *title, int how)

/* returns ecode if can't do. This reports errors.*/
{
Errcode err;
Rcel *loadcel = NULL;
Cmap *cmap = NULL;
int usr_fit = 0; /* start off not knowing how to fit colors */
Flifile flif;
int i = 0;
int fit_option;
int fcount;
Vabortdat vd;
Boolean overlay_fit;

	clear_struct(&flif);

	vd.totframes = &flif.hdr.frame_count;
	vd.frame = &i;
	set_abort_verify(olay_abort_verify,&vd);

	if((err = save_pic(screen_name, vb.pencel,0,TRUE)) < 0)
		goto error;

	if((err = pj_fli_open(title,&flif,JREADONLY)) < 0)
		goto error;

	/* allocate fli size cel to hold fli frame(s) */
	if((err = valloc_ramcel(&loadcel,flif.hdr.width,flif.hdr.height)) < 0)
		goto error;
	if((err = pj_cmap_alloc(&cmap,COLORS)) < Success)
		goto error;
	if((err = pj_fli_seek_first(&flif)) < 0)
		goto error;

	for (i=0; i<flif.hdr.frame_count; i++)
	{
		if (i != 0 && vs.frame_ix == 0)
		{
			if (soft_qchoice(NULL, "comp_past") != 0)
				goto aborted;
		}
		if ((err = pj_fli_read_next(title,&flif,loadcel,0)) < 0)
			goto error;
		if (!cmaps_same(loadcel->cmap, vb.pencel->cmap))
		{
			if (!usr_fit)
			{
				if((usr_fit = 1 + soft_qchoice(NULL, "comp_cmap")) <= 0)
					goto aborted;
			}
			fit_option = usr_fit;
		}
		else
			fit_option = 0;

		/* switch to get the color map into cmap */
		switch (fit_option)
		{
			case 0:	/* both are same.  yea! */
			case 2:	/* keep current */
			case 4:	/* No Fit */
				pj_cmap_copy(vb.pencel->cmap,cmap);
				break;
			case 3: /*use overlay cmap */
				pj_cmap_copy(loadcel->cmap, cmap);
				goto do_screen_cfit;
			case 1: /* compromise cmap */
				compromise_cmap(vb.pencel->cmap, loadcel->cmap, cmap);
			do_screen_cfit:
				cfit_rcel(vb.pencel,cmap);
				pj_cmap_copy(cmap,vb.pencel->cmap);
				see_cmap();
				break;
		}

		if (i == 0)  /* let user position first frame */
		{
			save_undo();
			switch (fit_option)	/* figure out whether to fit cel to display
								 * for user to position. */
				{
				case 0:	/* both are same.  yea! */
				case 3: /*use overlay cmap */
				case 4:	/* No Fit */
					overlay_fit = FALSE;
					break;
				case 1: /* compromise cmap */
				case 2:	/* keep current */
					overlay_fit = TRUE;
					break;
				}
			move_rcel(loadcel,overlay_fit,FALSE);

			if(!soft_yes_no_box("olay_start"))
			{
				load_pic(screen_name, vb.pencel, 0, TRUE);
				goto aborted;
			}
			/* we're committed now */
			pj_delete(screen_name);
			dirties();
		}
		switch (how)
		{
			case 0:	 /* over/under */
				if(i != 0)
					save_undo();
				if((err = may_cfit_blit_cel(loadcel, fit_option)) < 0)
					goto error;
				break;
			case  2: /* crossfade */
				if ((fcount = flif.hdr.frame_count-1) == 0)
					fcount = 1;
				pj_rcel_copy(vb.pencel, undof);
				if((err = transpblit(loadcel, 0, FALSE, 
					(i*(long)100+flif.hdr.frame_count/2)/fcount)) < Success)
				{
					goto error;
				}
				break;
		}
		if((err = sub_cur_frame()) < Success)
			goto error;
		if(poll_abort() < Success)
			goto aborted;
		vs.frame_ix++;
		check_loop();
		if((err = unfli(vb.pencel,vs.frame_ix,1)) < 0)
			goto error;
	}
	err = 0;
	goto OUT;

aborted:
	err = Err_abort;
error:
	err = softerr(err,"!%s", "comp_load", title);
OUT:
	pj_cmap_free(cmap);
	pj_rcel_free(loadcel);
	pj_fli_close(&flif);
	set_abort_verify(NULL);
	return(err);
}
Пример #10
0
int main(int argc, char **argv)
{
  char *srcname = NULL;
  char *destname = NULL;

  printf("BENTON INVERTOR for C64-pics by Cadaver!\n");
  if (argc < 2)
  {
    printf("Usage: BENTON64 <lbm> <prg> + switches\n\n"
           "Switches are:\n"
           "/hXX Clip picture height to XX\n"
           "/wXX Clip picture width to XX\n"
           "/bXX Set background ($D021) color to XX\n"
           "     By default it's the most used color.\n"
           "/sXX Set picture start address in hex (default a000)\n"
           "/r   Raw save (no .PRG start address included)\n"
           "/o   Optimal save (do not align bitmap & screen data to page boundary)\n"
           "/c   Save color data before bitmap\n");
    return 1;
  }

  printf("* PROCESSING COMMAND LINE\n");
  for (c = 1; c < argc; c++)
  {
    if ((argv[c][0] == '-') || (argv[c][0] == '/'))
    {
      char shit = tolower(argv[c][1]);
      switch (shit)
      {
        case 'h':
        sscanf(&argv[c][2], "%d", &useheight);
        break;

        case 'w':
        sscanf(&argv[c][2], "%d", &usewidth);
        break;

        case 'b':
        sscanf(&argv[c][2], "%d", &forcebgcol);
        break;

        case 's':
        sscanf(&argv[c][2], "%x", &startadr);
        break;

        case 'r':
        rawsave = 1;
        break;

        case 'c':
        cbefore = 1;
        break;

        case 'o':
        optimalsave = 1;
        break;
      }
    }
    else
    {
      if (srcname == NULL)
      {
        srcname = argv[c];
      }
      else
      {
        if (destname == NULL)
        {
          destname = argv[c];
        }
      }
    }
  }
  if ((!srcname) || (!destname))
  {
    printf("  Source & destination filenames needed!\n");
    return 1;
  }

  printf("* LOADING PICTURE\n");
  if (!load_pic(srcname))
  {
    printf("Shit happened!\n");
    return 1;
  }
  if ((useheight > 0) && (useheight < sc.sizey)) sc.sizey = useheight;
  if ((usewidth > 0) && (usewidth < sc.sizex))
  {
    for (y = 0; y < sc.sizey; y++)
    {
      memmove(sc.data+usewidth*y,sc.data+sc.sizex*y,usewidth);
    }
    sc.sizex = usewidth;
  }

  if (sc.sizey & 7)
  {
    printf("Picture height must be multiple of 8!\n");
    return 1;
  }
  if (sc.sizex & 7)
  {
    printf("Picture width must be multiple of 8!\n");
    return 1;
  }
  if (sc.sizey > 200)
  {
    printf("Picture height must not exceed 200!\n");
  }
  if (sc.sizex > 320)
  {
    printf("Picture width must not exceed 320!\n");
    return 1;
  }
  rows = (sc.sizey)/8;
  columns = (sc.sizex)/8;
  countcolors();
  printf("Columns %d rows %d\n", columns, rows);

  printf("* CREATING DESTINATION FILE\n");
  handle = fopen(destname, "wb");
  if (!handle)
  {
    printf("Shit happened!\n");
    return 1;
  }
  if (process())
  {
    printf("Out of memory while processing!\n");
    fclose(handle);
    return 1;
  }
  printf("* CLOSING DESTINATION & EXITING\n");
  fclose(handle);
  return 0;
}