comparison lib64gfx.h @ 510:43ea59887c69

Start work on making C64 formats encoding possible by changing DMDecodeOps to DMEncDecOps and adding fields and op enums for custom encode functions, renaming, etc. Split generic op sanity checking into a separate function in preparation for its use in generic encoding function.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 15:06:01 +0200
parents 272e64259fde
children 4cdcaeb68b54
comparison
equal deleted inserted replaced
509:e8e244036ee4 510:43ea59887c69
103 DT_BITMAP, 103 DT_BITMAP,
104 DT_SCREEN_RAM, 104 DT_SCREEN_RAM,
105 DT_BGCOLOR, 105 DT_BGCOLOR,
106 DT_EXTRADATA, 106 DT_EXTRADATA,
107 107
108 DT_FUNCTION, 108 DT_DEC_FUNCTION,
109 DT_ENC_FUNCTION,
109 110
110 DT_LAST, 111 DT_LAST,
111 }; 112 };
112 113
113 114
114 typedef struct _DMDecodeOp 115 typedef struct _DMC64EncDecOp
115 { 116 {
116 int type; 117 int type;
117 size_t offs; 118 size_t offs;
118 int bank; 119 int bank;
119 size_t size; 120 size_t size;
120 BOOL (*function)(DMC64Image *img, const struct _DMDecodeOp *op, const Uint8 *buf, const size_t len); 121 BOOL (*decfunction)(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len);
121 } DMDecodeOp; 122 BOOL (*encfunction)(const struct _DMC64EncDecOp *op, Uint8 **buf, size_t *len, const DMC64Image *img);
123 } DMC64EncDecOp;
122 124
123 125
124 typedef struct _DMC64ImageFormat 126 typedef struct _DMC64ImageFormat
125 { 127 {
126 int type; 128 int type;
130 int (*decode)(DMC64Image *img, const Uint8 *buf, const size_t len, const struct _DMC64ImageFormat *fmt); 132 int (*decode)(DMC64Image *img, const Uint8 *buf, const size_t len, const struct _DMC64ImageFormat *fmt);
131 int (*encode)(DMC64Image *img, Uint8 **buf, size_t *len, const struct _DMC64ImageFormat *fmt); 133 int (*encode)(DMC64Image *img, Uint8 **buf, size_t *len, const struct _DMC64ImageFormat *fmt);
132 int (*convertFrom)(DMImage *, DMC64Image *); 134 int (*convertFrom)(DMImage *, DMC64Image *);
133 int (*convertTo)(DMImage *, DMC64Image *); 135 int (*convertTo)(DMImage *, DMC64Image *);
134 136
135 int ndecodeOps; 137 int ndecencOps;
136 DMDecodeOp decodeOps[16]; 138 DMC64EncDecOp decencOps[16];
137 } DMC64ImageFormat; 139 } DMC64ImageFormat;
138 140
139 141
140 extern const size_t dmC64DefaultSizes[DT_LAST]; 142 extern const size_t dmC64DefaultSizes[DT_LAST];
141 extern DMColor dmC64Palette[C64_NCOLORS]; 143 extern DMColor dmC64Palette[C64_NCOLORS];