# HG changeset patch # User Matti Hamalainen # Date 1526090076 -10800 # Node ID af729e29a6f6d1f70f71bb5a45fb761e473ddcdd # Parent 776aa43b2c578b772d074da8b7409e7acabfd2f0 Implement Amica Paint packed format encoding. diff -r 776aa43b2c57 -r af729e29a6f6 tools/lib64fmts.c --- a/tools/lib64fmts.c Sat May 12 04:46:08 2018 +0300 +++ b/tools/lib64fmts.c Sat May 12 04:54:36 2018 +0300 @@ -202,6 +202,29 @@ } +static int fmtEncodeAmicaPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) +{ + int res; + DMGrowBuf tmp; + DMCompParams cfg; + + // Encode the data to temp buffer + if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) + goto out; + + // And now RLE compress the data to the existing buffer + cfg.type = DM_COMP_RLE_MARKER; + cfg.rleMarker = 0xC2; + cfg.rleMinCount = 3; + cfg.rleMaxCount = 255; + res = dmEncodeGenericRLE(buf, tmp.data, tmp.data + tmp.len, &cfg); + +out: + dmGrowBufFree(&tmp); + return res; +} + + static int fmtProbeFLIDesigner(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { if (len == fmt->size && @@ -622,7 +645,7 @@ C64_SCR_WIDTH / 2, C64_SCR_HEIGHT, C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT, fmtProbeAmicaPaintPacked, - fmtDecodeAmicaPaintPacked, fmtEncodeStub, + fmtDecodeAmicaPaintPacked, fmtEncodeAmicaPaintPacked, NULL, NULL, NULL, {