DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_orientation.h00001 /*****************************************************************************/ 00002 // Copyright 2006 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/workarea/stern/camera_raw/dng_sdk/source/dng_orientation.h#4 $ */ 00010 /* $DateTime: 2006/06/15 00:18:03 $ */ 00011 /* $Change: 232231 $ */ 00012 /* $Author: stern $ */ 00013 00014 /******************************************************************************/ 00015 00016 #ifndef __dng_orientation__ 00017 #define __dng_orientation__ 00018 00019 /******************************************************************************/ 00020 00021 #include "dng_types.h" 00022 00023 /******************************************************************************/ 00024 00025 class dng_orientation 00026 { 00027 00028 private: 00029 00030 // We internally use an orientation encoding ("Adobe") that is 00031 // different than the TIFF orientation encoding ("TIFF"). 00032 00033 enum 00034 { 00035 kNormal = 0, 00036 kRotate90CW = 1, 00037 kRotate180 = 2, 00038 kRotate90CCW = 3, 00039 kMirror = 4, 00040 kMirror90CW = 5, 00041 kMirror180 = 6, 00042 kMirror90CCW = 7, 00043 kUnknown = 8 00044 }; 00045 00046 uint32 fAdobeOrientation; 00047 00048 public: 00049 00050 dng_orientation () 00051 00052 : fAdobeOrientation (kNormal) 00053 00054 { 00055 } 00056 00057 void SetAdobe (uint32 adobe) 00058 { 00059 fAdobeOrientation = adobe; 00060 } 00061 00062 uint32 GetAdobe () const 00063 { 00064 return fAdobeOrientation; 00065 } 00066 00067 void SetTIFF (uint32 tiff); 00068 00069 uint32 GetTIFF () const; 00070 00071 static dng_orientation AdobeToDNG (uint32 adobe) 00072 { 00073 00074 dng_orientation result; 00075 00076 result.SetAdobe (adobe); 00077 00078 return result; 00079 00080 } 00081 00082 static dng_orientation TIFFtoDNG (uint32 tiff) 00083 { 00084 00085 dng_orientation result; 00086 00087 result.SetTIFF (tiff); 00088 00089 return result; 00090 00091 } 00092 00093 static dng_orientation Normal () 00094 { 00095 return AdobeToDNG (kNormal); 00096 } 00097 00098 static dng_orientation Rotate90CW () 00099 { 00100 return AdobeToDNG (kRotate90CW); 00101 } 00102 00103 static dng_orientation Rotate180 () 00104 { 00105 return AdobeToDNG (kRotate180); 00106 } 00107 00108 static dng_orientation Rotate90CCW () 00109 { 00110 return AdobeToDNG (kRotate90CCW); 00111 } 00112 00113 static dng_orientation Mirror () 00114 { 00115 return AdobeToDNG (kMirror); 00116 } 00117 00118 static dng_orientation Mirror90CW () 00119 { 00120 return AdobeToDNG (kMirror90CW); 00121 } 00122 00123 static dng_orientation Mirror180 () 00124 { 00125 return AdobeToDNG (kMirror180); 00126 } 00127 00128 static dng_orientation Mirror90CCW () 00129 { 00130 return AdobeToDNG (kMirror90CCW); 00131 } 00132 00133 static dng_orientation Unknown () 00134 { 00135 return AdobeToDNG (kUnknown); 00136 } 00137 00138 bool IsValid () const 00139 { 00140 return fAdobeOrientation < kUnknown; 00141 } 00142 00143 bool NotValid () const 00144 { 00145 return !IsValid (); 00146 } 00147 00148 bool FlipD () const; 00149 00150 bool FlipH () const; 00151 00152 bool FlipV () const; 00153 00154 bool operator== (const dng_orientation &b) const 00155 { 00156 return fAdobeOrientation == b.fAdobeOrientation; 00157 } 00158 00159 bool operator!= (const dng_orientation &b) const 00160 { 00161 return !(*this == b); 00162 } 00163 00164 dng_orientation operator- () const; 00165 00166 dng_orientation operator+ (const dng_orientation &b) const; 00167 00168 dng_orientation operator- (const dng_orientation &b) const 00169 { 00170 return (*this) + (-b); 00171 } 00172 00173 void operator+= (const dng_orientation &b) 00174 { 00175 *this = *this + b; 00176 } 00177 00178 void operator-= (const dng_orientation &b) 00179 { 00180 *this = *this - b; 00181 } 00182 00183 }; 00184 00185 /******************************************************************************/ 00186 00187 #endif 00188 00189 /******************************************************************************/ |