1 2 //--------------------------------------------------------------------------------- 3 // 4 // Little Color Management System 5 // Copyright (c) 1998-2020 Marti Maria Saguer 6 // 7 // Permission is hereby granted, free of charge, to any person obtaining 8 // a copy of this software and associated documentation files (the "Software"), 9 // to deal in the Software without restriction, including without limitation 10 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 // and/or sell copies of the Software, and to permit persons to whom the Software 12 // is furnished to do so, subject to the following conditions: 13 // 14 // The above copyright notice and this permission notice shall be included in 15 // all copies or substantial portions of the Software. 16 // 17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 19 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 // 25 //--------------------------------------------------------------------------------- 26 27 #ifndef _lcms_utils_h 28 29 // Deal with Microsoft's attempt at deprecating C standard runtime functions 30 #ifdef _MSC_VER 31 # if (_MSC_VER >= 1400) 32 # ifndef _CRT_SECURE_NO_DEPRECATE 33 # define _CRT_SECURE_NO_DEPRECATE 34 # endif 35 # ifndef _CRT_SECURE_NO_WARNINGS 36 # define _CRT_SECURE_NO_WARNINGS 37 # endif 38 # endif 39 #endif 40 41 #include "lcms2.h" 42 43 #include <string.h> 44 #include <stdarg.h> 45 #include <ctype.h> 46 #include <stdio.h> 47 #include <stdlib.h> 48 #include <ctype.h> 49 #include <math.h> 50 #include <wchar.h> 51 52 // Avoid warnings 53 54 #define UTILS_UNUSED_PARAMETER(x) ((void)x) 55 56 // Init the utility functions 57 58 void InitUtils(const char* PName); 59 60 // Fatal Error (print the message and exit(1))--------------------------------------------- 61 62 extern int Verbose; 63 64 void FatalError(const char *frm, ...); 65 66 // xgetopt() interface ------------------------------------------------------------- 67 68 extern int xoptind; 69 extern char *xoptarg; 70 71 int xgetopt(int argc, char *argv[], char *optionS); 72 73 // The stock profile utility ------------------------------------------------------- 74 75 cmsHPROFILE OpenStockProfile(cmsContext ContextID, const char* File); 76 77 // The print info utility ---------------------------------------------------------- 78 79 void PrintProfileInformation(cmsHPROFILE h); 80 81 // --------------------------------------------------------------------------------- 82 83 void PrintRenderingIntents(void); 84 void PrintBuiltins(void); 85 86 // --------------------------------------------------------------------------------- 87 88 cmsBool SaveMemoryBlock(const cmsUInt8Number* Buffer, cmsUInt32Number dwLen, const char* Filename); 89 90 // --------------------------------------------------------------------------------- 91 92 // Return a pixel type on depending on the number of channels 93 int PixelTypeFromChanCount(int ColorChannels); 94 95 // ------------------------------------------------------------------------------ 96 97 // Return number of channels of pixel type 98 int ChanCountFromPixelType(int ColorChannels); 99 100 #define _lcms_utils_h 101 #endif 102