home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / exif.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-11-24  |  4.0 KB  |  147 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef __EXIF_H__
  8. #define __EXIF_H__
  9.  
  10. /**
  11.     exif.h
  12. */
  13.  
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <math.h>
  17. #include <time.h>
  18.  
  19. #include "qstring.h"
  20. #include "qfile.h"
  21. #include "qimage.h"
  22.  
  23. typedef enum {
  24.     READ_EXIF = 1,
  25.     READ_IMAGE = 2,
  26.     READ_ALL = 3
  27. }ReadMode_t;
  28.  
  29. //--------------------------------------------------------------------------
  30. // This structure is used to store jpeg file sections in memory.
  31. /*
  32. typedef struct
  33. {
  34.     uchar *  Data;
  35.     int      Type;
  36.     unsigned Size;
  37. }
  38. Section_t;
  39. */
  40. typedef unsigned char uchar;
  41.  
  42. class TagTable
  43. {
  44.     public:
  45.         TagTable ( unsigned short t, const char* d ) : Tag ( t ), Desc ( d ) {}
  46.         unsigned short Tag;
  47.         const char*const Desc;
  48. };
  49.  
  50. #define MAX_SECTIONS 60
  51. #define PSEUDO_IMAGE_MARKER 0x123; // Extra value.
  52.  
  53. class ExifData
  54. {
  55. //        Section_t Sections[MAX_SECTIONS];
  56.         QString CameraMake;
  57.         QString CameraModel;
  58.         QString DateTime;
  59.         int   Orientation;
  60.         int   Height, Width;
  61.         int   ExifImageLength, ExifImageWidth;
  62.         int   IsColor;
  63.         int   Process;
  64.         int   FlashUsed;
  65.         float FocalLength;
  66.         float ExposureTime;
  67.         float ApertureFNumber;
  68.         float Distance;
  69.         int    Whitebalance;
  70.         int    MeteringMode;
  71.         float CCDWidth;
  72.         float ExposureBias;
  73.         int   ExposureProgram;
  74.         int   ISOequivalent;
  75.         int   CompressionLevel;
  76.         QString UserComment;
  77.         QString Comment;
  78.         int recurseLevel;
  79.         unsigned char * LastExifRefd;
  80.         int ExifSettingsLength;
  81.         double FocalplaneXRes;
  82.         double FocalplaneUnits;
  83.         int MotorolaOrder;
  84.  
  85.         int getch ( QFile &infile );
  86.         int ReadJpegSections ( QFile & infile, ReadMode_t ReadMode );
  87.         void DiscardData ( void );
  88.         int Get16u ( void * Short );
  89.         int Get32s ( void * Long );
  90.         unsigned Get32u ( void * Long );
  91.         double ConvertAnyFormat ( void * ValuePtr, int Format );
  92.         void ProcessExifDir ( unsigned char * DirStart, unsigned char * OffsetBase, unsigned ExifLength );
  93.         void process_COM ( const uchar * Data, int length );
  94.         void process_SOFn ( const uchar * Data, int marker );
  95.         int Get16m ( const void * Short );
  96.         void process_EXIF ( unsigned char * CharBuf, unsigned int length );
  97.         int Exif2tm ( struct tm * timeptr, char * ExifTime );
  98.  
  99.     public:
  100.         ExifData();
  101.         bool scan ( const QString & );
  102.         QString getCameraMake() { return CameraMake; }
  103.         QString getCameraModel() { return CameraModel; }
  104.         QString getDateTime() { return DateTime; }
  105.         int getOrientation() { return Orientation; }
  106.         int getHeight() { return Height; }
  107.         int getWidth() { return Width; }
  108.         int getIsColor() { return IsColor; }
  109.         int getProcess() { return Process; }
  110.         int getFlashUsed() { return FlashUsed; }
  111.         float getFocalLength() { return FocalLength; }
  112.         float getExposureTime() { return ExposureTime; }
  113.         float getApertureFNumber() { return ApertureFNumber; }
  114.         float getDistance() { return Distance; }
  115.         int getWhitebalance() { return Whitebalance; }
  116.         int getMeteringMode() { return MeteringMode; }
  117.         float getCCDWidth() { return CCDWidth; }
  118.         float getExposureBias() { return ExposureBias; }
  119.         int getExposureProgram() { return ExposureProgram; }
  120.         int getISOequivalent() { return ISOequivalent; }
  121.         int getCompressionLevel() { return CompressionLevel; }
  122.         QString getUserComment() { return UserComment; }
  123.         QString getComment() { return Comment; }
  124.         QImage getThumbnail();
  125.         bool isThumbnailSane();
  126.         bool isNullThumbnail() { return !isThumbnailSane(); }
  127.         bool exifDataValid;
  128.         QImage Thumbnail;
  129. };
  130.  
  131. class FatalError
  132. {
  133.         const char* ex;
  134.     public:
  135.         FatalError ( const char* s ) { ex = s; }
  136.         void debug_print() const { qDebug ( "exception: " ); }
  137. };
  138.  
  139. extern TagTable ProcessTable[];
  140.  
  141. //--------------------------------------------------------------------------
  142. // Define comment writing code, impelemented in setcomment.c
  143. extern int safe_copy_and_modify ( const char * original_filename, const char * comment );
  144.  
  145. #endif
  146.  
  147.