]> Creatis software - clitk.git/blobdiff - utilities/CxImage/ximapng.h
cosmetic
[clitk.git] / utilities / CxImage / ximapng.h
index 3fddf5b64febe1a7459550530031a66aeb3a16d1..abfd80b8558f0ed87afa6cd49ec5cc839a8bad04 100644 (file)
@@ -1,74 +1,74 @@
-/*\r
- * File:       ximapng.h\r
- * Purpose:    PNG Image Class Loader and Writer\r
- */\r
-/* ==========================================================\r
- * CxImagePNG (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it\r
- * For conditions of distribution and use, see copyright notice in ximage.h\r
- *\r
- * Special thanks to Troels Knakkergaard for new features, enhancements and bugfixes\r
- *\r
- * original CImagePNG  and CImageIterator implementation are:\r
- * Copyright:  (c) 1995, Alejandro Aguilar Sierra <asierra(at)servidor(dot)unam(dot)mx>\r
- *\r
- * libpng Copyright (c) 1998-2003 Glenn Randers-Pehrson\r
- * ==========================================================\r
- */\r
-#if !defined(__ximaPNG_h)\r
-#define __ximaPNG_h\r
-\r
-#include "ximage.h"\r
-\r
-#if CXIMAGE_SUPPORT_PNG\r
-\r
-extern "C" {\r
-#include "../png/png.h"\r
-}\r
-\r
-class CxImagePNG: public CxImage\r
-{\r
-public:\r
-       CxImagePNG(): CxImage(CXIMAGE_FORMAT_PNG) {}\r
-\r
-//     bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_PNG);}\r
-//     bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_PNG);}\r
-       bool Decode(CxFile * hFile);\r
-       bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }\r
-\r
-#if CXIMAGE_SUPPORT_ENCODE\r
-       bool Encode(CxFile * hFile);\r
-       bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }\r
-#endif // CXIMAGE_SUPPORT_ENCODE\r
-\r
-protected:\r
-       void ima_png_error(png_struct *png_ptr, char *message);\r
-       void expand2to4bpp(BYTE* prow);\r
-\r
-       static void PNGAPI user_read_data(png_structp png_ptr, png_bytep data, png_size_t length)\r
-       {\r
-               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);\r
-               if (hFile == NULL || hFile->Read(data,1,length) != length) png_error(png_ptr, "Read Error");\r
-       }\r
-\r
-       static void PNGAPI user_write_data(png_structp png_ptr, png_bytep data, png_size_t length)\r
-       {\r
-               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);\r
-               if (hFile == NULL || hFile->Write(data,1,length) != length) png_error(png_ptr, "Write Error");\r
-       }\r
-\r
-       static void PNGAPI user_flush_data(png_structp png_ptr)\r
-       {\r
-               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);\r
-               if (hFile == NULL || !hFile->Flush()) png_error(png_ptr, "Flush Error");\r
-       }\r
-\r
-    static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)\r
-       {\r
-               strncpy((char*)png_ptr->error_ptr,error_msg,255);\r
-               longjmp(png_ptr->jmpbuf, 1);\r
-       }\r
-};\r
-\r
-#endif\r
-\r
-#endif\r
+/*
+ * File:       ximapng.h
+ * Purpose:    PNG Image Class Loader and Writer
+ */
+/* ==========================================================
+ * CxImagePNG (c) 07/Aug/2001 Davide Pizzolato - www.xdp.it
+ * For conditions of distribution and use, see copyright notice in ximage.h
+ *
+ * Special thanks to Troels Knakkergaard for new features, enhancements and bugfixes
+ *
+ * original CImagePNG  and CImageIterator implementation are:
+ * Copyright:  (c) 1995, Alejandro Aguilar Sierra <asierra(at)servidor(dot)unam(dot)mx>
+ *
+ * libpng Copyright (c) 1998-2003 Glenn Randers-Pehrson
+ * ==========================================================
+ */
+#if !defined(__ximaPNG_h)
+#define __ximaPNG_h
+
+#include "ximage.h"
+
+#if CXIMAGE_SUPPORT_PNG
+
+extern "C" {
+#include "../png/png.h"
+}
+
+class CxImagePNG: public CxImage
+{
+public:
+       CxImagePNG(): CxImage(CXIMAGE_FORMAT_PNG) {}
+
+//     bool Load(const TCHAR * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_PNG);}
+//     bool Save(const TCHAR * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_PNG);}
+       bool Decode(CxFile * hFile);
+       bool Decode(FILE *hFile) { CxIOFile file(hFile); return Decode(&file); }
+
+#if CXIMAGE_SUPPORT_ENCODE
+       bool Encode(CxFile * hFile);
+       bool Encode(FILE *hFile) { CxIOFile file(hFile); return Encode(&file); }
+#endif // CXIMAGE_SUPPORT_ENCODE
+
+protected:
+       void ima_png_error(png_struct *png_ptr, char *message);
+       void expand2to4bpp(BYTE* prow);
+
+       static void PNGAPI user_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+       {
+               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);
+               if (hFile == NULL || hFile->Read(data,1,length) != length) png_error(png_ptr, "Read Error");
+       }
+
+       static void PNGAPI user_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
+       {
+               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);
+               if (hFile == NULL || hFile->Write(data,1,length) != length) png_error(png_ptr, "Write Error");
+       }
+
+       static void PNGAPI user_flush_data(png_structp png_ptr)
+       {
+               CxFile* hFile = (CxFile*)png_get_io_ptr(png_ptr);
+               if (hFile == NULL || !hFile->Flush()) png_error(png_ptr, "Flush Error");
+       }
+
+    static void PNGAPI user_error_fn(png_structp png_ptr,png_const_charp error_msg)
+       {
+               strncpy((char*)png_ptr->error_ptr,error_msg,255);
+               longjmp(png_ptr->jmpbuf, 1);
+       }
+};
+
+#endif
+
+#endif