bool scrolltext_extract (void) { Uint32 i; const char *model = EXPORT_DIR "/scrolltext/char-xx.png"; char *filename = memory_allocation (strlen (model) + 1); if (filename == NULL) { LOG_ERR ("not enough memory to allocate %i bytes\n", (Uint32) (strlen (model) + 1)); return FALSE; } if (!create_dir (EXPORT_DIR "/scrolltext")) { free_memory (filename); return FALSE; } for (i = 0; i < FONT_SCROLLTEXT_MAXOF_GLYPHS; i++) { sprintf (filename, EXPORT_DIR "/scrolltext/char-%02d.png", i); if (!bitmap_to_png (&fnt_scroll[i], filename, 20, 21, offscreen_pitch)) { free_memory (filename); return FALSE; } } free_memory (filename); return TRUE; }
int main() { define_exp(exp); TRY(exp) { do_init(); launch_resource_process(); struct bitmap_t * b = load_bitmap("0*XP3:ss_保有背景真アサシン.tlg|FILE:/home/wn/Windows/Fate/image.xp3", NULL); struct bitmap_array_t * array = split_bitmap(b, 128, 128, 1); if (array->original_bitmap == NULL) { free_bitmap(b); } struct rect_mesh_t * mesh = build_mesh_by_array(array); assert(mesh != NULL); VERBOSE(SYSTEM, "%dx%d\n", array->nr_w, array->nr_h); char name[128]; for (volatile int j = 0; j < array->nr_h; j++) { for (volatile int i = 0; i < array->nr_w; i++) { snprintf(name, 128, "/tmp/%dx%d.png", j, i); define_exp(exp); catch_var(struct io_t *, writer, NULL); TRY(exp) { set_catched_var(writer, io_open_write("FILE", name)); bitmap_to_png(&array->tiles[j * array->nr_w + i], writer); } FINALLY { get_catched_var(writer); if (writer != NULL) io_close(writer); } CATCH(exp) { RETHROW(exp); } } } print_rect_mesh(mesh); destroy_rect_mesh(mesh); if (array->original_bitmap != NULL) { free_bitmap(array->original_bitmap); free_bitmap_array(array); } } FINALLY { shutdown_resource_process(); do_cleanup(); } CATCH(exp) { } return 0; }