]> Creatis software - clitk.git/blobdiff - utilities/CxImage/ximaraw.h
cosmetic
[clitk.git] / utilities / CxImage / ximaraw.h
index 15b938d85895fecde45ffe9b30ea415332f823ff..c99d1c4104b7cd0f27ca1fe1d20fb9d4ca5c669e 100644 (file)
-/*\r
- * File:       ximaraw.h\r
- * Purpose:    RAW Image Class Loader and Writer\r
- */\r
-/* ==========================================================\r
- * CxImageRAW (c) May/2006 pdw63\r
- * For conditions of distribution and use, see copyright notice in ximage.h\r
- * Special thanks to David Coffin for dcraw without which this class would not exist\r
- *\r
- * libdcr (c) Dec/2007 Davide Pizzolato - www.xdp.it\r
- *\r
- * based on dcraw.c -- Dave Coffin's raw photo decoder\r
- * Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net\r
- * ==========================================================\r
- */\r
-#if !defined(__ximaRAW_h)\r
-#define __ximaRAW_h\r
-\r
-#include "ximage.h"\r
-\r
-#if CXIMAGE_SUPPORT_RAW\r
-\r
-extern "C" {\r
- #include "../raw/libdcr.h"\r
-}\r
-\r
-class CxImageRAW: public CxImage\r
-{\r
-\r
-public:\r
-       CxImageRAW(): CxImage(CXIMAGE_FORMAT_RAW) {}\r
-\r
-//     bool Load(const char * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_ICO);}\r
-//     bool Save(const char * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_ICO);}\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
-       enum CODEC_OPTION\r
-       {\r
-               DECODE_QUALITY_LIN = 0x00,\r
-               DECODE_QUALITY_VNG = 0x01,\r
-               DECODE_QUALITY_PPG = 0x02,\r
-               DECODE_QUALITY_AHD = 0x03,\r
-       }; \r
-\r
-protected:\r
-\r
-       class CxFileRaw\r
-       {\r
-       public:\r
-               CxFileRaw(CxFile* pFile,DCRAW *stream)\r
-               {\r
-                       stream->obj_ = pFile;\r
-\r
-                       ras_stream_CxFile.read_ = raw_sfile_read;\r
-                       ras_stream_CxFile.write_ = raw_sfile_write;\r
-                       ras_stream_CxFile.seek_ = raw_sfile_seek;\r
-                       ras_stream_CxFile.close_ = raw_sfile_close;\r
-                       ras_stream_CxFile.gets_ = raw_sfile_gets;\r
-                       ras_stream_CxFile.eof_ = raw_sfile_eof;\r
-                       ras_stream_CxFile.tell_ = raw_sfile_tell;\r
-                       ras_stream_CxFile.getc_ = raw_sfile_getc;\r
-                       ras_stream_CxFile.scanf_ = raw_sfile_scanf;\r
-\r
-                       stream->ops_ = &ras_stream_CxFile;\r
-\r
-               }\r
-\r
-               static int raw_sfile_read(dcr_stream_obj *obj, void *buf, int size, int cnt)\r
-               {       return ((CxFile*)obj)->Read(buf,size,cnt); }\r
-\r
-               static int raw_sfile_write(dcr_stream_obj *obj, void *buf, int size, int cnt)\r
-               {       return ((CxFile*)obj)->Write(buf,size,cnt); }\r
-\r
-               static long raw_sfile_seek(dcr_stream_obj *obj, long offset, int origin)\r
-               {       return ((CxFile*)obj)->Seek(offset,origin); }\r
-\r
-               static int raw_sfile_close(dcr_stream_obj *obj)\r
-               {       return 1; /*((CxFile*)obj)->Close();*/ }\r
-\r
-               static char* raw_sfile_gets(dcr_stream_obj *obj, char *string, int n)\r
-               {       return ((CxFile*)obj)->GetS(string,n); }\r
-\r
-               static int   raw_sfile_eof(dcr_stream_obj *obj)\r
-               {       return ((CxFile*)obj)->Eof(); }\r
-\r
-               static long  raw_sfile_tell(dcr_stream_obj *obj)\r
-               {       return ((CxFile*)obj)->Tell(); }\r
-\r
-               static int   raw_sfile_getc(dcr_stream_obj *obj)\r
-               {       return ((CxFile*)obj)->GetC(); }\r
-\r
-               static int   raw_sfile_scanf(dcr_stream_obj *obj,const char *format, void* output)\r
-               {       return ((CxFile*)obj)->Scanf(format, output); }\r
-\r
-       private:\r
-               dcr_stream_ops ras_stream_CxFile;\r
-       };\r
-};\r
-\r
-#endif\r
-\r
-#endif\r
+/*
+ * File:       ximaraw.h
+ * Purpose:    RAW Image Class Loader and Writer
+ */
+/* ==========================================================
+ * CxImageRAW (c) May/2006 pdw63
+ * For conditions of distribution and use, see copyright notice in ximage.h
+ * Special thanks to David Coffin for dcraw without which this class would not exist
+ *
+ * libdcr (c) Dec/2007 Davide Pizzolato - www.xdp.it
+ *
+ * based on dcraw.c -- Dave Coffin's raw photo decoder
+ * Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net
+ * ==========================================================
+ */
+#if !defined(__ximaRAW_h)
+#define __ximaRAW_h
+
+#include "ximage.h"
+
+#if CXIMAGE_SUPPORT_RAW
+
+extern "C" {
+ #include "../raw/libdcr.h"
+}
+
+class CxImageRAW: public CxImage
+{
+
+public:
+       CxImageRAW(): CxImage(CXIMAGE_FORMAT_RAW) {}
+
+//     bool Load(const char * imageFileName){ return CxImage::Load(imageFileName,CXIMAGE_FORMAT_ICO);}
+//     bool Save(const char * imageFileName){ return CxImage::Save(imageFileName,CXIMAGE_FORMAT_ICO);}
+       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
+
+       enum CODEC_OPTION
+       {
+               DECODE_QUALITY_LIN = 0x00,
+               DECODE_QUALITY_VNG = 0x01,
+               DECODE_QUALITY_PPG = 0x02,
+               DECODE_QUALITY_AHD = 0x03,
+       }; 
+
+protected:
+
+       class CxFileRaw
+       {
+       public:
+               CxFileRaw(CxFile* pFile,DCRAW *stream)
+               {
+                       stream->obj_ = pFile;
+
+                       ras_stream_CxFile.read_ = raw_sfile_read;
+                       ras_stream_CxFile.write_ = raw_sfile_write;
+                       ras_stream_CxFile.seek_ = raw_sfile_seek;
+                       ras_stream_CxFile.close_ = raw_sfile_close;
+                       ras_stream_CxFile.gets_ = raw_sfile_gets;
+                       ras_stream_CxFile.eof_ = raw_sfile_eof;
+                       ras_stream_CxFile.tell_ = raw_sfile_tell;
+                       ras_stream_CxFile.getc_ = raw_sfile_getc;
+                       ras_stream_CxFile.scanf_ = raw_sfile_scanf;
+
+                       stream->ops_ = &ras_stream_CxFile;
+
+               }
+
+               static int raw_sfile_read(dcr_stream_obj *obj, void *buf, int size, int cnt)
+               {       return ((CxFile*)obj)->Read(buf,size,cnt); }
+
+               static int raw_sfile_write(dcr_stream_obj *obj, void *buf, int size, int cnt)
+               {       return ((CxFile*)obj)->Write(buf,size,cnt); }
+
+               static long raw_sfile_seek(dcr_stream_obj *obj, long offset, int origin)
+               {       return ((CxFile*)obj)->Seek(offset,origin); }
+
+               static int raw_sfile_close(dcr_stream_obj *obj)
+               {       return 1; /*((CxFile*)obj)->Close();*/ }
+
+               static char* raw_sfile_gets(dcr_stream_obj *obj, char *string, int n)
+               {       return ((CxFile*)obj)->GetS(string,n); }
+
+               static int   raw_sfile_eof(dcr_stream_obj *obj)
+               {       return ((CxFile*)obj)->Eof(); }
+
+               static long  raw_sfile_tell(dcr_stream_obj *obj)
+               {       return ((CxFile*)obj)->Tell(); }
+
+               static int   raw_sfile_getc(dcr_stream_obj *obj)
+               {       return ((CxFile*)obj)->GetC(); }
+
+               static int   raw_sfile_scanf(dcr_stream_obj *obj,const char *format, void* output)
+               {       return ((CxFile*)obj)->Scanf(format, output); }
+
+       private:
+               dcr_stream_ops ras_stream_CxFile;
+       };
+};
+
+#endif
+
+#endif