Permalink
Browse files

Enabled most file formats and EXIF data

  • Loading branch information...
1 parent 07b0663 commit 8fb7ef62ef522aac3141b349ea07e3278a518703 @grahamboree committed Oct 7, 2012
Showing with 1,120 additions and 472 deletions.
  1. +5 −4 Source/cppimage/CxIOFile.h
  2. +2 −0 Source/cppimage/CxImage.h
  3. +1 −1 Source/cppimage/Types.h
  4. +9 −4 Source/cppimage/formatSpecific/ximabmp.cpp
  5. +1 −1 Source/cppimage/formatSpecific/ximagif.cpp
  6. +14 −2 Source/cppimage/formatSpecific/ximaico.cpp
  7. +1 −1 Source/cppimage/formatSpecific/ximajas.h
  8. +1 −1 Source/cppimage/formatSpecific/ximajbg.cpp
  9. +1 −1 Source/cppimage/formatSpecific/ximajbg.h
  10. +2 −2 Source/cppimage/formatSpecific/ximajpg.cpp
  11. +2 −2 Source/cppimage/formatSpecific/ximajpg.h
  12. +3 −3 Source/cppimage/formatSpecific/ximamng.h
  13. +1 −1 Source/cppimage/formatSpecific/ximapcx.cpp
  14. +1 −1 Source/cppimage/formatSpecific/ximapsd.h
  15. +4 −0 Source/cppimage/formatSpecific/ximaraw.cpp
  16. +1 −1 Source/cppimage/formatSpecific/ximaraw.h
  17. +1 −1 Source/cppimage/formatSpecific/ximatga.cpp
  18. +1 −1 Source/cppimage/formatSpecific/ximatif.cpp
  19. +1 −1 Source/cppimage/formatSpecific/ximatif.h
  20. +1 −1 Source/cppimage/formatSpecific/ximawbmp.cpp
  21. +4 −2 Source/cppimage/tif_xfile.cpp
  22. +16 −15 Source/cppimage/ximacfg.h
  23. +12 −12 Source/cppimage/ximaenc.cpp
  24. +158 −0 Source/jbig/jbig.xcodeproj/project.pbxproj
  25. +59 −0 Source/jbig/jbig.xcodeproj/xcuserdata/pentheny.xcuserdatad/xcschemes/jbig.xcscheme
  26. +22 −0 Source/jbig/jbig.xcodeproj/xcuserdata/pentheny.xcuserdatad/xcschemes/xcschememanagement.plist
  27. +73 −63 Source/tiff/tif_config.h
  28. +355 −350 Source/tiff/tiffiop.h
  29. +230 −0 Source/zlib/zlib.xcodeproj/project.pbxproj
  30. +22 −0 Source/zlib/zlib.xcodeproj/xcuserdata/pentheny.xcuserdatad/xcschemes/xcschememanagement.plist
  31. +59 −0 Source/zlib/zlib.xcodeproj/xcuserdata/pentheny.xcuserdatad/xcschemes/zlib.xcscheme
  32. +57 −1 cppimage.xcodeproj/project.pbxproj
@@ -93,17 +93,18 @@ inline bool CxIOFile::Seek(int32_t offset, int32_t origin)
inline int32_t CxIOFile::Tell()
{
if (!m_fp) return 0;
- return ftell(m_fp);
+ return static_cast<int32_t>(ftell(m_fp));
}
//////////////////////////////////////////////////////////
inline int32_t CxIOFile::Size()
{
if (!m_fp) return -1;
- int32_t pos,size;
- pos = ftell(m_fp);
+ int32_t pos;
+ int32_t size;
+ pos = static_cast<int32_t>(ftell(m_fp));
fseek(m_fp, 0, SEEK_END);
- size = ftell(m_fp);
+ size = static_cast<int32_t>(ftell(m_fp));
fseek(m_fp, pos,SEEK_SET);
return size;
}
@@ -795,8 +795,10 @@ class DLL_EXP CxImage
CxImage* GetLayer(int32_t position);
CxImage* GetParent() const;
int32_t GetNumLayers() const;
+#ifdef WIN32 //@HACK
int32_t LayerDrawAll(HDC hdc, int32_t x = 0, int32_t y = 0, int32_t cx = -1, int32_t cy = -1, RECT* pClipRect = 0, bool bSmooth = false);
int32_t LayerDrawAll(HDC hdc, const RECT& rect, RECT* pClipRect = NULL, bool bSmooth = false);
+#endif
//@}
#endif //CXIMAGE_SUPPORT_LAYERS
@@ -21,4 +21,4 @@
typedef unsigned char BYTE;
-typedef unsigned int DWORD;
+typedef unsigned int DWORD;
@@ -9,7 +9,7 @@
#if CXIMAGE_SUPPORT_BMP
-#include "ximaiter.h"
+#include "CImageIterator.h"
////////////////////////////////////////////////////////////////////////////////
#if CXIMAGE_SUPPORT_ENCODE
@@ -142,9 +142,14 @@ bool CxImageBMP::Decode(CxFile * hFile)
hFile->Read(reinterpret_cast<void*>(pRgb), DibNumColors(&bmpHeader) * sizeof(RGBTRIPLE), 1);
for (int32_t i = DibNumColors(&head) - 1; i >= 0; i--)
{
- pRgb[i].rgbRed = (static_cast<RGBTRIPLE*>(pRgb))[i].rgbtRed;
- pRgb[i].rgbBlue = (static_cast<RGBTRIPLE*>(pRgb))[i].rgbtBlue;
- pRgb[i].rgbGreen = (static_cast<RGBTRIPLE*>(pRgb))[i].rgbtGreen;
+ pRgb[i].rgbRed = (reinterpret_cast<RGBTRIPLE*>(pRgb))[i].rgbtRed;
+ pRgb[i].rgbBlue = (reinterpret_cast<RGBTRIPLE*>(pRgb))[i].rgbtBlue;
+ pRgb[i].rgbGreen = (reinterpret_cast<RGBTRIPLE*>(pRgb))[i].rgbtGreen;
+ /*
+ pRgb[i].rgbRed = ((RGBTRIPLE*)(pRgb))[i].rgbtRed;
+ pRgb[i].rgbBlue = ((RGBTRIPLE*)(pRgb))[i].rgbtBlue;
+ pRgb[i].rgbGreen = ((RGBTRIPLE*)(pRgb))[i].rgbtGreen;
+ */
pRgb[i].rgbReserved = static_cast<uint8_t>(0);
}
}
@@ -9,7 +9,7 @@
#if CXIMAGE_SUPPORT_GIF
-#include "ximaiter.h"
+#include "CImageIterator.h"
#if defined (_WIN32_WCE)
#define assert(s)
@@ -322,7 +322,8 @@ bool CxImageICO::Encode(CxFile * hFile, bool bAppend, int32_t nPageCount)
int32_t nPages = nPageCount;
if (nPages<1) nPages = 1;
- ICONHEADER icon_header={0,1,nPages};
+ ICONHEADER icon_header={0,1,static_cast<uint16_t>(nPages)};
+ //ICONHEADER icon_header={0,1,nPages};
if (!bAppend)
m_dwImageOffset = sizeof(ICONHEADER) + nPages * sizeof(ICONDIRENTRY);
@@ -345,9 +346,20 @@ bool CxImageICO::Encode(CxFile * hFile, bool bAppend, int32_t nPageCount)
2*head.biHeight,
1,
(uint16_t)bitcount,
- 0, imagesize,
+ 0, static_cast<uint32_t>(imagesize),
0, 0, 0, 0
};
+ /*
+ BITMAPINFOHEADER bi={
+ sizeof(BITMAPINFOHEADER),
+ head.biWidth,
+ 2*head.biHeight,
+ 1,
+ (uint16_t)bitcount,
+ 0, imagesize,
+ 0, 0, 0, 0
+ };
+ */
#if CXIMAGE_SUPPORT_PNG // Vista icon support
CxImage png(*this);
@@ -19,7 +19,7 @@
#ifdef _LINUX
#include <jasper/jasper.h>
#else
- #include "../jasper/include/jasper/jasper.h"
+ #include "../../jasper/include/jasper/jasper.h"
#endif
class CxImageJAS: public CxImage
@@ -9,7 +9,7 @@
#if CXIMAGE_SUPPORT_JBG
-#include "ximaiter.h"
+#include "CImageIterator.h"
#define JBIG_BUFSIZE 8192
@@ -17,7 +17,7 @@
#if CXIMAGE_SUPPORT_JBG
extern "C" {
-#include "../jbig/jbig.h"
+#include "../../jbig/jbig.h"
};
class CxImageJBG: public CxImage
@@ -12,10 +12,10 @@
#ifdef _LINUX
#include <jmorecfg.h>
#else
- #include "../jpeg/jmorecfg.h"
+ #include "../../jpeg/jmorecfg.h"
#endif
-#include "ximaiter.h"
+#include "CImageIterator.h"
#include <setjmp.h>
@@ -33,8 +33,8 @@ extern "C" {
#include <jpeglib.h>
#include <jerror.h>
#else
- #include "../jpeg/jpeglib.h"
- #include "../jpeg/jerror.h"
+ #include "../../jpeg/jpeglib.h"
+ #include "../../jpeg/jerror.h"
#endif
}
@@ -31,9 +31,9 @@
#define MNG_STORE_CHUNKS
extern "C" {
-#include "../mng/libmng.h"
-#include "../mng/libmng_data.h"
-#include "../mng/libmng_error.h"
+#include "../../mng/libmng.h"
+#include "../../mng/libmng_data.h"
+#include "../../mng/libmng_error.h"
}
//uint32_t _stdcall RunMNGThread(void *lpParam);
@@ -13,7 +13,7 @@
#if CXIMAGE_SUPPORT_PCX
-#include "xmemfile.h"
+#include "CxMemFile.h"
#define PCX_MAGIC 0X0A // PCX magic number
#define PCX_256_COLORS 0X0C // magic number for 256 colors
@@ -21,7 +21,7 @@
#if CXIMAGE_USE_LIBPSD
extern "C" {
- #include "../libpsd/libpsd.h"
+ #include "../../libpsd/libpsd.h"
}
#endif
@@ -269,7 +269,11 @@ bool CxImageRAW::GetExifThumbnail(const TCHAR *filename, const TCHAR *outname, i
// THUMB.
if (dcr.thumb_offset != 0)
{
+#ifdef WIN32
FILE* file = _tfopen(outname, _T("wb"));
+#else
+ FILE* file = fopen(outname, _T("wb"));
+#endif
DCRAW* p = &dcr;
dcr_fseek(dcr.obj_, dcr.thumb_offset, SEEK_SET);
dcr.write_thumb(&dcr, file);
@@ -21,7 +21,7 @@
#if CXIMAGE_SUPPORT_RAW
extern "C" {
- #include "../raw/libdcr.h"
+ #include "../../raw/libdcr.h"
}
class CxImageRAW: public CxImage
@@ -9,7 +9,7 @@
#if CXIMAGE_SUPPORT_TGA
-#include "ximaiter.h"
+#include "CImageIterator.h"
// Definitions for image types.
#define TGA_Null 0
@@ -11,7 +11,7 @@
#define FIX_16BPP_DARKIMG // + VK: if uncomment, dark 16bpp images are fixed
-#include "../tiff/tiffio.h"
+#include "../../tiff/tiffio.h"
#define CVT(x) (((x) * 255L) / ((1L<<16)-1))
#define SCALE(x) (((x)*((1L<<16)-1))/255)
@@ -23,7 +23,7 @@
#if CXIMAGE_SUPPORT_TIF
-#include "../tiff/tiffio.h"
+#include "../../tiff/tiffio.h"
class DLL_EXP CxImageTIF: public CxImage
{
@@ -9,7 +9,7 @@
#if CXIMAGE_SUPPORT_WBMP
-#include "ximaiter.h"
+#include "CImageIterator.h"
////////////////////////////////////////////////////////////////////////////////
#if CXIMAGE_SUPPORT_DECODE
@@ -14,7 +14,7 @@
# include "../tiff/tiffiop.h"
# include "../tiff/tiffvers.h"
-# include "xfile.h"
+# include "CxFile.h"
//////////////////////////////////////////////////////////////////////////
static tsize_t _tiffReadProcEx(thandle_t fd, tdata_t buf, tsize_t size)
@@ -98,7 +98,9 @@ TIFF* _TIFFFdOpen(void* fd, const char* name, const char* mode)
_tiffSizeProcEx, _tiffMapProcEx, _tiffUnmapProcEx);
if (tif)
{
- tif->tif_fd = (int)fd;
+ tif->tif_fd = static_cast<int>(reinterpret_cast<long>(fd));
+ //@HACK
+ //tif->tif_fd = (int)fd;
}
return (tif);
}
@@ -6,27 +6,28 @@
#define CXIMAGE_SUPPORT_SELECTION 1
#define CXIMAGE_SUPPORT_TRANSFORMATION 1
#define CXIMAGE_SUPPORT_DSP 1
-#define CXIMAGE_SUPPORT_LAYERS 0
+#define CXIMAGE_SUPPORT_LAYERS 1
#define CXIMAGE_SUPPORT_INTERPOLATION 1
#define CXIMAGE_SUPPORT_DECODE 1
#define CXIMAGE_SUPPORT_ENCODE 1 //<vho><T.Peck>
#define CXIMAGE_SUPPORT_WINDOWS 1
-#define CXIMAGE_SUPPORT_EXIF 0
+#define CXIMAGE_SUPPORT_EXIF 1
/////////////////////////////////////////////////////////////////////////////
// CxImage supported formats
-#define CXIMAGE_SUPPORT_BMP 0
-#define CXIMAGE_SUPPORT_GIF 0
-#define CXIMAGE_SUPPORT_JPG 0
+#define CXIMAGE_SUPPORT_BMP 1
+#define CXIMAGE_SUPPORT_GIF 1
+#define CXIMAGE_SUPPORT_JPG 1
#define CXIMAGE_SUPPORT_PNG 1
-#define CXIMAGE_SUPPORT_ICO 0
-#define CXIMAGE_SUPPORT_TIF 0
-#define CXIMAGE_SUPPORT_TGA 0
-#define CXIMAGE_SUPPORT_PCX 0
-#define CXIMAGE_SUPPORT_WBMP 0
-#define CXIMAGE_SUPPORT_WMF 0
-
+#define CXIMAGE_SUPPORT_ICO 1
+#define CXIMAGE_SUPPORT_TIF 1
+#define CXIMAGE_SUPPORT_TGA 1
+#define CXIMAGE_SUPPORT_PCX 1
+#define CXIMAGE_SUPPORT_WBMP 1
+#define CXIMAGE_SUPPORT_WMF 1
+
+// Jasper files
#define CXIMAGE_SUPPORT_JP2 0
#define CXIMAGE_SUPPORT_JPC 0
#define CXIMAGE_SUPPORT_PGX 0
@@ -36,9 +37,9 @@
#define CXIMAGE_SUPPORT_JBG 0 // GPL'd see ../jbig/copying.txt & ../jbig/patents.htm
#define CXIMAGE_SUPPORT_MNG 0
-#define CXIMAGE_SUPPORT_SKA 0
-#define CXIMAGE_SUPPORT_RAW 0
-#define CXIMAGE_SUPPORT_PSD 0
+#define CXIMAGE_SUPPORT_SKA 1
+#define CXIMAGE_SUPPORT_RAW 1
+#define CXIMAGE_SUPPORT_PSD 1
/////////////////////////////////////////////////////////////////////////////
#define CXIMAGE_MAX_MEMORY 268435456
Oops, something went wrong. Retry.

0 comments on commit 8fb7ef6

Please sign in to comment.