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.

124 lines
3.8 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
  4. *
  5. * Module Name:
  6. *
  7. * Gdiplus Pixel Formats
  8. *
  9. * Abstract:
  10. *
  11. * GDI+ Pixel Formats
  12. *
  13. \**************************************************************************/
  14. #ifndef _GDIPLUSPIXELFORMATS_H
  15. #define _GDIPLUSPIXELFORMATS_H
  16. typedef DWORD ARGB;
  17. typedef DWORDLONG ARGB64;
  18. #define ALPHA_SHIFT 24
  19. #define RED_SHIFT 16
  20. #define GREEN_SHIFT 8
  21. #define BLUE_SHIFT 0
  22. #define ALPHA_MASK ((ARGB) 0xff << ALPHA_SHIFT)
  23. // In-memory pixel data formats:
  24. // bits 0-7 = format index
  25. // bits 8-15 = pixel size (in bits)
  26. // bits 16-23 = flags
  27. // bits 24-31 = reserved
  28. typedef INT PixelFormat;
  29. #define PixelFormatIndexed 0x00010000 // Indexes into a palette
  30. #define PixelFormatGDI 0x00020000 // Is a GDI-supported format
  31. #define PixelFormatAlpha 0x00040000 // Has an alpha component
  32. #define PixelFormatPAlpha 0x00080000 // Pre-multiplied alpha
  33. #define PixelFormatExtended 0x00100000 // Extended color 16 bits/channel
  34. #define PixelFormatCanonical 0x00200000
  35. #define PixelFormatUndefined 0
  36. #define PixelFormatDontCare 0
  37. #define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI)
  38. #define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI)
  39. #define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI)
  40. #define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended)
  41. #define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI)
  42. #define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI)
  43. #define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
  44. #define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI)
  45. #define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI)
  46. #define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
  47. #define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
  48. #define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended)
  49. #define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
  50. #define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
  51. #define PixelFormatMax 15
  52. inline UINT
  53. GetPixelFormatSize(
  54. PixelFormat pixfmt
  55. )
  56. {
  57. return (pixfmt >> 8) & 0xff;
  58. }
  59. inline BOOL
  60. IsIndexedPixelFormat(
  61. PixelFormat pixfmt
  62. )
  63. {
  64. return (pixfmt & PixelFormatIndexed) != 0;
  65. }
  66. inline BOOL
  67. IsAlphaPixelFormat(
  68. PixelFormat pixfmt
  69. )
  70. {
  71. return (pixfmt & PixelFormatAlpha) != 0;
  72. }
  73. inline BOOL
  74. IsExtendedPixelFormat(
  75. PixelFormat pixfmt
  76. )
  77. {
  78. return (pixfmt & PixelFormatExtended) != 0;
  79. }
  80. //--------------------------------------------------------------------------
  81. // Determine if the Pixel Format is Canonical format:
  82. // PixelFormat32bppARGB
  83. // PixelFormat32bppPARGB
  84. // PixelFormat64bppARGB
  85. // PixelFormat64bppPARGB
  86. //--------------------------------------------------------------------------
  87. inline BOOL
  88. IsCanonicalPixelFormat(
  89. PixelFormat pixfmt
  90. )
  91. {
  92. return (pixfmt & PixelFormatCanonical) != 0;
  93. }
  94. enum PaletteFlags
  95. {
  96. PaletteFlagsHasAlpha = 0x0001,
  97. PaletteFlagsGrayScale = 0x0002,
  98. PaletteFlagsHalftone = 0x0004
  99. };
  100. struct ColorPalette
  101. {
  102. public:
  103. UINT Flags; // Palette flags
  104. UINT Count; // Number of color entries
  105. ARGB Entries[1]; // Palette color entries
  106. };
  107. #endif