Leaked source code of windows server 2003
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.

153 lines
3.4 KiB

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