gn_error loadbitmap(gn_bmp *bitmap, char *s, int type, struct gn_statemachine *state) { gn_error error; bitmap->type = type; error = gn_bmp_null(bitmap, &state->driver.phone); if (error != GN_ERR_NONE) { fprintf(stderr, _("Could not null bitmap: %s\n"), gn_error_print(error)); return error; } error = gn_file_bitmap_read(s, bitmap, &state->driver.phone); if (error != GN_ERR_NONE) { fprintf(stderr, _("Could not load bitmap from %s: %s\n"), s, gn_error_print(error)); return error; } return GN_ERR_NONE; }
gn_error gn_file_bitmap_show(char *filename) { int i, j; gn_bmp bitmap; gn_error error; error = gn_file_bitmap_read(filename, &bitmap, NULL); if (error != GN_ERR_NONE) return error; for (i = 0; i < bitmap.height; i++) { for (j = 0; j < bitmap.width; j++) { fprintf(stdout, "%c", gn_bmp_point(&bitmap, j, i) ? '#' : ' '); } fprintf(stdout, "\n"); } return GN_ERR_NONE; }