亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ps2raster.c

?? contains some miscellaneous programs that may come in handy for some users.
?? C
字號:
/*--------------------------------------------------------------------

 *    $Id: ps2raster.c,v 1.4 2005/12/27 18:03:27 remko Exp $

 *

 *    Copyright (c) 2006 by J. Luis

 *    See README file for copying and redistribution conditions.

 *--------------------------------------------------------------------*/

/*

 *

 * ps2raster converts one or several ps file(s) to raster formats using GhostScript.

 * It works by modifying the BoundingBox and PageSize in order that the raster

 * image will have a size which is specified by the BoundingBox. 

 * As an option, a tight BoundingBox may be computed.

 * ps2raster uses the ideas of the EPS2XXX.m from Primoz Cermelj published in MatLab Central

 * and of psbox_sh of Remko Scharroo.

 *

 *

 *--------------------------------------------------------------------*/

/*

 * Author:	Joaquim Luis

 * Created:	15-FEB-2005

 * Modified:	15-NOV-2005 (It used to fail too many times in detecting if is GMT_ps)

 *		01-DEC-2005 Changed the generated script name to not overlap with -N

 *		27-DEC-2005 Integrated into GMT's misc supplement

 *		

 */



#include "gmt.h"



void run_cmd (char *name, char *cmd, int rem1, int rem2);



int main (int argc, char **argv) {

	int i, j, k, len, x0 = 0, x1 = 612, y0 = 0, y1 = 828, w = 828, h = 612, n_files = 0, n_alloc = 100;

	int error = FALSE, adjust_BB = FALSE, no_rem = FALSE, have_list = FALSE, verbose = FALSE;

	int ps_GMT, got_BB, got_adjusted_BB, atend;

	

	char ps_file[BUFSIZ];

	char **ps_names;

	char line[BUFSIZ], c[BUFSIZ], c1[10], c2[10], c3[10], c4[10], c5[10], cmd[BUFSIZ];

	char *tmp_file = NULL, *out_file = NULL, *BB_file = NULL, *fullGsPath = NULL;

	char *script_name = NULL, *scriptBB = NULL, *gs_params = NULL, *gs_BB = NULL;

	char *dpi = "300", *ext = ".jpg", *device = "jpeg";

	FILE *fp = NULL, *fpo = NULL, *fpb = NULL, *fpl = NULL;

	

	/* Parameters for all the formats available */

	gs_params = "-q -dNOPAUSE -dBATCH -dDOINTERPOLATE -dUseFlateCompression=true -sDEVICE=";

	gs_BB = "-q -dNOPAUSE -dBATCH -sDEVICE=bbox ";



#ifdef _WIN32

	fullGsPath = "gswin32c ";

	script_name = "psTOraster.bat";

	scriptBB = "to_BB.bat";

#else

	fullGsPath = "gs ";

	script_name = "psTOraster.sc";

	scriptBB = "to_BB.sc";

#endif

	

	/* Check and interpret the command line arguments */

	

	for (i = 1; i < argc; i++) {

		if (argv[i][0] == '-') {

			switch(argv[i][1]) {

				case '\0':

					GMT_quick = TRUE;

					break;

				

				/* Supplemental parameters */

				case 'A':

					adjust_BB = TRUE;

					break;

				case 'G':

					fullGsPath = &argv[i][2];

					strcat(fullGsPath," ");		/* We need this blank space */

					break;

				case 'E':

                                        dpi = &argv[i][2];

					break;

				case 'L':

					if ((fpl = fopen (&argv[i][2], "r")) == NULL) {

						fprintf (stderr, "%s: GMT ERROR: Cannot to open list file %s\n", GMT_program, argv[i]); 

						error = TRUE;

					}

					have_list = TRUE;

					break;

				case 'N':

					no_rem = TRUE;

					break;

				case 'T':	/* Select output format */

					for (j = 2; argv[i][j]; j++) {

						switch (argv[i][j]) {

							case 'f':	/* PDF */

								ext = ".pdf";

								device = "pdfwrite";

								break;

							case 'j':	/* JPEG */

								ext = ".jpg";

								device = "jpeg";

								break;

							case 'g':	/* PNG */

								ext = ".png";

								device = "png16m";

								break;

							case 'm':	/* PPM */

								ext = ".ppm";

								device = "ppm16m";

								break;

							case 't':	/* TIFF */

								ext = ".tif";

								device = "tifflzw";

								break;

							default:

								fprintf (stderr, "%s: GMT ERROR: Unrecognized option %s\n", GMT_program, argv[i]); 

								error = TRUE;

								break;

						}

					}

					break;

				case 'V':

					verbose = TRUE;

					break;

				/* Options not recognized */

				default:

					error = TRUE;

					break;

			}

		}

		else {

			strcpy (ps_file, argv[i]);

			n_files++;

		}

	}

	

	if (argc == 1 || GMT_quick || error) {

		fprintf (stderr,"ps2raster %s - Converts one or several PS file(s) to raster formats using GhostScript.\n\n", GMT_VERSION);

		fprintf(stderr,"usage: ps2raster <psfile1> <psfile2> <...> [-A] [-E<resolution>]\n");

		fprintf(stderr,"       [-G<ghost_path>] [-L<listfile>] [-N] [-Tf|j|g|m|t] [-V]\n\n");

		if (GMT_quick) exit (EXIT_FAILURE);

		

		fprintf (stderr,"Works by modifying the BoundingBox and PageSize in order that the raster\n");

		fprintf (stderr,"image will have the size specified by the BoundingBox.\n");

		fprintf (stderr,"As an option, a tight BoundingBox may be computed.\n\n");

		fprintf (stderr,"	<psfile(s)> postscript file(s) to be converted.\n");

		fprintf(stderr,"\n\tOPTIONS:\n");

		fprintf (stderr,"\t-A Adjust the BoundingBox to the minimum required by the image contents\n");

		fprintf (stderr,"\t-E Set raster resolution in dpi [default = 300]\n");

		fprintf (stderr,"\t-G Full path to your ghostscript executable.\n");

		fprintf (stderr,"\t   NOTE: Under Unix systems this is generally not necessary.\n");

		fprintf (stderr,"\t   Under Windows, ghostscript is not added to the system's path.\n");

		fprintf (stderr,"\t   So either you do it yourself, or give the full path here.\n");

		fprintf (stderr,"\t   (e.g. -Gc:\\programs\\gs\\gs7.05\\bin\\gswin32c).\n");

		fprintf (stderr,"\t-L The <listfile> is an ASCII file with names of ps files to be converted\n");

		fprintf (stderr,"\t-N Do Not remove auxiliary files [default, does]. Auxiliary files are\n");

		fprintf (stderr,"\t   build using as base the input ps files and consist of:\n");

		fprintf (stderr,"\t   psfile_tmpxx.eps -> postcript with a modified BoundingBox\n");

		fprintf (stderr,"\t   ps2raster.sc|bat -> script (or batch) with the GS command that does the job\n");

		fprintf (stderr,"\t   Use this option to save the script and run it later with different settings\n");

		fprintf (stderr,"\t-T Set output raster format [default is jpeg]\n");

		fprintf (stderr,"\t   f means PDF\n");

		fprintf (stderr,"\t   j means JPEG\n");

		fprintf (stderr,"\t   g means PNG\n");

		fprintf (stderr,"\t   m means PPM\n");

		fprintf (stderr,"\t   t means TIF\n");

		exit (EXIT_FAILURE);

	}



	if (n_files > 1 && have_list) {

		fprintf (stderr, "%s: GMT SYNTAX ERROR: Cannot handle both a file list and multiple ps files in input\n", GMT_program);

		error = TRUE;

	}



	if (error) exit (EXIT_FAILURE);



	if (have_list) {		/* Multiple files in a file with their names */

		ps_names = (char **) calloc ((size_t)(n_alloc), sizeof (char *));

		while (fgets (line, BUFSIZ, fpl) != NULL) {

			ps_names[n_files] = (char *) calloc (BUFSIZ, sizeof (char));

			if (line[0] == '#' || line[0] == '\n' || line[0] == '\r') continue;

			sscanf (line, "%s",ps_names[n_files]);

			n_files++;

			if (n_files > n_alloc) {

				n_alloc += 100;

				ps_names = realloc (ps_names, n_alloc * sizeof (char *));

			}

		}

		fclose (fpl);

	}

	else if (n_files > 1) {		/* Multiple files given in command line */

		ps_names = (char **) calloc ((size_t)(n_alloc), sizeof (char *));

		j = 0;

		for (k = 1; k < argc; k++) {

			if (argv[k][0] == '-') continue;

			ps_names[j] = (char *) calloc (BUFSIZ, sizeof (char));

			ps_names[j] = argv[k];

			j++;

			if (n_files > n_alloc) {

				n_alloc += 100;

				ps_names = realloc (ps_names, n_alloc * sizeof (char *));

			}

		}

	}

	else {				/* Single file */

		ps_names = (char **) calloc ((size_t)(1), sizeof (char *));

		ps_names[0] = ps_file;

	}



	for (k = 0; k < n_files; k++) {		/* Loop over all input files */

		strcpy(ps_file,ps_names[k]);

		if ((fp = fopen (ps_file, "r")) == NULL) {

			fprintf (stderr, "%s: Cannot to open file %s\n", GMT_program, ps_file);

			continue;

		}	

		ps_GMT = FALSE;

		atend = FALSE;

		got_BB = FALSE;

		got_adjusted_BB = FALSE;



		len = strlen(ps_file);

		j = len - 1;

		for (i = 0; i < len; i++, j--) {

			if (ps_file[j] == '.') break;

		} 

		tmp_file = (char *) calloc ((size_t)(j+12), sizeof(char));

		out_file = (char *) calloc ((size_t)(j+6), sizeof(char));



		/* Adjust to a tight BoundingBox if User required so */

		if (adjust_BB) {

			BB_file = (char *) calloc ((size_t)(j+7), sizeof(char));

			for (i = 0; i < j; i++) BB_file[i] = ps_file[i];

			strcat(BB_file,".bbox");

			sprintf(cmd,"%s",fullGsPath);

			strcat(cmd,gs_BB);

			strcat(cmd,ps_file);

			strcat(cmd," 2> ");

			strcat(cmd,BB_file);

			run_cmd(scriptBB, cmd, 0, 0);	/* Execute the script that computes the tight BB */

			if ((fpb = fopen (BB_file, "r")) == NULL) {

				fprintf (stderr, "%s: Unable to open file %s\n", GMT_program, BB_file);

				exit (EXIT_FAILURE);

			}

			while (fgets (line, BUFSIZ, fpb) != NULL) {

				sscanf (line, "%s",c); 

				if (strcmp(c,"%%BoundingBox:") == 0) {

					sscanf (line, "%s %s %s %s %s",c1,c2,c3,c4,c5); 

					x0 = atoi (c2);		y0 = atoi (c3);

					x1 = atoi (c4);		y1 = atoi (c5);

					got_adjusted_BB = TRUE;

				}

			}

			fclose (fpb);

			run_cmd(BB_file, cmd, 1, 0);	/* Remove the file with BB info */

			free ((void *)BB_file);

		}



		for (i = 0; i < j; i++) tmp_file[i] = ps_file[i];

		for (i = 0; i < j; i++) out_file[i] = ps_file[i];

		strcat(tmp_file,"_tmpxx.eps");

		if ((fpo = fopen (tmp_file, "w")) == NULL) {

			fprintf (stderr, "%s: Unable to open file %s for writing\n", GMT_program, tmp_file);

			exit (EXIT_FAILURE);

		}

		strcat(out_file,ext);



		/* Build the converting ghost command */

		sprintf(cmd,"%s",fullGsPath);

		strcat(cmd,gs_params);

		strcat(cmd,device);

		strcat(cmd," -r");

		strcat(cmd,dpi);

		strcat(cmd," -sOutputFile=");

		strcat(cmd,out_file);

		strcat(cmd," -f ");

		strcat(cmd,tmp_file);



		/* The following assumes that the BoundingBox command will be found in the first 20 lines.

		   It serves for three purposes:

		   1 - See if we have a case of BoundingBox == (atend)

		   2 - Find out if we dealing (or not) with a GMT ps file

		   3 - Speed up the greping code */

		for (i = 0; i < 20; i++) {

			fgets (line, BUFSIZ, fp);

			sscanf (line, "%s",c); 

			if (!got_BB && !strncmp(c,"%%BoundingBox:", 14)) {

				sscanf (line, "%s %s %s %s %s",c1,c2,c3,c4,c5); 

				if (!strncmp(c2,"(atend)", 7)) {

					if (!adjust_BB) {

						fprintf (stderr, "%s: To convert the %s file you must use the -A option\n", GMT_program, ps_file);

						exit (EXIT_FAILURE); 

					}

					atend = TRUE;

				}

				if (!got_adjusted_BB) {		/* Otherwise BoundingBox was already adjusted above as required by -A option */

					x0 = atoi (c2);		y0 = atoi (c3);

					x1 = atoi (c4);		y1 = atoi (c5);

				}

				w = irint (fabs(x1 - x0));

				h = irint (fabs(y1 - y0));

				fprintf (fpo, "%s 0 0 %d %d\n", c1,w,h);

				got_BB = TRUE;

			}

			else if (!strcmp(line,"%%Creator: GMT\n")) {	/* Not sure that this test always works in finding GMT ps */

				ps_GMT = TRUE;

				fprintf (fpo, "%s", line);

			}

			else if (!strncmp(c,"%%BeginProlog", 13)) {

				if (!ps_GMT) {		/* It is not a GMT ps file. Lets hope the following will work */

					fprintf (fpo, "<< /PageSize [ %d %d ] >> setpagedevice\n", w,h);

					fprintf (fpo, "gsave %d %d translate\n\n", -x0,-y0);

					fprintf (fpo, "%s", line);

				}

				else

					fprintf (fpo, "%s", line);

			}

			else

				fprintf (fpo, "%s", line);

		}

		if (!got_BB) {

			fprintf (stderr, "%s: GMT FATAL ERROR: The file %s has no BoundingBox in the first 20 lines\n", GMT_program, ps_file);

			exit (EXIT_FAILURE); 

		}



		/* Do the rest of the postscript file */

		while (fgets (line, BUFSIZ, fp) != NULL) {

			if (line[0] != '%') {

				fprintf (fpo, "%s", line);

				continue;	/* We are looking only for information on comment lines */

			}

			if (atend) {		/* We still have one more BoundingBox somewhere */

				sscanf (line, "%s",c); 

				if (!strncmp(c,"%%BoundingBox:", 14)) continue;

			}

			if (ps_GMT) {

				if (!strcmp(line,"% Init coordinate system and scales\n")) {

					fprintf (fpo, "<< /PageSize [ %d %d ] >> setpagedevice\n", w,h);

					fprintf (fpo, "gsave %d %d translate\n\n", -x0,-y0);

					fprintf (fpo, "%s", line);

				}

				else

					fprintf (fpo, "%s", line);

			}

			else {

				fprintf (fpo, "%s", line);

			}



		}



		fclose (fpo);

		fclose (fp);



		run_cmd(script_name, cmd, 0, no_rem);	/* Execute the script that converts the PS to raster */

		if (!no_rem)

			run_cmd(tmp_file, cmd, 1, 0);



		free ((void *)tmp_file);

		free ((void *)out_file);

	}



	free ((void *)ps_names);



	exit (EXIT_SUCCESS);

}



void run_cmd(char *name, char *cmd, int rem1, int rem2) {

	FILE *fp;



	if (rem1) {

#ifdef _WIN32

		sprintf (cmd, "del %s\n", name);

#else

		sprintf (cmd, "rm -f %s\n", name);

#endif

		system(cmd);

		return;

	}



	fp = fopen (name, "w");

#ifdef _WIN32

	fprintf (fp, "echo off\n");

#endif

	fprintf (fp, "%s\n", cmd);

	fclose (fp);



#ifdef _WIN32

	sprintf (cmd, "%s",name);

	system(cmd);

#else

	sprintf (cmd, "sh %s", name);

	system(cmd);

#endif

	if (!rem2) {

#ifdef _WIN32

		sprintf (cmd, "del %s\n", name);

#else

		sprintf (cmd, "rm -f %s\n", name);

#endif

		system(cmd);

	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丁香婷婷综合色啪| 色综合久久中文综合久久97| 午夜精品免费在线| 一区二区三区免费| 亚洲色图欧美偷拍| 亚洲男帅同性gay1069| 国产精品乱码人人做人人爱 | 亚洲欧美自拍偷拍色图| 国产日韩欧美综合一区| 久久精品人人做人人综合| 久久综合久久久久88| 久久综合av免费| 欧美激情综合在线| 中文字幕av一区 二区| 国产精品免费视频观看| 国产精品三级视频| 亚洲欧美韩国综合色| 亚洲精品日产精品乱码不卡| 亚洲中国最大av网站| 视频精品一区二区| 免费观看久久久4p| 国产精品一线二线三线| 成人国产一区二区三区精品| 99视频在线精品| 在线亚洲高清视频| 欧美精品v国产精品v日韩精品 | 中文在线免费一区三区高中清不卡| 国产日韩精品久久久| 一区二区中文视频| 亚洲嫩草精品久久| 美女www一区二区| 国产成人在线看| 91麻豆视频网站| 欧美精品精品一区| 国产欧美日韩视频一区二区| 综合av第一页| 日本一不卡视频| 国产成人精品免费在线| 色菇凉天天综合网| 91麻豆精品国产91久久久久久 | 亚洲在线视频一区| 精品一区二区在线视频| www.成人网.com| 国产精品久久久久久久久果冻传媒 | 欧美bbbbb| 成人一区二区三区视频在线观看| 色婷婷一区二区三区四区| 欧美日韩久久久久久| 2020国产精品| 一区二区三区四区在线| 另类小说综合欧美亚洲| 成人白浆超碰人人人人| 欧美一区二区三区视频免费| 国产女主播一区| 舔着乳尖日韩一区| 成人免费毛片片v| 69av一区二区三区| 亚洲天堂精品在线观看| 蜜桃av噜噜一区| 色婷婷综合激情| 久久久久久99久久久精品网站| 亚洲另类中文字| 国产一区二区成人久久免费影院 | 国产精品久久久久久久久免费丝袜 | 国产成人aaaa| 91精品国产高清一区二区三区 | 美女一区二区视频| 91蜜桃免费观看视频| 日韩不卡在线观看日韩不卡视频| 国产成人久久精品77777最新版本| 欧美日韩国产综合久久| 国产精品卡一卡二卡三| 狠狠色伊人亚洲综合成人| 在线亚洲免费视频| 国产精品国产三级国产普通话三级| 青草av.久久免费一区| 欧美影院午夜播放| 国产精品高清亚洲| 国产伦精品一区二区三区在线观看| 欧美无人高清视频在线观看| 日本一区二区动态图| 久久激情五月婷婷| 欧美福利视频导航| 一区二区三区免费在线观看| 成人av在线资源网站| 久久久久久久久一| 日韩极品在线观看| 精品视频在线视频| 亚洲另类在线制服丝袜| 99久久免费精品高清特色大片| 久久久久久麻豆| 黄色日韩网站视频| 欧美大片顶级少妇| 三级一区在线视频先锋| 欧美日韩dvd在线观看| 亚洲国产中文字幕| 在线欧美一区二区| 亚洲制服丝袜av| 欧美三级在线看| 亚洲国产va精品久久久不卡综合| 91丝袜国产在线播放| 国产精品人妖ts系列视频| 国产.欧美.日韩| 中文子幕无线码一区tr| 成人的网站免费观看| 亚洲欧洲国产日韩| 97se狠狠狠综合亚洲狠狠| 中文字幕一区二区在线观看| 成人a区在线观看| 国产精品久久久久精k8| 99麻豆久久久国产精品免费| 国产精品夫妻自拍| 色婷婷av久久久久久久| 一区二区三区免费网站| 欧美年轻男男videosbes| 日韩国产精品久久| 日韩一区二区在线看片| 国产精品一区不卡| 欧美国产97人人爽人人喊| 99久久精品国产毛片| 亚洲精品写真福利| 欧美猛男gaygay网站| 蜜臀久久99精品久久久画质超高清| 日韩免费视频一区二区| 国产精品亚洲专一区二区三区| 国产欧美综合在线观看第十页| 成人精品在线视频观看| 一区二区三区四区高清精品免费观看 | 日本一区二区三区免费乱视频| 成人激情动漫在线观看| 亚洲美腿欧美偷拍| 69堂成人精品免费视频| 国产精品99久| 亚洲精品国产一区二区精华液| 欧美日韩免费高清一区色橹橹 | 色婷婷综合久久久久中文一区二区 | eeuss鲁片一区二区三区在线观看| 亚洲视频小说图片| 欧美日韩国产影片| 国产一区二区成人久久免费影院 | 亚洲国产综合人成综合网站| 日韩免费一区二区| 成人黄色电影在线| 日韩精品成人一区二区三区| 久久久一区二区三区捆绑**| 97精品电影院| 另类小说综合欧美亚洲| 国产精品理论在线观看| 在线不卡免费av| 国产成人免费在线观看不卡| 亚洲国产精品一区二区久久恐怖片 | 99精品热视频| 午夜电影一区二区三区| 久久精品网站免费观看| 欧美亚洲另类激情小说| 国产在线精品一区在线观看麻豆| 亚洲人成网站色在线观看| 欧美mv日韩mv国产网站| 91免费在线视频观看| 蓝色福利精品导航| 亚洲精品乱码久久久久| 337p粉嫩大胆噜噜噜噜噜91av| 色偷偷88欧美精品久久久| 国产一区在线观看视频| 亚洲国产精品自拍| 国产精品久久夜| 日韩欧美亚洲国产另类| 在线亚洲欧美专区二区| 国产91精品免费| 久久福利视频一区二区| 亚洲最新视频在线播放| 国产三级欧美三级日产三级99| 欧美日韩国产色站一区二区三区| 从欧美一区二区三区| 美女尤物国产一区| 五月婷婷色综合| 亚洲精品伦理在线| 欧美激情综合五月色丁香小说| 日韩欧美国产高清| 欧美蜜桃一区二区三区| 色妞www精品视频| 国产91精品在线观看| 国产一区二区免费看| 日本欧美肥老太交大片| 亚洲国产视频a| 亚洲欧美国产77777| 中文字幕精品综合| 久久网站最新地址| 日韩免费在线观看| 91精品国产一区二区三区香蕉| 在线观看国产一区二区| heyzo一本久久综合| 国产激情91久久精品导航 | 日韩亚洲欧美在线| 5566中文字幕一区二区电影| 欧美午夜宅男影院| 色综合夜色一区| 一本大道久久a久久综合婷婷| 成人国产精品免费观看视频| 国产成a人亚洲精|