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_xy_coord.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_xy_coord.h#3 $ */ 00010 /* $DateTime: 2006/03/19 21:45:16 $ */ 00011 /* $Change: 211775 $ */ 00012 /* $Author: stern $ */ 00013 00014 /*****************************************************************************/ 00015 00016 #ifndef __dng_xy_coord__ 00017 #define __dng_xy_coord__ 00018 00019 /*****************************************************************************/ 00020 00021 #include "dng_classes.h" 00022 #include "dng_types.h" 00023 00024 /*****************************************************************************/ 00025 00026 class dng_xy_coord 00027 { 00028 00029 public: 00030 00031 real64 x; 00032 real64 y; 00033 00034 public: 00035 00036 dng_xy_coord () 00037 : x (0.0) 00038 , y (0.0) 00039 { 00040 } 00041 00042 dng_xy_coord (real64 xx, real64 yy) 00043 : x (xx) 00044 , y (yy) 00045 { 00046 } 00047 00048 void Clear () 00049 { 00050 x = 0.0; 00051 y = 0.0; 00052 } 00053 00054 bool IsValid () const 00055 { 00056 return x > 0.0 && 00057 y > 0.0; 00058 } 00059 00060 bool NotValid () const 00061 { 00062 return !IsValid (); 00063 } 00064 00065 bool operator== (const dng_xy_coord &coord) const 00066 { 00067 return coord.x == x && 00068 coord.y == y; 00069 } 00070 00071 bool operator!= (const dng_xy_coord &coord) const 00072 { 00073 return !(*this == coord); 00074 } 00075 00076 }; 00077 00078 /*****************************************************************************/ 00079 00080 inline dng_xy_coord operator+ (const dng_xy_coord &A, 00081 const dng_xy_coord &B) 00082 { 00083 00084 dng_xy_coord C; 00085 00086 C.x = A.x + B.x; 00087 C.y = A.y + B.y; 00088 00089 return C; 00090 00091 } 00092 00093 /*****************************************************************************/ 00094 00095 inline dng_xy_coord operator- (const dng_xy_coord &A, 00096 const dng_xy_coord &B) 00097 { 00098 00099 dng_xy_coord C; 00100 00101 C.x = A.x - B.x; 00102 C.y = A.y - B.y; 00103 00104 return C; 00105 00106 } 00107 00108 /*****************************************************************************/ 00109 00110 inline dng_xy_coord operator* (real64 scale, 00111 const dng_xy_coord &A) 00112 { 00113 00114 dng_xy_coord B; 00115 00116 B.x = A.x * scale; 00117 B.y = A.y * scale; 00118 00119 return B; 00120 00121 } 00122 00123 /******************************************************************************/ 00124 00125 inline real64 operator* (const dng_xy_coord &A, 00126 const dng_xy_coord &B) 00127 { 00128 00129 return A.x * B.x + 00130 A.y * B.y; 00131 00132 } 00133 00134 /*****************************************************************************/ 00135 00136 // Standard xy coordinate constants. 00137 00138 inline dng_xy_coord StdA_xy_coord () 00139 { 00140 return dng_xy_coord (0.4476, 0.4074); 00141 } 00142 00143 inline dng_xy_coord D50_xy_coord () 00144 { 00145 return dng_xy_coord (0.3457, 0.3585); 00146 } 00147 00148 inline dng_xy_coord D55_xy_coord () 00149 { 00150 return dng_xy_coord (0.3324, 0.3474); 00151 } 00152 00153 inline dng_xy_coord D65_xy_coord () 00154 { 00155 return dng_xy_coord (0.3127, 0.3290); 00156 } 00157 00158 inline dng_xy_coord D75_xy_coord () 00159 { 00160 return dng_xy_coord (0.2990, 0.3149); 00161 } 00162 00163 /*****************************************************************************/ 00164 00165 // Convert between xy coordinates and XYZ coordinates. 00166 00167 dng_xy_coord XYZtoXY (const dng_vector_3 &coord); 00168 00169 dng_vector_3 XYtoXYZ (const dng_xy_coord &coord); 00170 00171 /*****************************************************************************/ 00172 00173 // Returns the ICC XYZ profile connection space white point. 00174 00175 dng_xy_coord PCStoXY (); 00176 00177 dng_vector_3 PCStoXYZ (); 00178 00179 /*****************************************************************************/ 00180 00181 #endif 00182 00183 /*****************************************************************************/ |