예제 #1
0
int main()
{
	int i;
	int error = 0;
	char path[1024];
	const char *srcdir;
	int n;

	sprintf(path, "%s/gdimageline/gdimageline_aa_a_0_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,0,1,10,100, 1);

	sprintf(path, "%s/gdimageline/gdimageline_aa_a_1_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,1,1,10,100, 2);

	sprintf(path, "%s/gdimageline/gdimageline_aa_b_0_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,2,-1,10,100, 1);
	sprintf(path, "%s/gdimageline/gdimageline_aa_b_1_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,1,-1,10,100, 2);

	sprintf(path, "%s/gdimageline/gdimageline_aa_c_0_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,0,1,100,10, 1);
	sprintf(path, "%s/gdimageline/gdimageline_aa_c_1_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,1,1,100,10, 2);

	sprintf(path, "%s/gdimageline/gdimageline_aa_d_0_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,2,-1,100,10, 1);
	sprintf(path, "%s/gdimageline/gdimageline_aa_d_1_exp.png", GDTEST_TOP_DIR);
	error |= gen_image(path,1,-1,100,10, 2);

   return error;
}
예제 #2
0
/* set up the application parameters - read in from command line*/
static int init( int argc, char *argv[] )
{
    ARParam  wparam;

    /* open the video path */
    printf("Image size (x,y) = (%d,%d)\n", xsize, ysize);

    /* set the initial camera parameters */
    if( arParamLoad(CPARA, 1, &wparam) < 0 ) {
       printf("Camera parameter load error !!\n");
        exit(0);
    }
    arParamChangeSize( &wparam, xsize, ysize, &cparam );

    arInitCparam( &cparam );
    printf("*** Camera Parameter ***\n");
    arParamDisp( &cparam );

    /* open the graphics window */
    argInit( &cparam, 1.0, 0, 2, 1, 0 );


    arFittingMode   = AR_FITTING_TO_IDEAL;
    arImageProcMode = AR_IMAGE_PROC_IN_HALF;
    argDrawMode     = AR_DRAW_BY_TEXTURE_MAPPING;
    argTexmapMode   = AR_DRAW_TEXTURE_FULL_IMAGE;
    gen_image( imgMode );

    dispMode();

    return 0;
}
예제 #3
0
int main(int argc, char **argv)
{
    int w, h, i;
    char buf[1024];

    if (argc != 3) {
        printf("usage: %s directory/ image.pnm\n"
               "generate a test video stream\n", argv[0]);
        return 1;
    }

    w = DEFAULT_WIDTH;
    h = DEFAULT_HEIGHT;

    rgb_tab = malloc(w * h * 3);
    wrap    = w * 3;
    width   = w;
    height  = h;

    if (init_demo(argv[2]))
        return 1;

    for (i = 0; i < DEFAULT_NB_PICT; i++) {
        snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
        gen_image(i, w, h);
        pgmyuv_save(buf, w, h, rgb_tab);
    }

    free(rgb_tab);
    return 0;
}
예제 #4
0
/**
 * print directory name.
 *
 *	@param[in]	level	0,1,2...
 *	@param[in]	path	path of the directory
 *	@param[in]	count	number of files in this directory
 */
static const char *
print_directory_name(int level, const char *path, int count)
{
	STATIC_STRBUF(sb);
	char tips[80];

	if (count > 1)
		snprintf(tips, sizeof(tips), "%d files", count);
	else
		snprintf(tips, sizeof(tips), "%d file", count);
	path = removedotslash(path);
	strbuf_clear(sb);
	if (table_flist)
		strbuf_puts(sb, fitem_begin);
	else if (!no_order_list)
		strbuf_puts(sb, item_begin);
	strbuf_puts(sb, gen_href_begin_with_title(level == 0 ? "files" : NULL,
			path2fid(path), HTML, NULL, tips));
	if (Iflag) {
		strbuf_puts(sb, gen_image(level == 0 ? CURRENT : PARENT, dir_icon, appendslash(path)));
		strbuf_puts(sb, quote_space);
	}
	strbuf_sprintf(sb, "%s/%s", lastpart(path), gen_href_end());
	if (table_flist)
		strbuf_puts(sb, fitem_end);
	else if (!no_order_list)
		strbuf_puts(sb, item_end);
	else
		strbuf_puts(sb, br);
	strbuf_putc(sb, '\n');
	return (const char *)strbuf_value(sb);
}
예제 #5
0
파일: test.c 프로젝트: banketree/faplayer
int main(int argc, char *argv[])
{
    const int frame_w = 640;
    const int frame_h = 480;

    if (argc < 4) {
        printf("usage: %s <image file> <subtitle file> <time>\n", argv[0]);
        exit(1);
    }
    char *imgfile = argv[1];
    char *subfile = argv[2];
    double tm = strtod(argv[3], 0);

    init(frame_w, frame_h);
    ASS_Track *track = ass_read_file(ass_library, subfile, NULL);
    if (!track) {
        printf("track init failed!\n");
        return 1;
    }

    ASS_Image *img =
        ass_render_frame(ass_renderer, track, (int) (tm * 1000), NULL);
    image_t *frame = gen_image(frame_w, frame_h);
    blend(frame, img);

    ass_free_track(track);
    ass_renderer_done(ass_renderer);
    ass_library_done(ass_library);

    write_png(imgfile, frame);

    return 0;
}
예제 #6
0
/**
 * print directory footer.
 *
 *	@param[in]	op	file index
 *	@param[in]	level	1,2...
 *	@param[in]	dir	directory name
 */
static void
print_directory_footer(FILE *op, int level, const char *dir)
{
	const char *parent, *suffix;
	char parentdir[MAXPATHLEN];
	const char *top = (Fflag && !tree_view) ? "../files" : "../mains";

	if (level == 0)
		die("print_directory_footer: internal error.");
	(void)dirpart(dir, parentdir);
	if (level == 1) {
		parent = top;
		suffix = normal_suffix;
	} else {
		parent = path2fid(parentdir);
		suffix = HTML;
	}
	if (table_flist)
		fputs_nl(flist_end, op);
	else if (!no_order_list)
		fputs_nl(list_end, op);
	else
		fputs_nl(br, op);
	fputs(gen_href_begin_with_title(NULL, parent, suffix, NULL, "Parent Directory"), op);
	if (Iflag)
		fputs(gen_image(PARENT, back_icon, ".."), op);
	else
		fputs("[..]", op);
	fputs_nl(gen_href_end(), op);
	fputs_nl(body_end, op);
	fputs_nl(gen_page_end(), op);
}
예제 #7
0
/**
 * print file name.
 *
 *	@param[in]	level	0,1,2...
 *	@param[in]	path	path of the file
 */
static const char *
print_file_name(int level, const char *path)
{
	STATIC_STRBUF(sb);
	char *target = (Fflag) ? "mains" : "_top";
	int size = filesize(path);
	char tips[80];

	message(" [%d] adding %s", ++src_count, removedotslash(path));
	/*
	 * We assume the file which has one of the following suffixes
	 * as a candidate of include file.
	 *
	 * C: .h
	 * C++: .hxx, .hpp, .H, .hh
	 * PHP: .inc.php
	 */
	if (regexec(&is_include_file, path, 0, 0, 0) == 0)
		put_inc(lastpart(path), path, src_count);
	strbuf_clear(sb);
	if (table_flist)
		strbuf_puts(sb, fitem_begin);
	else if (!no_order_list)
		strbuf_puts(sb, item_begin);
	if (size > 1)
		snprintf(tips, sizeof(tips), "%s bytes", insert_comma(size));
	else
		snprintf(tips, sizeof(tips), "%s byte", insert_comma(size));
	strbuf_puts(sb, gen_href_begin_with_title_target(level == 0 ? SRCS: upperdir(SRCS),
			path2fid(path), HTML, NULL, tips, target));
	if (Iflag) {
		const char *lang, *suffix, *text_icon;

		if ((suffix = locatestring(path, ".", MATCH_LAST)) != NULL
		    && (lang = decide_lang(suffix)) != NULL
		    && (strcmp(lang, "c") == 0 || strcmp(lang, "cpp") == 0
		       || strcmp(lang, "yacc") == 0))
			text_icon = c_icon;
		else
			text_icon = file_icon;
		strbuf_puts(sb, gen_image(level == 0 ? CURRENT : PARENT, text_icon, removedotslash(path)));
		strbuf_puts(sb, quote_space);
	}
	strbuf_puts(sb, full_path ? removedotslash(path) : lastpart(path));
	strbuf_puts(sb, gen_href_end());
	if (table_flist)
		strbuf_puts(sb, fitem_end);
	else if (!no_order_list)
		strbuf_puts(sb, item_end);
	else
		strbuf_puts(sb, br);
	strbuf_putc(sb, '\n');
	return (const char *)strbuf_value(sb);
}
예제 #8
0
static void   keyEvent( unsigned char key, int x, int y)
{
    if( key == ' ' ) {
        imgMode = (imgMode+1)%3;
        gen_image( imgMode );
    }

    /* quit if the ESC key is pressed */
    if( key == 0x1b ) {
        printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
        /* print out frame/sec and shut everything down */
        cleanup();
        exit(0);
    }

    /* turn on and off the debug mode with right mouse */
    if( key == 'd' ) {
        printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
        arDebug = 1 - arDebug;
        if( arDebug == 0 ) {
            glClearColor( 0.0, 0.0, 0.0, 0.0 );
            glClear(GL_COLOR_BUFFER_BIT);
            argSwapBuffers();
            glClear(GL_COLOR_BUFFER_BIT);
            argSwapBuffers();
        }
        count = 0;
        dispMode();
    }

    if( key == 'c' ) {
        if( argDrawMode == AR_DRAW_BY_GL_DRAW_PIXELS ) {
            argDrawMode  = AR_DRAW_BY_TEXTURE_MAPPING;
            argTexmapMode = AR_DRAW_TEXTURE_FULL_IMAGE;
		}
		else if( argTexmapMode == AR_DRAW_TEXTURE_FULL_IMAGE ) {
            argTexmapMode = AR_DRAW_TEXTURE_HALF_IMAGE;
		}
		else {
            argDrawMode  = AR_DRAW_BY_GL_DRAW_PIXELS;
		}
        printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
        count = 0;
        dispMode();
    }
}
예제 #9
0
int main()
{
	int i;
	int error = 0;

	error |= gen_image("gdimageline_aa_a_0_exp.png",0,1,10,100, 1);
	error |= gen_image("gdimageline_aa_a_1_exp.png",1,1,10,100, 2);

	error |= gen_image("gdimageline_aa_b_0_exp.png",2,-1,10,100, 1);
	error |= gen_image("gdimageline_aa_b_1_exp.png",1,-1,10,100, 2);


	error |= gen_image("gdimageline_aa_c_0_exp.png",0,1,100,10, 1);
	error |= gen_image("gdimageline_aa_c_1_exp.png",1,1,100,10, 2);

	error |= gen_image("gdimageline_aa_d_0_exp.png",2,-1,100,10, 1);
	error |= gen_image("gdimageline_aa_d_1_exp.png",1,-1,100,10, 2);

   return error;
}
예제 #10
0
파일: tcltk.c 프로젝트: ricbit/Oldies
void expose_handler (ClientData cd, XEvent *ev) {
    Display *display;
    Window window;
    Visual *visual;
    GC gc;
    int screen;
    int depth;
    Tk_Window tkwin;

    tkwin=(Tk_Window) cd;
    display=Tk_Display (tkwin);
    window=Tk_WindowId (tkwin);
    gc=Tk_GetGC (tkwin,0,NULL);
    visual=Tk_Visual (tkwin);
    if (ximage==NULL) {
        screen=DefaultScreen (display);
        depth=DisplayPlanes (display,screen);
        image_data=(char *) malloc (RESX*RESY);
        ximage=XCreateImage
               (display,visual,depth,ZPixmap,0,image_data,RESX,RESY,8,0);
        gen_image ();
    }
}
예제 #11
0
파일: defineindex.c 프로젝트: GimXu/global
/*
 * makedefineindex: make definition index (including alphabetic index)
 *
 *	@param[in]	file		definition index file
 *	@param[in]	total		definitions total
 *	@param[out]	defines		@defines
 *	Globals used (input):
 *		tag cache	  XXX: should this be global output, not input?
 */
int
makedefineindex(const char *file, int total, STRBUF *defines)
{
	int count = 0;
	int alpha_count = 0;
	FILEOP *fileop_MAP = NULL, *fileop_DEFINES, *fileop_ALPHA = NULL;
	FILE *MAP = NULL;
	FILE *DEFINES, *STDOUT, *TAGS, *ALPHA = NULL;
	STRBUF *sb = strbuf_open(0);
	STRBUF *url = strbuf_open(0);
	/* Index link */
	const char *target = (Fflag) ? "mains" : "_top";
	const char *indexlink;
	const char *index_string = "Index Page";
	char command[1024], buf[1024], alpha[32], alpha_f[32], *_;

	if (!aflag && !Fflag)
		indexlink = "mains";
	else if (Fflag)
		indexlink = "../defines";
	else
		indexlink = "../mains";

	if (map_file) {
		fileop_MAP = open_output_file(makepath(distpath, "MAP", NULL), 0);
		MAP = get_descripter(fileop_MAP);
	}
	fileop_DEFINES = open_output_file(makepath(distpath, file, NULL), 0);
	DEFINES = get_descripter(fileop_DEFINES);
	fputs_nl(gen_page_begin(title_define_index, TOPDIR), DEFINES);
	fputs_nl(body_begin, DEFINES);
	fputs(header_begin, DEFINES);
	if (Fflag)
		fputs(gen_href_begin(NULL, "defines", normal_suffix, NULL), DEFINES);
	fputs(title_define_index, DEFINES);
	if (Fflag)
		fputs(gen_href_end(), DEFINES);
	fputs_nl(header_end, DEFINES);
	if (!aflag && !Fflag) {
		fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), DEFINES);
		if (Iflag)
			fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);
		else
			fputs("[..]", DEFINES);
		fputs_nl(gen_href_end(), DEFINES);
	}
	if (!aflag) {
		if (!no_order_list)
			fputs_nl(list_begin, DEFINES);
	}
	/*
	 * map DEFINES to STDOUT.
	 */
	STDOUT = DEFINES;
	snprintf(command, sizeof(command), PQUOTE "%s -c" PQUOTE, quote_shell(global_path));
	if ((TAGS = popen(command, "r")) == NULL)
		die("cannot execute '%s'.", command);
	alpha[0] = '\0';
	while ((_ = strbuf_fgets(sb, TAGS, STRBUF_NOCRLF)) != NULL) {
		const char *tag, *line;
		char guide[1024], url_for_map[1024];

		count++;
		tag = _;
		message(" [%d/%d] adding %s", count, total, tag);
		if (aflag && (alpha[0] == '\0' || !locatestring(tag, alpha, MATCH_AT_FIRST))) {
			const char *msg = (alpha_count == 1) ? "definition" : "definitions";
			int c;

			if (alpha[0]) {
				char tmp[128];
				snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg);
				strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp));
				strbuf_sprintf(defines, "[%s]", alpha);
				strbuf_puts_nl(defines, gen_href_end());
				alpha_count = 0;
				if (!no_order_list)
					fputs_nl(list_end, ALPHA);
				else
					fputs_nl(br, ALPHA);
				fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
				if (Iflag)
					fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
				else
					fputs("[..]", ALPHA);
				fputs_nl(gen_href_end(), ALPHA);
				fputs_nl(body_end, ALPHA);
				fputs_nl(gen_page_end(), ALPHA);
				close_file(fileop_ALPHA);
				html_count++;
			}
			/*
			 * setup index char (for example, 'a' of '[a]').
			 * alpha is used for display.
			 * alpha_f is used for part of path.
			 */
			c = (unsigned char)*tag;
			if (c > 127) {
				int i2 = *(tag + 1) & 0xff;
				/*
				 * for multi-byte(EUC) code.
				 */
				alpha[0] = *tag;
				alpha[1] = *(tag + 1);
				alpha[2] = '\0';
				snprintf(alpha_f, sizeof(alpha_f), "%03d%03d", c, i2);
			} else if (isalpha(c) || c == '_') {
				alpha[0] = *tag;
				alpha[1] = '\0';
				/*
				 * for CD9660 or FAT file system
				 */
				if (islower(c)) {
					alpha_f[0] = 'l';
					alpha_f[1] = *tag;
					alpha_f[2] = '\0';
				} else {
					alpha_f[0] = *tag;
					alpha_f[1] = '\0';
				}
			} else {
				alpha[0] = *tag;
				alpha[1] = '\0';
				snprintf(alpha_f, sizeof(alpha_f), "%03d", c);
			}
			snprintf(buf, sizeof(buf), "%s/defines/%s.%s", distpath, alpha_f, HTML);
			fileop_ALPHA = open_output_file(buf, 0);
			ALPHA = get_descripter(fileop_ALPHA);
			snprintf(buf, sizeof(buf), "[%s]", alpha);
			fputs_nl(gen_page_begin(buf, SUBDIR), ALPHA);
			fputs_nl(body_begin, ALPHA);
			fprintf(ALPHA, "%s[%s]%s\n", header_begin, alpha, header_end);
			fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
			if (Iflag)
				fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
			else
				fputs("[..]", ALPHA);
			fputs_nl(gen_href_end(), ALPHA);
			if (!no_order_list)
				fputs_nl(list_begin, ALPHA);
			else
				fprintf(ALPHA, "%s%s\n", br, br);
			STDOUT = ALPHA;
		}
		alpha_count++;
		/*
		 * generating url for function definition.
	 	 */
		line = cache_get(GTAGS, tag);
		strbuf_reset(url);

		if (line == NULL)
			die("internal error in makedefineindex()."); 
		/*
		 * About the format of 'line', please see the head comment of cache.c.
		 */
		if (*line == ' ') {
			const char *fid = line + 1;
			const char *enumber = nextstring(fid);

			snprintf(url_for_map, sizeof(url_for_map), "%s/%s.%s",
				DEFS, fid, HTML);
			if (dynamic) {
				if (*action != '/' && aflag)
					strbuf_puts(url, "../");
				strbuf_puts(url, action);
				strbuf_sprintf(url, "?pattern=%s%stype=definitions", tag, quote_amp);
			} else {
				if (aflag)
					strbuf_puts(url, "../");
				strbuf_sprintf(url, "%s/%s.%s", DEFS, fid, HTML);
			}
			snprintf(guide, sizeof(guide), "Multiple defined in %s places.", enumber);
		} else {
			const char *lno = line;
			const char *fid = nextstring(line);
			const char *path = gpath_fid2path(fid, NULL);

			path += 2;		/* remove './' */
			snprintf(url_for_map, sizeof(url_for_map), "%s/%s.%s#L%s",
				SRCS, fid, HTML, lno);
			if (aflag)
				strbuf_puts(url, "../");
			strbuf_sprintf(url, "%s/%s.%s#L%s", SRCS, fid, HTML, lno);
			snprintf(guide, sizeof(guide), "Defined at %s in %s.", lno, path);
		}
		if (!no_order_list)
			fputs(item_begin, STDOUT);
		fputs(gen_href_begin_with_title_target(NULL, strbuf_value(url), NULL, NULL, guide, target), STDOUT);
		fputs(tag, STDOUT);
		fputs(gen_href_end(), STDOUT);
		if (!no_order_list)
			fputs(item_end, STDOUT);
		else
			fputs(br, STDOUT);
		fputc('\n', STDOUT);
		if (map_file)
			fprintf(MAP, "%s\t%s\n", tag, url_for_map);
	}
	if (pclose(TAGS) != 0)
		die("terminated abnormally '%s' (errno = %d).", command, errno);
	if (aflag && alpha[0]) {
		char tmp[128];
		const char *msg = (alpha_count == 1) ? "definition" : "definitions";

		snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg);
		strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp));
		strbuf_sprintf(defines, "[%s]", alpha);
		strbuf_puts_nl(defines, gen_href_end());
		if (!no_order_list)
			fputs_nl(list_end, ALPHA);
		else
			fputs_nl(br, ALPHA);
		fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
		if (Iflag)
			fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
		else
			fputs("[..]", ALPHA);
		fputs_nl(gen_href_end(), ALPHA);
		fputs_nl(body_end, ALPHA);
		fputs_nl(gen_page_end(), ALPHA);
		close_file(fileop_ALPHA);
		html_count++;

		fputs(strbuf_value(defines), DEFINES);
	}
	if (!no_order_list && !aflag)
		fputs_nl(list_end, DEFINES);
	if (!aflag && !Fflag) {
		fputs(gen_href_begin_with_title(NULL, "mains", normal_suffix, NULL, index_string), DEFINES);
		if (Iflag)
			fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);
		else
			fputs("[..]", DEFINES);
		fputs_nl(gen_href_end(), DEFINES);
	}
	fputs_nl(body_end, DEFINES);
	fputs_nl(gen_page_end(), DEFINES);
	close_file(fileop_DEFINES);
	html_count++;
	if (map_file)
		close_file(fileop_MAP);
	strbuf_close(sb);
	strbuf_close(url);
	return count;
}
예제 #12
0
/**
 * makecommonpart: make a common part for "mains.html" and "index.html"
 *
 *	@param[in]	title
 *	@param[in]	defines
 *	@param[in]	files
 *	@return	index	common part
 */
static char *
makecommonpart(const char *title, const char *defines, const char *files)
{
	FILE *ip;
	STRBUF *sb = strbuf_open(0);
	STRBUF *ib = strbuf_open(0);
	char buf[MAXFILLEN];
	const char *tips = "Go to the GLOBAL project page.";
	const char *_, *item;

	strbuf_puts(sb, title_begin);
	strbuf_puts(sb, title);
	strbuf_puts_nl(sb, title_end);
	strbuf_puts_nl(sb, poweredby_begin);
	strbuf_sprintf(sb, "Last updated %s%s\n", now(), br);
	if (Iflag) {
		snprintf(buf, sizeof(buf), "Powered by GLOBAL-%s.", get_version());
		strbuf_puts(sb, gen_href_begin_with_title_target(NULL, www, NULL, NULL, tips,"_top"));
		strbuf_puts(sb, gen_image(CURRENT, "pglobe", buf));
		strbuf_puts(sb, gen_href_end());
		strbuf_puts(sb, br);
	} else {
		strbuf_sprintf(sb, "Powered by %sGLOBAL-%s%s.%s\n",
			gen_href_begin_with_title_target(NULL, www, NULL, NULL, tips, "_top"),
			get_version(),
			gen_href_end(),
			br);
	}
	strbuf_puts_nl(sb, poweredby_end);
	strbuf_puts_nl(sb, hr);
	/*
	 * Print items according to the value of variable 'item_order'.
	 */
	for (item = item_order; *item; item++) {
		switch (*item) {
		case 'c':
			if (caution) {
				strbuf_puts_nl(sb, caution_begin);
				strbuf_sprintf(sb, "<font size='+2' color='red'>CAUTION</font>%s\n", br);
				strbuf_sprintf(sb, "This hypertext consists of %d files.\n", html_count);
				strbuf_puts_nl(sb, "Please don't download the whole hypertext using a hypertext copy tool.");
				strbuf_puts_nl(sb, "Our network cannot afford such traffic.");
				strbuf_puts_nl(sb, "Instead, you can generate the same thing in your computer using");
				strbuf_puts(sb, gen_href_begin_with_title_target(NULL, www, NULL, NULL, NULL, "_top"));
				strbuf_puts(sb, "GLOBAL source code tag system");
				strbuf_puts_nl(sb, gen_href_end());
				strbuf_puts_nl(sb, "Thank you.");
				strbuf_puts_nl(sb, caution_end);
				strbuf_sprintf(sb, "\n%s\n", hr);
			}
			break;
		case 's':
			if (fflag) {
				strbuf_puts(sb, makesearchpart(NULL));
				strbuf_puts_nl(sb, hr);
			}
			break;
		case 't':
			if (call_file || callee_file) {
				strbuf_puts(sb, header_begin);
				if (call_file) {
					strbuf_puts(sb, gen_href_begin(NULL, "call", normal_suffix, NULL));
					strbuf_puts(sb, title_call_tree);
					strbuf_puts(sb, gen_href_end());
				}
				if (call_file && callee_file)
					strbuf_puts(sb, " / ");
				if (callee_file) {
					strbuf_puts(sb, gen_href_begin(NULL, "callee", normal_suffix, NULL));
					strbuf_puts(sb, title_callee_tree);
					strbuf_puts(sb, gen_href_end());
				}
				strbuf_puts_nl(sb, header_end);
				strbuf_puts_nl(sb, hr);
			}
			break;
		case 'm':
			strbuf_sprintf(sb, "%sMAINS%s\n", header_begin, header_end);

			snprintf(buf, sizeof(buf), PQUOTE "%s --result=ctags-xid --encode-path=\" \t\" --nofilter=path %s" PQUOTE, quote_shell(global_path), main_func);
			ip = popen(buf, "r");
			if (!ip)
				die("cannot execute '%s'.", buf);
			strbuf_puts_nl(sb, gen_list_begin());
			while ((_ = strbuf_fgets(ib, ip, STRBUF_NOCRLF)) != NULL) {
				char fid[MAXFIDLEN];
				const char *ctags_x = parse_xid(_, fid, NULL);

				strbuf_puts_nl(sb, gen_list_body(SRCS, ctags_x, fid));
			}
			strbuf_puts_nl(sb, gen_list_end());
			if (pclose(ip) != 0)
				die("terminated abnormally '%s' (errno = %d).", buf, errno);
			strbuf_puts_nl(sb, hr);
			break;
		case 'd':
			if (aflag && !Fflag) {
				strbuf_puts(sb, header_begin);
				strbuf_puts(sb, title_define_index);
				strbuf_puts_nl(sb, header_end);
				strbuf_puts(sb, defines);
			} else {
				strbuf_puts(sb, header_begin);
				strbuf_puts(sb, gen_href_begin(NULL, "defines", normal_suffix, NULL));
				strbuf_puts(sb, title_define_index);
				strbuf_puts(sb, gen_href_end());
				strbuf_puts_nl(sb, header_end);
			}
			strbuf_puts_nl(sb, hr);
			break;
		case 'f':
			if (Fflag) {
				strbuf_puts(sb, header_begin);
				strbuf_puts(sb, gen_href_begin(NULL, "files", normal_suffix, NULL));
				strbuf_puts(sb, title_file_index);
				strbuf_puts(sb, gen_href_end());
				strbuf_puts_nl(sb, header_end);
			} else {
				strbuf_puts(sb, header_begin);
				strbuf_puts(sb, title_file_index);
				strbuf_puts_nl(sb, header_end);
				if (tree_view) {
					strbuf_puts_nl(sb, tree_control);
					strbuf_puts_nl(sb, tree_loading);
					if (tree_view_type) {
						strbuf_sprintf(sb, tree_begin_using, tree_view_type);
						strbuf_putc(sb, '\n');
					} else {
						strbuf_puts_nl(sb, tree_begin);
					}
				} else if (table_flist)
					strbuf_puts_nl(sb, flist_begin);
				else if (!no_order_list)
					strbuf_puts_nl(sb, list_begin);
				strbuf_puts(sb, files);
				if (tree_view)
					strbuf_puts_nl(sb, tree_end);
				else if (table_flist)
					strbuf_puts_nl(sb, flist_end);
				else if (!no_order_list)
					strbuf_puts_nl(sb, list_end);
				else
					strbuf_puts_nl(sb, br);
			}
			strbuf_puts_nl(sb, hr);
			break;
		default:
			warning("unknown item '%c'. (Ignored)", *item);
			break;
		}
	}
	strbuf_close(ib);

	return strbuf_value(sb);
	/* doesn't close string buffer */
}
예제 #13
0
/**
 * makehelp: make help file
 */
static void
makehelp(const char *file)
{
	const char **label = Iflag ? anchor_comment : anchor_label;
	const char **icons = anchor_icons;
	const char **msg   = anchor_msg;
	int n, last = 7;
	FILE *op;

	op = fopen(makepath(distpath, file, NULL), "w");
	if (!op)
		die("cannot make help file.");
	fputs_nl(gen_page_begin("HELP", TOPDIR), op);
	fputs_nl(body_begin, op);
	fputs(header_begin, op);
	fputs("Usage of Links", op);
	fputs_nl(header_end, op);
	if (!Iflag)
		fputs(verbatim_begin, op);
	fputs("/* ", op);
	for (n = 0; n <= last; n++) {
		if (Iflag) {
			fputs(gen_image(CURRENT, icons[n], label[n]), op);
			if (n < last)
				fputc(' ', op);
		} else {
			fprintf(op, "[%s]", label[n]);
		}
	}
	if (show_position)
		fprintf(op, "[+line file]");
	fputs(" */", op);
	if (!Iflag)
		fputs_nl(verbatim_end, op);
	else
		fputc('\n', op);
	fputs_nl(define_list_begin, op);
	for (n = 0; n <= last; n++) {
		fputs(define_term_begin, op);
		if (Iflag) {
			fputs(gen_image(CURRENT, icons[n], label[n]), op);
		} else {
			fprintf(op, "[%s]", label[n]);
		}
		fputs(define_term_end, op);
		fputs(define_desc_begin, op);
		fputs(msg[n], op);
		fputs_nl(define_desc_end, op);
	}
	if (show_position) {
		fputs(define_term_begin, op);
		fputs("[+line file]", op);
		fputs(define_term_end, op);
		fputs(define_desc_begin, op);
		fputs("Current position (line number and file name).", op);
		fputs_nl(define_desc_end, op);
	}
	fputs_nl(define_list_end, op);
	fputs_nl(body_end, op);
	fputs_nl(gen_page_end(), op);
	fclose(op);
	html_count++;
}
예제 #14
0
int main(int argc, char *argv[])
{
	POINT mouse;
	//while (true)
	{
		GetCursorPos(&mouse);
		printf("\r%d-%d         ", mouse.x, mouse.y);
	}
	

	return interlace_RGB();
	return matrix();

//	char URI[] = "//mnt/sdcard/%E9%98%BF%E4%B8%BD%E4%BA%9A%E5%A8%9C%E5%90%89%E5%88%A9%E6%96%AF-%20Shake%E8%8B%B9%E6%9E%9C.3dv";
	char URI[] = "//mnt/sdcard/HELLO!.3dv";
	char decoded_URI[1024];

	URIDecode(URI, decoded_URI, sizeof(decoded_URI));

	char k = 0xef;

	bool a = k == 0xef;


    const int frame_w = 1920;
    const int frame_h = 1080;

	setlocale(LC_ALL, "CHS");

    if (argc < 4) {
        printf("usage: %s <image file> <subtitle file> <time>\n", argv[0]);
        exit(1);
    }

    char *imgfile = argv[1];
    char *subfile = argv[2];
    double tm = strtod(argv[3], 0);

	FILE * f = fopen(subfile, "rb");
	fseek(f, 0, SEEK_END);
	int file_size = ftell(f);
	fseek(f, 0, SEEK_SET);
	char *src = (char*)malloc(file_size);
	char *utf8 = (char*)malloc(file_size*3);
	fread(src, 1, file_size, f);
	fclose(f);

	int utf8_size = ConvertToUTF8(src, file_size, utf8, file_size*3);

	ass_library = ass_library_init();
	if (!ass_library) {
		printf("ass_library_init failed!\n");
		exit(1);
		}

	//ass_set_message_cb(ass_library, msg_callback, NULL);

	//ass_set_extract_fonts(ass_library, 0);
	//ass_set_style_overrides(ass_library, NULL);


	ass_renderer = ass_renderer_init(ass_library);
	if (!ass_renderer) {
		printf("ass_renderer_init failed!\n");
		exit(1);
		}


	ass_set_frame_size(ass_renderer, frame_w, frame_h);
	ass_set_font_scale(ass_renderer, 1.0);
	//ass_set_hinting(ass_renderer, ASS_HINTING_NORMAL);
	ass_set_fonts(ass_renderer, "Arial", "Sans", 1, "Z:\\fonts.conf", 1);
	
	ASS_Track *track = ass_read_memory(ass_library, utf8, utf8_size, NULL);

	free(src);
	free(utf8);

    if (!track) {
        printf("track init failed!\n");
        return 1;
    }

    ASS_Image *img = NULL;
	int n = 0;
	int changed = 0;
	image_t *frame = gen_image(frame_w, frame_h);
	int n2 = 0;
	int l = GetTickCount();
	timeBeginPeriod(1);
	for(int i=0; i<int(tm*1000); i+=40)
	{
		img = ass_render_frame(ass_renderer, track, i, &changed);

		if (n==0) l = GetTickCount();
		if (changed && img)
		{
			int l = timeGetTime();
			n++;
			memset(frame->buffer, 63, frame->stride * frame->height);
			blend(frame, img);
			wchar_t pathname[MAX_PATH];
			wsprintfW(pathname, L"Z:\\ass%02d.bmp", n);
			save_bitmap((DWORD*)frame->buffer, pathname, frame_w, frame_h);

			//printf("\rrender cost %dms.\t\t\n", timeGetTime()-l);
		}

		n2 ++;

		if (i%10000 == 0)
		printf("\r%d/%d ms rendered, %d frame output.", i, int(tm*1000), n);
	}

    ass_free_track(track);
    ass_renderer_done(ass_renderer);
    ass_library_done(ass_library);


    free(frame->buffer);
    free(frame);

    return 0;
}
예제 #15
0
/**
 * print directory header.
 *
 *	@param[in]	op	file index
 *	@param[in]	level	1,2...
 *	@param[in]	dir	directory name
 */
static void
print_directory_header(FILE *op, int level, const char *dir)
{
	STATIC_STRBUF(sb);
	const char *top = (Fflag && !tree_view) ? "../files" : "../mains";

	if (level == 0)
		die("print_directory_header: internal error.");
	strbuf_clear(sb);
	strbuf_puts(sb, removedotslash(dir));
	strbuf_putc(sb, '/');
	fputs_nl(gen_page_begin(strbuf_value(sb), SUBDIR), op);
	fputs_nl(body_begin, op);

	strbuf_clear(sb);
 	strbuf_sprintf(sb, "%s%sroot%s/", header_begin, gen_href_begin(NULL, top, normal_suffix, NULL), gen_href_end());
	fputs(strbuf_value(sb), op);
	{
		char path[MAXPATHLEN];
		char *p, *q;

		strlimcpy(path, dir, sizeof(path));
		for (p = path + 1; p != NULL; p = strchr(p, '/')) {
			int save = 0;

			q = ++p;
			while (*q && *q != '/')
				q++;
			save = *q;
			if (*q == '/')
				*q = '\0';
			if (save == '/')
				fputs(gen_href_begin(NULL, path2fid(path), HTML, NULL), op);
			fputs(p, op);
			if (save == '/')
				fputs(gen_href_end(), op);
			*q = save;
			fputc('/', op);
		}
	}
	fputs_nl(header_end, op);
	{
		char parentdir[MAXPATHLEN];
		const char *suffix, *parent;

		(void)dirpart(dir, parentdir);
		if (level == 1) {
			parent = top;
			suffix = normal_suffix;
		} else {
			parent = path2fid(parentdir);
			suffix = HTML;
		}
		fputs(gen_href_begin_with_title(NULL, parent, suffix, NULL, "Parent Directory"), op);
	}
	if (Iflag)
		fputs(gen_image(PARENT, back_icon, ".."), op);
	else
		fputs("[..]", op);
	fputs_nl(gen_href_end(), op);
	if (table_flist)
		fputs_nl(flist_begin, op);
	else if (!no_order_list)
		fputs_nl(list_begin, op);
	else {
		fputs(br, op);
		fputs_nl(br, op);
	}
}