utils.h 3.3 KB

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