summaryrefslogtreecommitdiff
path: root/csrc/mkf/test/dump1.c
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-10-01 21:55:35 +0800
committerIru Cai <mytbk920423@gmail.com>2018-10-01 21:55:35 +0800
commitb1c77551dce9570b8a7fb6baeef0e17e23f3dda0 (patch)
tree2fc878c5b00f1ecb2a1b59281a2e471e5f07700b /csrc/mkf/test/dump1.c
parent6736d6764ba2541eeaa48b45b002acadb20b9b05 (diff)
downloadrich4-b1c77551dce9570b8a7fb6baeef0e17e23f3dda0.tar.xz
add dump1 test
Diffstat (limited to 'csrc/mkf/test/dump1.c')
-rw-r--r--csrc/mkf/test/dump1.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/csrc/mkf/test/dump1.c b/csrc/mkf/test/dump1.c
new file mode 100644
index 0000000..072d95b
--- /dev/null
+++ b/csrc/mkf/test/dump1.c
@@ -0,0 +1,28 @@
+/* gcc -m32 -I.. dump1.c ../mkf.c ../mkf_decompress.c -o dump1 */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "mkf.h"
+
+int pixel_fmt = 1;
+
+int main(int argc, char *argv[])
+{
+ int mkf = load_mkf("Data.mkf");
+ struct spr_smp *data1 = (struct spr_smp*)read_mkf(mkf, 1, NULL, NULL);
+
+ for (int i = 0; i < data1->nchunk; i++) {
+ struct graph_st *gi = &data1->chunk_tab[i];
+ printf("width = %hd, height = %hd, x = %hd, y = %hd\n",
+ gi->width, gi->height, gi->x, gi->y);
+
+ char fn[16];
+ sprintf(fn, "data1.%02d.data", i);
+ FILE *fp = fopen(fn, "wb");
+ fwrite(gi->gdata, 1, gi->width * gi->height * 2, fp);
+ fclose(fp);
+ }
+ free(data1);
+ unload_mkf(mkf);
+}