int page_pgm(FILE *fout, potrace_path_t *plist, imginfo_t *imginfo) { potrace_path_t *p; greymap_t *gm; render_t *rm; int w, h; trans_t t; int mode; char *comment = "created by "POTRACE" "VERSION", written by Peter Selinger 2001-2015"; t.bb[0] = imginfo->trans.bb[0]+imginfo->lmar+imginfo->rmar; t.bb[1] = imginfo->trans.bb[1]+imginfo->tmar+imginfo->bmar; t.orig[0] = imginfo->trans.orig[0]+imginfo->lmar; t.orig[1] = imginfo->trans.orig[1]+imginfo->bmar; t.x[0] = imginfo->trans.x[0]; t.x[1] = imginfo->trans.x[1]; t.y[0] = imginfo->trans.y[0]; t.y[1] = imginfo->trans.y[1]; w = (int)ceil(t.bb[0]); h = (int)ceil(t.bb[1]); gm = gm_new(w, h); if (!gm) { return 1; } rm = render_new(gm); if (!rm) { return 1; } gm_clear(gm, 255); /* white */ list_forall(p, plist) { pgm_path(&p->curve, t, rm); }
void seal_init_graphics() { // baisc graphic modules GAME->texture_cache = texture_cache_new(); GAME->sprite_frame_cache = sprite_frame_cache_new(); GAME->bmfont_cache = bmfont_cache_new(); GAME->global_camera = camera_new(GAME->config.window_height, GAME->config.window_height); GAME->render = render_new(); GAME->nuk_node = nuk_node_new(); GAME->lua_handler = lua_handler_new(GAME->lstate); sprite_init_render(GAME->render); nuk_node_ctx_init(); // init the font ttf_init_module(); font = ttf_font_new("res/fonts/SourceCodePro-Regular.ttf", 32); //TODO: load this in Lua. GAME->font = font; // the bootloader seal_load_file("scripts/bootloader.lua"); seal_load_string("main()"); }