comparison tools/lib64fmts.c @ 2224:a36c81c3df85

Make color interlace type generate a mixed palette instead of using special decode functions for it.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 12:13:23 +0300
parents 75b5bb490f38
children 5db6e0b63b35
comparison
equal deleted inserted replaced
2223:5477e792def3 2224:a36c81c3df85
740 740
741 return dmC64GetGenericMCPixel(col, img, 741 return dmC64GetGenericMCPixel(col, img,
742 bmoffs, scroffs, 742 bmoffs, scroffs,
743 vshift, rasterY & 7, 743 vshift, rasterY & 7,
744 0, 0, bgcol); 744 0, 0, bgcol);
745 }
746
747
748 static int fmtTruePaintGetLaceType(const DMC64EncDecOp *op, DMC64Image *img,
749 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt)
750 {
751 (void) op;
752 (void) buf;
753 (void) fmt;
754 img->laceType = D64_ILACE_RES;
755 return DMERR_OK;
756 } 745 }
757 746
758 747
759 static int fmtGetPixelTruePaint(Uint8 *col, 748 static int fmtGetPixelTruePaint(Uint8 *col,
760 const DMC64Image *img, const int rasterX, const int rasterY) 749 const DMC64Image *img, const int rasterX, const int rasterY)
1510 bmoffs, scroffs, 1499 bmoffs, scroffs,
1511 vshift, rasterY & 7, 0); 1500 vshift, rasterY & 7, 0);
1512 } 1501 }
1513 1502
1514 1503
1515 static int fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img,
1516 const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt)
1517 {
1518 (void) op;
1519 (void) buf;
1520 (void) fmt;
1521 img->laceType = D64_ILACE_COLOR;
1522 return DMERR_OK;
1523 }
1524
1525
1526 static int fmtGetPixelECI(Uint8 *col, 1504 static int fmtGetPixelECI(Uint8 *col,
1527 const DMC64Image *img, const int rasterX, const int rasterY) 1505 const DMC64Image *img, const int rasterX, const int rasterY)
1528 { 1506 {
1529 DM_C64_GENERIC_SC_PIXEL_DEFS(img) 1507 DM_C64_GENERIC_SC_PIXEL_DEFS(img)
1530 const int vbank = rasterY & 7; 1508 const int vbank = rasterY & 7;
1535 (res = dmC64GetGenericSCPixel(&color2, img, bmoffs, scroffs, vshift, vbank + 8, 1)) != DMERR_OK) 1513 (res = dmC64GetGenericSCPixel(&color2, img, bmoffs, scroffs, vshift, vbank + 8, 1)) != DMERR_OK)
1536 return res; 1514 return res;
1537 1515
1538 *col = (color1 * D64_NCOLORS) + color2; 1516 *col = (color1 * D64_NCOLORS) + color2;
1539 return DMERR_OK; 1517 return DMERR_OK;
1540 }
1541
1542
1543 static int fmtConvertECIBMP2Image(DMImage *dst, const DMC64Image *src,
1544 const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
1545 {
1546 int res;
1547
1548 if ((res = dmC64SetImagePalette(dst, spec, TRUE)) != DMERR_OK)
1549 return res;
1550
1551 return dmC64ConvertGenericBMP2Image(dst, src, fmt, spec);
1552 } 1518 }
1553 1519
1554 1520
1555 static int fmtProbeECIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 1521 static int fmtProbeECIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1556 { 1522 {
1718 D64_SCR_CH_WIDTH , D64_SCR_CH_HEIGHT, 1684 D64_SCR_CH_WIDTH , D64_SCR_CH_HEIGHT,
1719 1, 1, 1685 1, 1,
1720 NULL, NULL, 1686 NULL, NULL,
1721 fmtGetPixelFunPaint2, 1687 fmtGetPixelFunPaint2,
1722 { 1688 {
1723 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM, 0x0000, 0, 0x400, 0, DF_NORMAL), 1689 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0000, 0, 0x400, 0, DF_NORMAL),
1724 { DO_COPY , DS_BITMAP_RAM , 0x2000, 0, 0 , 0, NULL, NULL, DF_NORMAL }, 1690 { DO_COPY , DS_BITMAP_RAM , 0x2000, 0, 0 , 0, NULL, NULL, DF_NORMAL },
1725 { DO_COPY , DS_EXTRA_DATA , 0x3f48, 0, 100, 0, NULL, NULL, DF_NORMAL }, 1691 { DO_COPY , DS_EXTRA_DATA , 0x3f48, 0, 100 , 0, NULL, NULL, DF_NORMAL },
1726 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0 , 0, NULL, NULL, DF_NORMAL }, 1692 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0 , 0, NULL, NULL, DF_NORMAL },
1727 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM, 0x43e8, 8, 0x400, 0, DF_NORMAL), 1693 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x43e8, 8, 0x400, 0, DF_NORMAL),
1728 { DO_COPY , DS_BITMAP_RAM , 0x63e8, 1, 0 , 0, NULL, NULL, DF_NORMAL }, 1694 { DO_COPY , DS_BITMAP_RAM , 0x63e8, 1, 0 , 0, NULL, NULL, DF_NORMAL },
1729 { DO_COPY , DS_EXTRA_DATA , 0x8328, 0, 100, 100, NULL, NULL, DF_NORMAL }, 1695 { DO_COPY , DS_EXTRA_DATA , 0x8328, 0, 100 , 100, NULL, NULL, DF_NORMAL },
1730 { DO_FUNC , 0 , 0 , 0, 1 , 0, fmtTruePaintGetLaceType, NULL, DF_NORMAL }, 1696 { DO_SET_OP , DS_ILACE_TYPE , D64_ILACE_RES, 0 , 0 , 0, NULL, NULL, DF_DECODE },
1731 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL, DF_NORMAL }, 1697 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL, DF_NORMAL },
1732 } 1698 }
1733 }, 1699 },
1734 1700
1735 { // #4: DrazPaint 1.x & 2 1701 { // #4: DrazPaint 1.x & 2
1736 D64_FMT_MC, 1702 D64_FMT_MC,
1778 { DO_SET_MEM_LO , DS_BGCOL , 0x03e8, 0, 0, 0, NULL, NULL, DF_NORMAL }, 1744 { DO_SET_MEM_LO , DS_BGCOL , 0x03e8, 0, 0, 0, NULL, NULL, DF_NORMAL },
1779 { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, 0, NULL, NULL, DF_NORMAL }, 1745 { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, 0, NULL, NULL, DF_NORMAL },
1780 { DO_COPY , DS_BITMAP_RAM , 0x2400, 1, 0, 0, NULL, NULL, DF_NORMAL }, 1746 { DO_COPY , DS_BITMAP_RAM , 0x2400, 1, 0, 0, NULL, NULL, DF_NORMAL },
1781 { DO_COPY , DS_SCREEN_RAM , 0x4400, 1, 0, 0, NULL, NULL, DF_NORMAL }, 1747 { DO_COPY , DS_SCREEN_RAM , 0x4400, 1, 0, 0, NULL, NULL, DF_NORMAL },
1782 { DO_COPY , DS_COLOR_RAM , 0x4800, 0, 0, 0, NULL, NULL, DF_NORMAL }, 1748 { DO_COPY , DS_COLOR_RAM , 0x4800, 0, 0, 0, NULL, NULL, DF_NORMAL },
1783 { DO_FUNC , 0 , 0x0000, 0, 0, 0, fmtTruePaintGetLaceType, NULL, DF_NORMAL }, 1749 { DO_SET_OP , DS_ILACE_TYPE , D64_ILACE_RES, 0 , 0 , 0, NULL, NULL, DF_DECODE },
1784 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL }, 1750 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL },
1785 } 1751 }
1786 }, 1752 },
1787 1753
1788 { // #7: ECI Graphic Editor Hires FLI 1754 { // #7: ECI Graphic Editor Hires FLI
1789 D64_FMT_HIRES | D64_FMT_FLI, 1755 D64_FMT_HIRES | D64_FMT_FLI | D64_FMT_ILACE,
1790 D64_SCR_WIDTH, D64_SCR_HEIGHT, 1756 D64_SCR_WIDTH, D64_SCR_HEIGHT,
1791 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT, 1757 D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
1792 1, 1, 1758 1, 1,
1793 fmtConvertECIBMP2Image, NULL, 1759 NULL, NULL,
1794 fmtGetPixelECI, 1760 fmtGetPixelECI,
1795 { 1761 {
1796 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, 0, NULL, NULL, DF_NORMAL }, 1762 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, 0, NULL, NULL, DF_NORMAL },
1797 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0, 0x400, 0, DF_NORMAL), 1763 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0, 0x400, 0, DF_NORMAL),
1798 { DO_COPY , DS_BITMAP_RAM , 0x4000, 1, 0, 0, NULL, NULL, DF_NORMAL }, 1764 { DO_COPY , DS_BITMAP_RAM , 0x4000, 1, 0, 0, NULL, NULL, DF_NORMAL },
1799 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x6000, 8, 0x400, 0, DF_NORMAL), 1765 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x6000, 8, 0x400, 0, DF_NORMAL),
1800 { DO_FUNC , 0 , 0 , 0, 0, 0, fmtECIGetLaceType, NULL, DF_NORMAL }, 1766 { DO_SET_OP , DS_ILACE_TYPE , D64_ILACE_COLOR, 0 , 0 , 0, NULL, NULL, DF_DECODE },
1801 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL }, 1767 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL },
1802 } 1768 }
1803 }, 1769 },
1804 1770
1805 { // #8: Cosmos Designs Hires Manager 1771 { // #8: Cosmos Designs Hires Manager
2461 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x4400, 8, 0x400, 0, DF_NORMAL), 2427 DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x4400, 8, 0x400, 0, DF_NORMAL),
2462 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0 , 0, NULL, NULL, DF_NORMAL }, 2428 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0 , 0, NULL, NULL, DF_NORMAL },
2463 // GunPaint does not store the last 3 d021 values .. so set them to black 2429 // GunPaint does not store the last 3 d021 values .. so set them to black
2464 // XXX TODO: According to some, the last 4 should be same .. 2430 // XXX TODO: According to some, the last 4 should be same ..
2465 { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL, DF_NORMAL }, 2431 { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL, DF_NORMAL },
2466 { DO_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL, DF_NORMAL }, 2432 { DO_SET_OP , DS_ILACE_TYPE , D64_ILACE_RES, 0 , 0 , 0, NULL, NULL, DF_DECODE },
2467 { DO_FUNC , 0 , 0 , 0, 0 , 0, NULL, fmtEncodeGunPaint, DF_NORMAL }, 2433 { DO_FUNC , 0 , 0 , 0, 0 , 0, NULL, fmtEncodeGunPaint, DF_NORMAL },
2468 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL, DF_NORMAL }, 2434 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL, DF_NORMAL },
2469 } 2435 }
2470 }, 2436 },
2471 NULL 2437 NULL