gdipluspixelformats.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * gdipluspixelformats.h
  3. *
  4. * GDI+ pixel formats
  5. *
  6. * This file is part of the w32api package.
  7. *
  8. * Contributors:
  9. * Created by Markus Koenig <markus@stber-koenig.de>
  10. *
  11. * THIS SOFTWARE IS NOT COPYRIGHTED
  12. *
  13. * This source code is offered for use in the public domain. You may
  14. * use, modify or distribute it freely.
  15. *
  16. * This code is distributed in the hope that it will be useful but
  17. * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
  18. * DISCLAIMED. This includes but is not limited to warranties of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  20. *
  21. */
  22. #ifndef __GDIPLUS_PIXELFORMATS_H
  23. #define __GDIPLUS_PIXELFORMATS_H
  24. #if __GNUC__ >=3
  25. #pragma GCC system_header
  26. #endif
  27. typedef DWORD ARGB;
  28. typedef INT PixelFormat;
  29. #define PixelFormatIndexed ((INT) 0x00010000)
  30. #define PixelFormatGDI ((INT) 0x00020000)
  31. #define PixelFormatAlpha ((INT) 0x00040000)
  32. #define PixelFormatPAlpha ((INT) 0x00080000)
  33. #define PixelFormatExtended ((INT) 0x00100000)
  34. #define PixelFormatCanonical ((INT) 0x00200000)
  35. #define PixelFormatUndefined ((INT) 0)
  36. #define PixelFormatDontCare ((INT) 0)
  37. #define PixelFormat1bppIndexed ((INT) \
  38. (1 | (1<<8) | PixelFormatIndexed | PixelFormatGDI))
  39. #define PixelFormat4bppIndexed ((INT) \
  40. (2 | (4<<8) | PixelFormatIndexed | PixelFormatGDI))
  41. #define PixelFormat8bppIndexed ((INT) \
  42. (3 | (8<<8) | PixelFormatIndexed | PixelFormatGDI))
  43. #define PixelFormat16bppGrayScale ((INT) \
  44. (4 | (16<<8) | PixelFormatExtended))
  45. #define PixelFormat16bppRGB555 ((INT) \
  46. (5 | (16<<8) | PixelFormatGDI))
  47. #define PixelFormat16bppRGB565 ((INT) \
  48. (6 | (16<<8) | PixelFormatGDI))
  49. #define PixelFormat16bppARGB1555 ((INT) \
  50. (7 | (16<<8) | PixelFormatAlpha | PixelFormatGDI))
  51. #define PixelFormat24bppRGB ((INT) \
  52. (8 | (24<<8) | PixelFormatGDI))
  53. #define PixelFormat32bppRGB ((INT) \
  54. (9 | (32<<8) | PixelFormatGDI))
  55. #define PixelFormat32bppARGB ((INT) \
  56. (10 | (32<<8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical))
  57. #define PixelFormat32bppPARGB ((INT) \
  58. (11 | (32<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI))
  59. #define PixelFormat48bppRGB ((INT) \
  60. (12 | (48<<8) | PixelFormatExtended))
  61. #define PixelFormat64bppARGB ((INT) \
  62. (13 | (64<<8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended))
  63. #define PixelFormat64bppPARGB ((INT) \
  64. (14 | (64<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended))
  65. #define PixelFormatMax ((INT) 15)
  66. typedef enum PaletteFlags {
  67. PaletteFlagsHasAlpha = 1,
  68. PaletteFlagsGrayScale = 2,
  69. PaletteFlagsHalftone = 4
  70. } PaletteFlags;
  71. typedef enum PaletteType {
  72. PaletteTypeCustom = 0,
  73. PaletteTypeOptimal = 1,
  74. PaletteTypeFixedBW = 2,
  75. PaletteTypeFixedHalftone8 = 3,
  76. PaletteTypeFixedHalftone27 = 4,
  77. PaletteTypeFixedHalftone64 = 5,
  78. PaletteTypeFixedHalftone125 = 6,
  79. PaletteTypeFixedHalftone216 = 7,
  80. PaletteTypeFixedHalftone252 = 8,
  81. PaletteTypeFixedHalftone256 = 9
  82. } PaletteType;
  83. typedef struct ColorPalette {
  84. UINT Flags;
  85. UINT Count;
  86. ARGB Entries[1];
  87. } ColorPalette;
  88. static __inline__ UINT GetPixelFormatSize(PixelFormat pixfmt)
  89. {
  90. return (((UINT) pixfmt) & 0xff00U) >> 8;
  91. }
  92. static __inline__ BOOL IsAlphaPixelFormat(PixelFormat pixfmt)
  93. {
  94. return (pixfmt & PixelFormatAlpha) != 0;
  95. }
  96. static __inline__ BOOL IsCanonicalPixelFormat(PixelFormat pixfmt)
  97. {
  98. return (pixfmt & PixelFormatCanonical) != 0;
  99. }
  100. static __inline__ BOOL IsExtendedPixelFormat(PixelFormat pixfmt)
  101. {
  102. return (pixfmt & PixelFormatExtended) != 0;
  103. }
  104. static __inline__ BOOL IsIndexedPixelFormat(PixelFormat pixfmt)
  105. {
  106. return (pixfmt & PixelFormatIndexed) != 0;
  107. }
  108. #endif /* __GDIPLUS_PIXELFORMATS_H */