diff --git a/DesktopEditor/cximage/CxImage/ximacfg.h b/DesktopEditor/cximage/CxImage/ximacfg.h index 5c16f1faeb..b13a9afce5 100644 --- a/DesktopEditor/cximage/CxImage/ximacfg.h +++ b/DesktopEditor/cximage/CxImage/ximacfg.h @@ -24,13 +24,13 @@ #if defined(BUILDING_WASM_MODULE) #define CXIMAGE_SUPPORT_BMP 1 -#define CXIMAGE_SUPPORT_GIF 0 +#define CXIMAGE_SUPPORT_GIF 1 #define CXIMAGE_SUPPORT_JPG 1 #define CXIMAGE_SUPPORT_PNG 1 -#define CXIMAGE_SUPPORT_ICO 0 +#define CXIMAGE_SUPPORT_ICO 1 #define CXIMAGE_SUPPORT_TIF 1 -#define CXIMAGE_SUPPORT_TGA 0 -#define CXIMAGE_SUPPORT_PCX 0 +#define CXIMAGE_SUPPORT_TGA 1 +#define CXIMAGE_SUPPORT_PCX 1 #define CXIMAGE_SUPPORT_WBMP 0 #define CXIMAGE_SUPPORT_WMF 0 diff --git a/DesktopEditor/cximage/jasper/jpc/jpc_tsfb.c b/DesktopEditor/cximage/jasper/jpc/jpc_tsfb.c index 0d341981bf..2a4eaee670 100644 --- a/DesktopEditor/cximage/jasper/jpc/jpc_tsfb.c +++ b/DesktopEditor/cximage/jasper/jpc/jpc_tsfb.c @@ -119,18 +119,6 @@ void jpc_tsfb_destroy(jpc_tsfb_t *tsfb) free(tsfb); } -int jpc_tsfb_analyze(jpc_tsfb_t *tsfb, jas_seq2d_t *a) -{ -#ifndef _IOS - return (tsfb->numlvls > 0) ? jpc_tsfb_analyze2(tsfb, jas_seq2d_getref(a, - jas_seq2d_xstart(a), jas_seq2d_ystart(a)), jas_seq2d_xstart(a), - jas_seq2d_ystart(a), jas_seq2d_width(a), - jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0; -#else - return 0; -#endif -} - int jpc_tsfb_analyze2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart, int width, int height, int stride, int numlvls) { @@ -150,15 +138,15 @@ int jpc_tsfb_analyze2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart, return 0; } -int jpc_tsfb_synthesize(jpc_tsfb_t *tsfb, jas_seq2d_t *a) +int jpc_tsfb_analyze(jpc_tsfb_t *tsfb, jas_seq2d_t *a) { #ifndef _IOS - return (tsfb->numlvls > 0) ? jpc_tsfb_synthesize2(tsfb, - jas_seq2d_getref(a, jas_seq2d_xstart(a), jas_seq2d_ystart(a)), - jas_seq2d_xstart(a), jas_seq2d_ystart(a), jas_seq2d_width(a), + return (tsfb->numlvls > 0) ? jpc_tsfb_analyze2(tsfb, jas_seq2d_getref(a, + jas_seq2d_xstart(a), jas_seq2d_ystart(a)), jas_seq2d_xstart(a), + jas_seq2d_ystart(a), jas_seq2d_width(a), jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0; #else - return 0; + return 0; #endif } @@ -182,6 +170,18 @@ int jpc_tsfb_synthesize2(jpc_tsfb_t *tsfb, int *a, int xstart, int ystart, return 0; } +int jpc_tsfb_synthesize(jpc_tsfb_t *tsfb, jas_seq2d_t *a) +{ +#ifndef _IOS + return (tsfb->numlvls > 0) ? jpc_tsfb_synthesize2(tsfb, + jas_seq2d_getref(a, jas_seq2d_xstart(a), jas_seq2d_ystart(a)), + jas_seq2d_xstart(a), jas_seq2d_ystart(a), jas_seq2d_width(a), + jas_seq2d_height(a), jas_seq2d_rowstep(a), tsfb->numlvls - 1) : 0; +#else + return 0; +#endif +} + int jpc_tsfb_getbands(jpc_tsfb_t *tsfb, uint_fast32_t xstart, uint_fast32_t ystart, uint_fast32_t xend, uint_fast32_t yend, jpc_tsfb_band_t *bands) diff --git a/DesktopEditor/graphics/pro/js/make.py b/DesktopEditor/graphics/pro/js/make.py index 5c947d8699..6f84dbcb8b 100644 --- a/DesktopEditor/graphics/pro/js/make.py +++ b/DesktopEditor/graphics/pro/js/make.py @@ -52,7 +52,8 @@ libCxImage_src_path = "./../../../cximage/CxImage" input_cximage_sources = ["ximaenc.cpp", "ximaexif.cpp", "ximage.cpp", "ximainfo.cpp", "ximajpg.cpp", "ximalpha.cpp", "ximapal.cpp", "ximasel.cpp", "xmemfile.cpp", "ximapng.cpp", "ximabmp.cpp", "ximatran.cpp", - "ximatif.cpp", "tif_xfile.cpp", "ximajas.cpp"] + "ximatif.cpp", "tif_xfile.cpp", "ximajas.cpp", "ximagif.cpp", + "ximaico.cpp", "ximatga.cpp", "ximapcx.cpp"] libJpeg_src_path = "./../../../cximage/jpeg" input_jpeg_sources = ["jerror.c", "jdmarker.c", "jdapimin.c", "jdmaster.c", "jdapistd.c", diff --git a/DesktopEditor/raster/BgraFrame.cpp b/DesktopEditor/raster/BgraFrame.cpp index 4aa9ca85fd..5d54401615 100644 --- a/DesktopEditor/raster/BgraFrame.cpp +++ b/DesktopEditor/raster/BgraFrame.cpp @@ -430,7 +430,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp if (CXIMAGE_FORMAT_JP2 == m_nFileType) { Jpeg2000::CJ2kFile oJ2; - return oJ2.Open(this, strFileName, std::wstring(L"")); + return oJ2.Open(this, strFileName, std::wstring(L""), !m_bIsRGBA); } #endif @@ -461,7 +461,7 @@ bool CBgraFrame::Decode(BYTE* pBuffer, int nSize, unsigned int nFileType) if (CXIMAGE_FORMAT_JP2 == m_nFileType) { Jpeg2000::CJ2kFile oJ2; - return oJ2.Open(this, pBuffer, nSize, std::wstring(L"")); + return oJ2.Open(this, pBuffer, nSize, std::wstring(L""), !m_bIsRGBA); } #endif diff --git a/DesktopEditor/raster/Jp2/J2kFile.cpp b/DesktopEditor/raster/Jp2/J2kFile.cpp index aa6c643633..12dc317265 100644 --- a/DesktopEditor/raster/Jp2/J2kFile.cpp +++ b/DesktopEditor/raster/Jp2/J2kFile.cpp @@ -119,7 +119,7 @@ namespace Jpeg2000 } // CJ2kFile - bool CJ2kFile::Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions) + bool CJ2kFile::Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions, bool isBGRA) { Image *pImage = NULL; @@ -199,9 +199,9 @@ namespace Jpeg2000 unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; - pBufferPtr[0] = nB; + pBufferPtr[0] = isBGRA ? nB : nR; pBufferPtr[1] = nG; - pBufferPtr[2] = nR; + pBufferPtr[2] = isBGRA ? nR : nB; pBufferPtr[3] = 255; pBufferPtr += 4; @@ -222,9 +222,9 @@ namespace Jpeg2000 unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; unsigned char nA = pImage->pComponents[3].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; - pBufferPtr[0] = nB; + pBufferPtr[0] = isBGRA ? nB : nR; pBufferPtr[1] = nG; - pBufferPtr[2] = nR; + pBufferPtr[2] = isBGRA ? nR : nB; pBufferPtr[3] = nA; pBufferPtr += 4; @@ -249,7 +249,7 @@ namespace Jpeg2000 Image_Destroy(pImage); return true; } - bool CJ2kFile::Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, const std::wstring& wsXmlOptions) + bool CJ2kFile::Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, const std::wstring& wsXmlOptions, bool isBGRA) { Image *pImage = NULL; @@ -322,9 +322,9 @@ namespace Jpeg2000 unsigned char nG = pImage->pComponents[1].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; - pBufferPtr[0] = nB; + pBufferPtr[0] = isBGRA ? nB : nR; pBufferPtr[1] = nG; - pBufferPtr[2] = nR; + pBufferPtr[2] = isBGRA ? nR : nB; pBufferPtr[3] = 255; pBufferPtr += 4; @@ -345,9 +345,9 @@ namespace Jpeg2000 unsigned char nB = pImage->pComponents[2].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; unsigned char nA = pImage->pComponents[3].pData[nWidth * nResH - ((nIndex) / (nResW)+1) * nWidth + (nIndex) % (nResW)]; - pBufferPtr[0] = nB; + pBufferPtr[0] = isBGRA ? nB : nR; pBufferPtr[1] = nG; - pBufferPtr[2] = nR; + pBufferPtr[2] = isBGRA ? nR : nB; pBufferPtr[3] = nA; pBufferPtr += 4; } diff --git a/DesktopEditor/raster/Jp2/J2kFile.h b/DesktopEditor/raster/Jp2/J2kFile.h index bab3a12fcd..641224f462 100644 --- a/DesktopEditor/raster/Jp2/J2kFile.h +++ b/DesktopEditor/raster/Jp2/J2kFile.h @@ -8,8 +8,8 @@ namespace Jpeg2000 class GRAPHICS_DECL CJ2kFile { public: - bool Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions); - bool Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, const std::wstring& wsXmlOptions); + bool Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions, bool isBGRA); + bool Open(CBgraFrame* pFrame, BYTE* pBuffer, int nSize, const std::wstring& wsXmlOptions, bool isBGRA); bool Save(CBgraFrame* pFrame, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions); bool Open(BYTE** ppData, int& nComponentsCount, int& nWidth, int& nHeight, const std::wstring& wsSrcPath, const std::wstring& wsXmlOptions);