Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1990-1993 Microsoft Corporation
  3. Module Name:
  4. halftone.c
  5. Abstract:
  6. This module contains data and function to validate the COLORADJUSTMENT
  7. Author:
  8. 27-Oct-1995 Fri 15:48:17 created -by- Daniel Chou (danielc)
  9. [Environment:]
  10. GDI Device Driver - Plotter.
  11. [Notes:]
  12. Revision History:
  13. --*/
  14. #ifdef NTGDIKM
  15. #include <stddef.h>
  16. #include <stdarg.h>
  17. #include <windef.h>
  18. #include <wingdi.h>
  19. #include <winddi.h>
  20. #else
  21. #include <stddef.h>
  22. #include <windows.h>
  23. #include <winddi.h>
  24. #endif
  25. DEVHTINFO DefDevHTInfo = {
  26. HT_FLAG_HAS_BLACK_DYE,
  27. HT_PATSIZE_6x6_M,
  28. 0, // DevPelsDPI
  29. {
  30. { 6380, 3350, 0 }, // xr, yr, Yr
  31. { 2345, 6075, 0 }, // xg, yg, Yg
  32. { 1410, 932, 0 }, // xb, yb, Yb
  33. { 2000, 2450, 0 }, // xc, yc, Yc Y=0=HT default
  34. { 5210, 2100, 0 }, // xm, ym, Ym
  35. { 4750, 5100, 0 }, // xy, yy, Yy
  36. { 3127, 3290, 0 }, // xw, yw, Yw=0=default
  37. 12500, // R gamma
  38. 12500, // G gamma
  39. 12500, // B gamma, 12500=Default
  40. 585, 120, // M/C, Y/C
  41. 0, 0, // C/M, Y/M
  42. 0, 10000 // C/Y, M/Y 10000=default
  43. }
  44. };
  45. COLORADJUSTMENT DefHTClrAdj = {
  46. sizeof(COLORADJUSTMENT),
  47. 0,
  48. ILLUMINANT_DEVICE_DEFAULT,
  49. 10000,
  50. 10000,
  51. 10000,
  52. REFERENCE_BLACK_MIN,
  53. REFERENCE_WHITE_MAX,
  54. 0,
  55. 0,
  56. 0,
  57. 0
  58. };
  59. #define ADJ_CA(p,a,i,x) if ((p->a<i)||(p->a>x)){Ok=FALSE;p->a=DefHTClrAdj.a;}
  60. BOOL
  61. ValidateColorAdj(
  62. PCOLORADJUSTMENT pca
  63. )
  64. /*++
  65. Routine Description:
  66. This function validate and adjust the invalid color adjustment fields
  67. Arguments:
  68. pca - Pointer to the COLORADJUSTMENT data structure
  69. Return Value:
  70. TRUE if everything in the range FALSE otherwise
  71. Author:
  72. 02-Dec-1993 Thu 22:45:59 created -by- Daniel Chou (danielc)
  73. Revision History:
  74. 02-Apr-1995 Sun 11:19:04 updated -by- Daniel Chou (danielc)
  75. Update the RGB_GAMMA_MIN/MAX checking and make default to 1.0
  76. --*/
  77. {
  78. BOOL Ok = TRUE;
  79. //
  80. // Validate the color adjustment
  81. //
  82. if ((pca->caSize != sizeof(COLORADJUSTMENT)) ||
  83. (pca->caFlags & ~(CA_NEGATIVE | CA_LOG_FILTER))) {
  84. *pca = DefHTClrAdj;
  85. return(FALSE);
  86. }
  87. ADJ_CA(pca, caIlluminantIndex, 0, ILLUMINANT_MAX_INDEX);
  88. ADJ_CA(pca, caRedGamma, RGB_GAMMA_MIN, RGB_GAMMA_MAX );
  89. ADJ_CA(pca, caGreenGamma, RGB_GAMMA_MIN, RGB_GAMMA_MAX );
  90. ADJ_CA(pca, caBlueGamma, RGB_GAMMA_MIN, RGB_GAMMA_MAX );
  91. ADJ_CA(pca, caReferenceBlack, 0, REFERENCE_BLACK_MAX );
  92. ADJ_CA(pca, caReferenceWhite, REFERENCE_WHITE_MIN,10000 );
  93. ADJ_CA(pca, caContrast, COLOR_ADJ_MIN, COLOR_ADJ_MAX );
  94. ADJ_CA(pca, caBrightness, COLOR_ADJ_MIN, COLOR_ADJ_MAX );
  95. ADJ_CA(pca, caColorfulness, COLOR_ADJ_MIN, COLOR_ADJ_MAX );
  96. ADJ_CA(pca, caRedGreenTint, COLOR_ADJ_MIN, COLOR_ADJ_MAX );
  97. return(Ok);
  98. }