-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathicc_helfer.h
213 lines (186 loc) · 8.06 KB
/
icc_helfer.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
/*
* ICC Examin ist eine ICC Profil Betrachter
*
* Copyright (C) 2004-2016 Kai-Uwe Behrmann
*
* Autor: Kai-Uwe Behrmann <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* -----------------------------------------------------------------------------
*
* ICC helpers
*
*/
// Date: Mai 2004
#ifndef ICC_HELFER_H
#define ICC_HELFER_H
#include <icc34.h>
#include "icc_utils.h"
#include "icc_icc.h"
#include "icc_helfer_time.h"
#include "icc_list.h"
#include <string>
#include <stddef.h> // size_t
// file macros / partitialy from config.h
#ifdef WIN32
#define ICC_DIR_SEPARATOR_C '\\'
#define ICC_DIR_SEPARATOR "\\"
#define PATH_SHELLSTRING ""
#define my_uint64_t unsigned long long
#else
#define ICC_DIR_SEPARATOR_C '/'
#define ICC_DIR_SEPARATOR "/"
#define PATH_SHELLSTRING "export PATH=$PATH:" PREFIX "/bin:~/bin; "
#include <stdint.h>
#define my_uint64_t uint64_t
#endif
#if HAVE_FLTK
#include <FL/Fl_Widget.H>
// in icc_helfer_fltk.cpp
void dbgFltkEvents ( int event);
std::string dbgFltkEvent ( int event);
void fl_delayed_redraw ( void *Fl_Widget);
float getScale ( );
#endif
// internal functions
const char* cp_nchar (char* text, int n);
void * myAllocFunc( size_t size );
void myDeAllocFunc( void * buf );
void oyStrAdd( std::string & text, const char * add );
// helper functions
// ICC helpers defined in icc_helfer.cpp
icUInt16Number icValue (icUInt16Number val);
icUInt32Number icValue (icUInt32Number val);
my_uint64_t icValue (icUInt64Number val);
double icSFValue (icS15Fixed16Number val);
double icUFValue (icU16Fixed16Number val);
double icUI16Value (icUInt16Number val);
icS15Fixed16Number icValueSF (double val);
icU16Fixed16Number icValueUF (double val);
icUInt16Number icValueUI16(double val);
icInt16Number icValue (icInt16Number val);
icInt32Number icValue (icInt32Number val);
int icValue (icInt64Number val);
icColorSpaceSignature icValue (icColorSpaceSignature val);
icPlatformSignature icValue (icPlatformSignature val);
icProfileClassSignature icValue (icProfileClassSignature val);
icTagSignature icValue (icTagSignature val);
icTagTypeSignature icValue (icTagTypeSignature val);
icTechnologySignature icValue (icTechnologySignature val);
icStandardObserver icValue (icStandardObserver val);
icMeasurementGeometry icValue (icMeasurementGeometry);
icMeasurementFlare icValue (icMeasurementFlare);
icIlluminant icValue (icIlluminant);
void icValueXYZ(icXYZNumber*, double X, double Y, double Z);
const double* XYZto_xyY (double* XYZ);
void XYZto_xyY (ICClist<double> & XYZxyY);
void xyYto_XYZ (ICClist<double> & xyYXYZ);
std::string renderingIntentName ( int intent);
int getColorSpaceChannels(icColorSpaceSignature color);
icColorSpaceSignature getColorSpaceGeneric( int channels );
std::string getColorSpaceName ( icColorSpaceSignature color);
ICClist<std::string> getChannelNamesShort( icColorSpaceSignature color);
ICClist<std::string> getChannelNames( icColorSpaceSignature color);
std::string getDeviceClassName ( icProfileClassSignature cl);
std::string getPlatformName ( icPlatformSignature platform);
std::string getSigTagName( icTagSignature sig );
std::string getSigTagDescription( icTagSignature sig );
std::string getSigTypeName( icTagTypeSignature sig );
std::string getSigTechnology( icTechnologySignature sig );
std::string getChromaticityColorantType( int type );
std::string getIlluminant( icIlluminant illu );
std::string getStandardObserver( icStandardObserver obsv );
std::string getMeasurementGeometry( icMeasurementGeometry measgeo );
std::string getMeasurementFlare( icMeasurementFlare flare );
std::string printDatum( icDateTimeNumber date );
namespace icc_examin_ns {
// Fl_Thread's lock / release
void lock(const char *file, int line);
void unlock(void *widget, const char *file, int line);
void wait (double sekunden, int update_ui);
extern int (*waitFunc)(void);
// for debugging
extern int icc_thread_lock_zaehler_;
extern Fl_Thread icc_thread_lock_besitzer_;
#if defined(__APPLE__)
std::string holeBundleResource (const char* Dateiname_ohne_Endung,
const char* Endung);
#endif
}
#define doLocked_m( a, widget ) \
icc_examin_ns::lock(__FILE__,__LINE__); \
a; \
icc_examin_ns::unlock( widget, __FILE__,__LINE__);
// displaying
enum {
oyFORMAT_BIN,
oyFORMAT_HEX
};
std::string zeig_bits_bin ( const void * mem,
int size,
int type);
// file I/O
char* ladeDatei ( std::string dateiname,
size_t *size );
void saveMemToFile ( const char *filename,
const char *block,
size_t size );
#include "icc_speicher.h"
Speicher dateiNachSpeicher ( const std::string & dateiname );
void dateiNachSpeicher ( Speicher & s,
const std::string & dateiname );
void speicherNachDatei ( std::string & dateiname,
Speicher & s );
double holeDateiModifikationsZeit ( const char *fullFileName );
// file helpers
const char* dateiName(const char* name);
const char* dateiName(std::string name);
std::string tempFileName ();
// common
char* getExecPath ( const char *filename );
char* findApplication ( const char * app_name );
void setI18N ( const char *exename );
// text helper
namespace icc_parser {
extern const char *alnum;
extern const char *alpha;
extern const char *numerisch;
extern const char *ziffer;
extern const char *leer_zeichen;
int suchenErsetzen ( std::string &text,
std::string &suchen,
std::string &ersetzen,
std::string::size_type pos );
int suchenErsetzen ( std::string &text,
const char *suchen,
const char *ersetzen,
std::string::size_type pos );
#ifndef ICC_EXTERN
ICClist<std::string> zeilenNachVector (std::string &text);
std::string::size_type sucheWort ( std::string &text,
std::string wort,
std::string::size_type pos );
#endif // ICC_EXTERN
struct ZifferWort {
std::pair<bool,std::string> wort;
std::pair<bool,double> zahl;
std::pair<bool,int> ganz_zahl;
};
ICClist<ZifferWort> unterscheideZiffernWorte ( std::string &zeile,
bool anfuehrungsstriche_setzen,
const char *trennzeichen );
}
#endif //ICC_HELFER_H