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.

107 lines
2.8 KiB

  1. #ifndef __AATEXT_HPP_
  2. #define __AATEXT_HPP_
  3. #define CT_LOOKUP 115
  4. // the max number of foreground virt pixels in a subpixel, 2x X 1y , no filtering
  5. #define CT_SAMPLE_NF 2
  6. // the number of distinct nonfiltered states in a whole pixel = 3 x 3 x 3 = 27
  7. // The indices coming from the rasterizer are in [0,26] range
  8. #define CT_MAX_NF ((CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1))
  9. // the max number of foreground virt pixels in a subpixel AFTER filtering, 6
  10. #define CT_SAMPLE_F 6
  11. // size of the storage table, basically 3^5 = 243.
  12. // The table does filtering and index computation (vector quantization) in one step.
  13. #define CT_STORAGE ((CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1) * (CT_SAMPLE_NF+1))
  14. class TextColorGammaTable
  15. {
  16. public:
  17. ARGB argb[256];
  18. ULONG gammaValue;
  19. public:
  20. TextColorGammaTable() {};
  21. void CreateTextColorGammaTable(const GpColor * color, ULONG gammaValue, ULONG gsLevel);
  22. BYTE GetGammaTableIndexValue(BYTE grayscaleValue, ULONG gsLevel);
  23. inline ARGB GetGammaColorCorrection(BYTE grayscaleValue)
  24. {
  25. return argb[grayscaleValue];
  26. }
  27. };
  28. class DpOutputAntiAliasSolidColorSpan : public DpOutputSolidColorSpan
  29. {
  30. public:
  31. TextColorGammaTable textColorGammaTable;
  32. public:
  33. DpOutputAntiAliasSolidColorSpan(GpColor &color, DpScanBuffer * scan, ULONG gammaValue, ULONG gsLevel);
  34. virtual GpStatus OutputSpan(
  35. INT y,
  36. INT xMin,
  37. INT xMax
  38. )
  39. {
  40. return DpOutputSolidColorSpan::OutputSpan(y, xMin, xMax);
  41. }
  42. BOOL IsValid() const { return TRUE; }
  43. DpScanBuffer* GetScanBuffer(){ return DpOutputSolidColorSpan::Scan; }
  44. inline ARGB GetAASolidColor(ULONG grayscaleValue)
  45. {
  46. return DpOutputSolidColorSpan::Argb = textColorGammaTable.argb[grayscaleValue];
  47. }
  48. };
  49. // This class implements antialiasing for Text brush
  50. class DpOutputAntiAliasBrushOutputSpan : public DpOutputSpan
  51. {
  52. public:
  53. DpOutputSpan * Output;
  54. BYTE alphaCoverage;
  55. public:
  56. DpOutputAntiAliasBrushOutputSpan()
  57. {
  58. // Now we have nothing to do but we should have something to add
  59. // when we start to optimize the code
  60. }
  61. void Init(DpOutputSpan *output)
  62. {
  63. Output = output;
  64. alphaCoverage = 255;
  65. }
  66. void SetCoverage(BYTE coverage)
  67. {
  68. alphaCoverage = coverage;
  69. }
  70. virtual GpStatus OutputSpan(INT y, INT xMin, INT xMax);
  71. virtual ~DpOutputAntiAliasBrushOutputSpan() {};
  72. virtual BOOL IsValid() const {return TRUE;}
  73. virtual GpStatus End() { return Ok; }
  74. };
  75. void UpdateLCDOrientation();
  76. #endif // __AATEXT_HPP_