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.

105 lines
2.4 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1999-2000 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Object which maps one palette to another.
  8. *
  9. * It only maps colors which match exactly - its purpose is to deal
  10. * with, e.g., the halftone palette which has identical colors on different
  11. * platforms, but colors may be in different positions.
  12. *
  13. * Revision History:
  14. *
  15. * 12/09/1999 ericvan
  16. * Created it.
  17. * 01/20/2000 agodfrey
  18. * Moved it from Imaging\Api. Renamed it to EpPaletteMap.
  19. *
  20. \**************************************************************************/
  21. #ifndef __PALETTEMAP_HPP
  22. #define __PALETTEMAP_HPP
  23. class EpPaletteMap;
  24. class EpPaletteMap
  25. {
  26. private:
  27. // We now use an ObjectTag to determine if the object is valid
  28. // instead of using a BOOL. This is much more robust and helps
  29. // with debugging. It also enables us to version our objects
  30. // more easily with a version number in the ObjectTag.
  31. ObjectTag Tag; // Keep this as the 1st value in the object!
  32. VOID SetValid(BOOL valid)
  33. {
  34. Tag = valid ? ObjectTagPaletteMap : ObjectTagInvalid;
  35. }
  36. private:
  37. UINT uniqueness;
  38. BYTE translate[256];
  39. BOOL isVGAOnly;
  40. public:
  41. VOID
  42. CreateFromColorPalette(
  43. ColorPalette *palette
  44. );
  45. EpPaletteMap(
  46. HDC hdc,
  47. ColorPalette **palette = NULL,
  48. BOOL isDib8 = FALSE);
  49. ~EpPaletteMap();
  50. VOID UpdateTranslate(
  51. HDC hdc,
  52. ColorPalette **palette = NULL);
  53. VOID UpdateTranslate();
  54. VOID SetUniqueness(UINT Uniqueness)
  55. {
  56. uniqueness = Uniqueness;
  57. }
  58. UINT GetUniqueness()
  59. {
  60. return uniqueness;
  61. }
  62. BOOL IsValid() const
  63. {
  64. ASSERT((Tag == ObjectTagPaletteMap) || (Tag == ObjectTagInvalid));
  65. #if DBG
  66. if (Tag == ObjectTagInvalid)
  67. {
  68. WARNING1("Invalid PaletteMap");
  69. }
  70. #endif
  71. return (Tag == ObjectTagPaletteMap);
  72. }
  73. __forceinline BYTE Translate(BYTE i) const
  74. {
  75. return translate[i];
  76. }
  77. BOOL IsVGAOnly() const
  78. {
  79. return isVGAOnly;
  80. }
  81. const BYTE *GetTranslate() const
  82. {
  83. return translate;
  84. }
  85. };
  86. #endif