summaryrefslogtreecommitdiff
path: root/gpr/source/lib/dng_sdk/dng_orientation.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpr/source/lib/dng_sdk/dng_orientation.h')
-rw-r--r--gpr/source/lib/dng_sdk/dng_orientation.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/gpr/source/lib/dng_sdk/dng_orientation.h b/gpr/source/lib/dng_sdk/dng_orientation.h
new file mode 100644
index 0000000..cb23adf
--- /dev/null
+++ b/gpr/source/lib/dng_sdk/dng_orientation.h
@@ -0,0 +1,189 @@
+/*****************************************************************************/
+// Copyright 2006 Adobe Systems Incorporated
+// All Rights Reserved.
+//
+// NOTICE: Adobe permits you to use, modify, and distribute this file in
+// accordance with the terms of the Adobe license agreement accompanying it.
+/*****************************************************************************/
+
+/* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_orientation.h#1 $ */
+/* $DateTime: 2012/05/30 13:28:51 $ */
+/* $Change: 832332 $ */
+/* $Author: tknoll $ */
+
+/******************************************************************************/
+
+#ifndef __dng_orientation__
+#define __dng_orientation__
+
+/******************************************************************************/
+
+#include "dng_types.h"
+
+/******************************************************************************/
+
+class dng_orientation
+ {
+
+ private:
+
+ // We internally use an orientation encoding ("Adobe") that is
+ // different than the TIFF orientation encoding ("TIFF").
+
+ uint32 fAdobeOrientation;
+
+ public:
+ enum
+ {
+ kNormal = 0,
+ kRotate90CW = 1,
+ kRotate180 = 2,
+ kRotate90CCW = 3,
+ kMirror = 4,
+ kMirror90CW = 5,
+ kMirror180 = 6,
+ kMirror90CCW = 7,
+ kUnknown = 8
+ };
+
+
+ dng_orientation ()
+
+ : fAdobeOrientation (kNormal)
+
+ {
+ }
+
+ void SetAdobe (uint32 adobe)
+ {
+ fAdobeOrientation = adobe;
+ }
+
+ uint32 GetAdobe () const
+ {
+ return fAdobeOrientation;
+ }
+
+ void SetTIFF (uint32 tiff);
+
+ uint32 GetTIFF () const;
+
+ static dng_orientation AdobeToDNG (uint32 adobe)
+ {
+
+ dng_orientation result;
+
+ result.SetAdobe (adobe);
+
+ return result;
+
+ }
+
+ static dng_orientation TIFFtoDNG (uint32 tiff)
+ {
+
+ dng_orientation result;
+
+ result.SetTIFF (tiff);
+
+ return result;
+
+ }
+
+ static dng_orientation Normal ()
+ {
+ return AdobeToDNG (kNormal);
+ }
+
+ static dng_orientation Rotate90CW ()
+ {
+ return AdobeToDNG (kRotate90CW);
+ }
+
+ static dng_orientation Rotate180 ()
+ {
+ return AdobeToDNG (kRotate180);
+ }
+
+ static dng_orientation Rotate90CCW ()
+ {
+ return AdobeToDNG (kRotate90CCW);
+ }
+
+ static dng_orientation Mirror ()
+ {
+ return AdobeToDNG (kMirror);
+ }
+
+ static dng_orientation Mirror90CW ()
+ {
+ return AdobeToDNG (kMirror90CW);
+ }
+
+ static dng_orientation Mirror180 ()
+ {
+ return AdobeToDNG (kMirror180);
+ }
+
+ static dng_orientation Mirror90CCW ()
+ {
+ return AdobeToDNG (kMirror90CCW);
+ }
+
+ static dng_orientation Unknown ()
+ {
+ return AdobeToDNG (kUnknown);
+ }
+
+ bool IsValid () const
+ {
+ return fAdobeOrientation < kUnknown;
+ }
+
+ bool NotValid () const
+ {
+ return !IsValid ();
+ }
+
+ bool FlipD () const;
+
+ bool FlipH () const;
+
+ bool FlipV () const;
+
+ bool operator== (const dng_orientation &b) const
+ {
+ return fAdobeOrientation == b.fAdobeOrientation;
+ }
+
+ bool operator!= (const dng_orientation &b) const
+ {
+ return !(*this == b);
+ }
+
+ dng_orientation operator- () const;
+
+ dng_orientation operator+ (const dng_orientation &b) const;
+
+ dng_orientation operator- (const dng_orientation &b) const
+ {
+ return (*this) + (-b);
+ }
+
+ void operator+= (const dng_orientation &b)
+ {
+ *this = *this + b;
+ }
+
+ void operator-= (const dng_orientation &b)
+ {
+ *this = *this - b;
+ }
+
+ };
+
+/******************************************************************************/
+
+#endif
+
+/******************************************************************************/