Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 1488:c71b6c5204af
Factor the C64 bitmap image format info dump function to lib64gfx and use it from 64vw.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 11 May 2018 05:23:07 +0300 |
parents | 06df2bdf5dc4 |
children | 71e847ea9d22 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Fri May 11 04:55:28 2018 +0300 +++ b/tools/lib64gfx.c Fri May 11 05:23:07 2018 +0300 @@ -41,6 +41,47 @@ #define DM_GET_ADDR_HI(addr) (((addr) >> 8) & 0xff) +void dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt) +{ + char typeStr[64]; + + dmC64GetImageTypeString(typeStr, sizeof(typeStr), img->type); + + if (fmt != NULL) + { + fprintf(fh, + "Format : %s [%s]\n", + fmt->name, fmt->fext); + } + + fprintf(fh, + "Type : %s\n" + "Banks : %d\n", + typeStr, + img->nbanks); + + if (img->type & D64_FMT_ILACE) + { + char *tmps; + switch(img->laceType) + { + case D64_ILACE_COLOR: tmps = "color"; break; + case D64_ILACE_RES: tmps = "resolution"; break; + default: tmps = "ERROR"; break; + } + fprintf(fh, + "Interlace type : %s\n", + tmps); + } + + fprintf(fh, + "Width x Height : %d x %d\n" + "CHwidth x CHheight : %d x %d\n", + img->width, img->height, + img->chWidth, img->chHeight); +} + + void dmSetDefaultC64Palette(DMImage *img) { img->constpal = TRUE;