-
Notifications
You must be signed in to change notification settings - Fork 4
/
Measure.h
254 lines (222 loc) · 12 KB
/
Measure.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2005-2011 Association Homecinema Francophone. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
//
// This file is subject to the terms of the GNU General Public License as
// published by the Free Software Foundation. A copy of this license is
// included with this software distribution in the file COPYING.htm. If you
// do not have a copy, you may obtain a copy by writing to the Free
// Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details
/////////////////////////////////////////////////////////////////////////////
// Author(s):
// François-Xavier CHABOUD
// Georges GALLERAND
/////////////////////////////////////////////////////////////////////////////
// Measure.h: interface for the CMeasure class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MEASURE_H__4A61BBE7_7779_4FCD_90B5_E9F22517DFBD__INCLUDED_)
#define AFX_MEASURE_H__4A61BBE7_7779_4FCD_90B5_E9F22517DFBD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Color.h"
#include "Sensors\Sensor.h"
#include "Generators\Generator.h"
#define DUPLGRAYLEVEL 0
#define DUPLNEARBLACK 1
#define DUPLNEARWHITE 2
#define DUPLPRIMARIESSAT 3
#define DUPLSECONDARIESSAT 4
#define DUPLPRIMARIESCOL 5
#define DUPLSECONDARIESCOL 6
#define DUPLCONTRAST 7
#define DUPLINFO 8
#define LUX_NOMEASURE 0
#define LUX_OK 1
#define LUX_CANCELED 2
class CMeasure : public CObject
{
public:
DECLARE_SERIAL(CMeasure) ;
protected:
CReferencesPropPage m_referencesPropertiesPage;
BOOL m_isModified;
CArray<CColor,CColor> m_primariesArray;
CArray<CColor,CColor> m_secondariesArray;
CArray<CColor,CColor> m_grayMeasureArray;
CArray<CColor,CColor> m_measurementsArray;
CColor m_OnOffBlack;
CColor m_OnOffWhite;
CColor m_PrimeWhite;
CColor m_AnsiBlack;
CColor m_AnsiWhite;
CArray<CColor,CColor> m_nearBlackMeasureArray;
CArray<CColor,CColor> m_nearWhiteMeasureArray;
CArray<CColor,CColor> m_redSatMeasureArray;
CArray<CColor,CColor> m_greenSatMeasureArray;
CArray<CColor,CColor> m_blueSatMeasureArray;
CArray<CColor,CColor> m_yellowSatMeasureArray;
CArray<CColor,CColor> m_cyanSatMeasureArray;
CArray<CColor,CColor> m_magentaSatMeasureArray;
CArray<CColor,CColor> m_cc24SatMeasureArray;
CArray<CColor,CColor> m_cc24SatMeasureArray_master;
CString m_infoStr;
CString m_CCStr;
public:
BOOL m_bIREScaleMode;
BOOL m_binMeasure;
BOOL bDisplayRT;
UINT m_bpreV10;
UINT m_NearWhiteClipCol;
UINT m_NMeasurements;
// Internal data used by background measures threads (not serialized)
public:
HANDLE m_hThread;
HANDLE m_hEventRun;
HANDLE m_hEventDone;
BOOL m_bTerminateThread;
BOOL m_bErrorOccurred;
int m_nBkMeasureStepCount;
int m_nBkMeasureStep;
ColorRGBDisplay m_clrToMeasure;
CSensor * m_pBkMeasureSensor;
CArray<CColor,int> * m_pBkMeasuredColor;
int m_nbMaxMeasurements;
public:
CMeasure();
virtual ~CMeasure();
virtual void Serialize(CArchive& archive);
void StartLuxMeasure ();
UINT GetLuxMeasure ( double * pValue );
void Copy(CMeasure * p,UINT nId);
BOOL MeasureGrayScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureCC24(CSensor *pSensor, CGenerator *pGenerator);
BOOL MeasureGrayScaleAndColors(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
CColor GetGray(int i) const;
void SetGray(int i,const CColor & aColor) {m_grayMeasureArray[i]=aColor; m_isModified=TRUE;}
int GetGrayScaleSize() const { return m_grayMeasureArray.GetSize(); }
void SetGrayScaleSize(int steps);
void SetIREScaleMode(BOOL bIRE);
CColor lastColor, previousColor;
CColor m_userBlack;
BOOL m_bOverRideBlack;
BOOL MeasureNearBlackScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
CColor GetNearBlack(int i) const;
void SetNearBlack(int i,const CColor & aColor) {m_nearBlackMeasureArray[i]=aColor; m_isModified=TRUE;}
int GetNearBlackScaleSize() const { return m_nearBlackMeasureArray.GetSize(); }
void SetNearBlackScaleSize(int steps);
BOOL MeasureNearWhiteScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
CColor GetNearWhite(int i) const;
void SetNearWhite(int i,const CColor & aColor) {m_nearWhiteMeasureArray[i]=aColor; m_isModified=TRUE;}
int GetNearWhiteScaleSize() const { return m_nearWhiteMeasureArray.GetSize(); }
void SetNearWhiteScaleSize(int steps);
BOOL MeasureRedSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureGreenSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureBlueSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureYellowSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureCyanSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureMagentaSatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureCC24SatScale(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
BOOL MeasureAllSaturationScales(CSensor *pSensor, CGenerator *pGenerator,BOOL bPrimaryOnly, CDataSetDoc *pDoc);
BOOL MeasurePrimarySecondarySaturationScales(CSensor *pSensor, CGenerator *pGenerator,BOOL bPrimaryOnly, CDataSetDoc *pDoc);
int GetSaturationSize() const { return m_redSatMeasureArray.GetSize(); }
int GetCC24MasterSaturationSize() const { return m_cc24SatMeasureArray_master.GetSize(); }
void SetSaturationSize(int steps);
CColor GetRedSat(int i) const;
void SetRedSat(int i,const CColor & aColor) {m_redSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetGreenSat(int i) const;
void SetGreenSat(int i,const CColor & aColor) {m_greenSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetBlueSat(int i) const;
void SetBlueSat(int i,const CColor & aColor) {m_blueSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetYellowSat(int i) const;
void SetYellowSat(int i,const CColor & aColor) {m_yellowSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetCyanSat(int i) const;
void SetCyanSat(int i,const CColor & aColor) {m_cyanSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetMagentaSat(int i) const;
void SetMagentaSat(int i,const CColor & aColor) {m_magentaSatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetCC24Sat(int i);
void SetCC24Sat(int i,const CColor & aColor) {m_cc24SatMeasureArray[i]=aColor; m_isModified=TRUE; }
CColor GetCC24MasterSat(int i) const;
void SetCC24MasterSat(int i,const CColor & aColor) {m_cc24SatMeasureArray_master[i]=aColor; m_isModified=TRUE; }
CString GetCCStr() const;
BOOL MeasurePrimaries(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
CColor GetPrimary(int i) const;
CColor GetRedPrimary() const;
CColor GetGreenPrimary() const;
CColor GetBluePrimary() const;
void SetRedPrimary(const CColor & aColor) { m_primariesArray[0]=aColor; m_isModified=TRUE; }
void SetGreenPrimary(const CColor & aColor) { m_primariesArray[1]=aColor; m_isModified=TRUE; }
void SetBluePrimary(const CColor & aColor) { m_primariesArray[2]=aColor; m_isModified=TRUE; }
void SetPrimary(int i, const CColor & aColor) { m_primariesArray[i] = aColor; m_isModified=TRUE; }
BOOL MeasureSecondaries(CSensor *pSensor, CGenerator *pGenerator, CDataSetDoc *pDoc);
CColor GetSecondary(int i) const;
CColor GetYellowSecondary() const;
CColor GetCyanSecondary() const;
CColor GetMagentaSecondary() const;
void SetYellowSecondary(const CColor & aColor) { m_secondariesArray[0]=aColor; m_isModified=TRUE; }
void SetCyanSecondary(const CColor & aColor) { m_secondariesArray[1]=aColor; m_isModified=TRUE; }
void SetMagentaSecondary(const CColor & aColor) { m_secondariesArray[2]=aColor; m_isModified=TRUE; }
void SetSecondary(int i, const CColor & aColor) { m_secondariesArray[i] = aColor; m_isModified=TRUE; }
CColor GetAnsiBlack() const;
CColor GetAnsiWhite() const;
void SetAnsiBlack(const CColor & aColor) { m_AnsiBlack=aColor; m_isModified=TRUE; }
void SetAnsiWhite(const CColor & aColor) { m_AnsiWhite=aColor; m_isModified=TRUE; }
CColor GetOnOffBlack() const;
CColor GetOnOffWhite() const;
CColor GetPrimeWhite() const; //white reference for pseudo-color spaces
void SetOnOffBlack(const CColor & aColor) { m_OnOffBlack=aColor; m_isModified=TRUE; }
void SetOnOffWhite(const CColor & aColor) { m_OnOffWhite=aColor; m_isModified=TRUE; }
void SetPrimeWhite(const CColor & aColor) { m_PrimeWhite=aColor; m_isModified=TRUE; }
BOOL MeasureContrast(CSensor *pSensor, CGenerator *pGenerator);
double GetOnOffContrast ();
double GetAnsiContrast ();
double GetContrastMinLum ();
double GetContrastMaxLum ();
void DeleteContrast ();
BOOL AddMeasurement(CSensor *pSensor, CGenerator *pGenerator, CGenerator::MeasureType MT, int isPrimary, int last_minCol, int m_d);
CColor GetMeasurement(int i) const;
void SetMeasurements(int i,const CColor & aColor) {m_measurementsArray[i]=aColor; m_isModified=TRUE; }
void AppendMeasurements(const CColor & aColor, int isPrimary, int last_minCol);
int GetMeasurementsSize() const { return m_measurementsArray.GetSize(); }
void SetMeasurementsSize(int size) { m_measurementsArray.SetSize(size); m_isModified=TRUE; }
void DeleteMeasurements(int i,int count) { m_measurementsArray.RemoveAt(i,count); m_isModified=TRUE; }
void InsertMeasurement(int i, CColor & aColor) { m_measurementsArray.InsertAt(i,aColor); m_isModified=TRUE; }
void FreeMeasurementAppended(int isPrimary, int last_minCol);
CString GetInfoString() const { return m_infoStr+m_CCStr; }
void SetInfoString(CString & aStr) { m_infoStr = aStr; }
CColor GetRefPrimary(int i) const;
CColor GetRefSecondary(int i) const;
CColor GetRefSat(int i, double sat_percent, bool special) const;
void GetRefCC24Sat(int i, CColor &color) const;
BOOL IsModified() { return m_isModified; }
void ApplySensorAdjustmentMatrix(const Matrix & matrixAdjustment);
BOOL WaitForDynamicIris ( BOOL bIgnoreEscape = FALSE, CDataSetDoc *pDoc = NULL );
BOOL CheckBlackOverride ( );
void UpdateViews ( CDataSetDoc *pDoc = NULL, int Sequence = 0 );
void UpdateTstWnd ( CDataSetDoc *pDoc, int Sequence );
int m_currentIndex, m_currentSequence, displaymode;
HANDLE InitBackgroundMeasures ( CSensor *pSensor, int nSteps );
BOOL BackgroundMeasureColor ( int nCurStep, const ColorRGBDisplay& aRGBValue );
void CancelBackgroundMeasures ();
BOOL ValidateBackgroundGrayScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundNearBlack ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundNearWhite ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundPrimaries ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundSecondaries ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundRedSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundGreenSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundBlueSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundYellowSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundCyanSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundMagentaSatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundCC24SatScale ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundGrayScaleAndColors ( BOOL bUseLuxValues, double * pLuxValues );
BOOL ValidateBackgroundSingleMeasurement ( BOOL bUseLuxValues, double * pLuxValues );
};
#endif // !defined(AFX_MEASURE_H__4A61BBE7_7779_4FCD_90B5_E9F22517DFBD__INCLUDED_)