diff tools/lib64gfx.h @ 931:2270d7f3af77

Refactor the DMC64Image handling to be more dynamic, and start work on allowing non 320/160 x 200 formats, and charmode based formats. There is still work to be done, and some problems to sort out.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Feb 2015 19:37:59 +0200
parents 3132868d1548
children 5104a7c87d7b
line wrap: on
line diff
--- a/tools/lib64gfx.h	Wed Feb 25 19:32:55 2015 +0200
+++ b/tools/lib64gfx.h	Wed Feb 25 19:37:59 2015 +0200
@@ -133,14 +133,17 @@
         laceBank1,  // Interlace video bank indices
         laceBank2;
 
+    int width, height; // Width and height in pixels
+    int ch_width, ch_height; // Width and height in charblocks
+
     Uint8
-        color[C64_SCR_MAX_BANK][C64_SCR_COLOR_SIZE],
-        bitmap[C64_SCR_MAX_BANK][C64_SCR_BITMAP_SIZE],
-        screen[C64_SCR_MAX_BANK][C64_SCR_SCREEN_SIZE],
+        *color[C64_SCR_MAX_BANK],
+        *bitmap[C64_SCR_MAX_BANK],
+        *screen[C64_SCR_MAX_BANK],
+        *charmem[C64_SCR_MAX_BANK],
         extradata[C64_SCR_EXTRADATA],
         d020, bgcolor, d022, d023, d024;
 
-    Uint8 charmem[C64_MAX_CHARS][C64_CHR_HEIGHT * C64_CHR_WIDTH];
     DMC64Sprite sprites[C64_MAX_SPRITES];
 } DMC64Image;
 
@@ -206,6 +209,10 @@
 extern const int         ndmC64ImageFormats;
 
 
+DMC64Image *dmC64ImageAlloc(int width, int height, int ch_width, int ch_height);
+void      dmC64ImageFree(DMC64Image *img);
+
+
 char *    dmC64GetImageTypeString(char *buf, const size_t len, const int type);
 int       dmC64ConvertCSDataToImage(DMImage *img, int xoffs, int yoffs, const Uint8 *inBuf, int width, int height, BOOL multicolor, int *colors);
 
@@ -215,7 +222,7 @@
 
 int       dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageFormat *fmt, const BOOL doubleMC);
 int       dmC64ProbeBMP(const Uint8 *buf, const size_t len, const DMC64ImageFormat **fmt);
-int       dmC64DecodeBMP(DMC64Image *img, const Uint8 *buf, const size_t len, const size_t probeOffs, const size_t loadOffs, const DMC64ImageFormat **fmt, const DMC64ImageFormat *forced);
+int       dmC64DecodeBMP(DMC64Image **img, const Uint8 *buf, const size_t len, const size_t probeOffs, const size_t loadOffs, const DMC64ImageFormat **fmt, const DMC64ImageFormat *forced);
 
 
 #ifdef __cplusplus