Source code of Windows XP (NT5)
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.

86 lines
2.7 KiB

  1. /*++ BUILD Version: 0001
  2. *
  3. * WOW v1.0
  4. *
  5. * Copyright (c) 1991, Microsoft Corporation
  6. *
  7. * WGDI.H
  8. * WOW32 16-bit GDI API support
  9. *
  10. * History:
  11. * Created 07-Mar-1991 by Jeff Parsons (jeffpar)
  12. --*/
  13. typedef struct _DIBINFO {
  14. HDC di_hdc;
  15. HANDLE di_hfile;
  16. HANDLE di_hsec;
  17. ULONG di_nalignment;
  18. PVOID di_newdib;
  19. PVOID di_newIntelDib;
  20. HBITMAP di_hbm;
  21. ULONG di_dibsize;
  22. USHORT di_originaldibsel;
  23. USHORT di_originaldibflags;
  24. ULONG di_lockcount;
  25. struct _DIBINFO *di_next;
  26. } DIBINFO, *PDIBINFO;
  27. HDC W32HandleDibDrv (PVPVOID vpbmi16);
  28. BOOL W32AddDibInfo ( HDC hdcMem,
  29. HANDLE hfile,
  30. HANDLE hsec,
  31. ULONG nalignment,
  32. PVOID newdib,
  33. PVOID newIntelDib,
  34. HBITMAP hbm,
  35. ULONG dibsize,
  36. USHORT OriginalFlags,
  37. USHORT OriginalSel);
  38. BOOL W32CheckAndFreeDibInfo (HDC hdc);
  39. VOID W32FreeDibInfo (PDIBINFO pdiCur, PDIBINFO pdiLast);
  40. ULONG W32RestoreOldDib (PDIBINFO pdi);
  41. HDC W32FindAndLockDibInfo (USHORT sel);
  42. BOOL W32CheckDibDrvColorIndices(HDC16 hdcDest, HDC16 hdcSrc);
  43. VOID W32DibDrvColorIndicesRestore(void);
  44. typedef struct _DIBSECTIONINFO {
  45. HBITMAP di_hbm;
  46. PVOID di_pv16;
  47. PVOID di_newIntelDib;
  48. struct _DIBSECTIONINFO *di_next;
  49. } DIBSECTIONINFO, *PDIBSECTIONINFO;
  50. BOOL W32CheckAndFreeDibSectionInfo (HBITMAP hbm);
  51. ULONG cjBitmapBitsSize(CONST BITMAPINFO *pbmi);
  52. extern PDIBSECTIONINFO pDibSectionInfoHead;
  53. ///////////////////////////////////////////////////////////////////////////////
  54. //
  55. // DIB Macros
  56. //
  57. ///////////////////////////////////////////////////////////////////////////////
  58. //
  59. // These are commonly used macros for dib fields access
  60. //
  61. //
  62. #define __abs(a) ((a) >= 0 ? (a) : -(a))
  63. #define WIDTHBYTES(i) ((unsigned)((i+31)&(~31))/8) /* ULONG aligned ! */
  64. #define DibWidthBytes(lpbi) (UINT)WIDTHBYTES((UINT)(lpbi)->biWidth * (UINT)((lpbi)->biBitCount))
  65. #define DibSizeImage(lpbi) ((DWORD)(UINT)DibWidthBytes(lpbi) * (DWORD)(UINT)(__abs((lpbi)->biHeight)))
  66. #define DibSize(lpbi) ((lpbi)->biSize + (lpbi)->biSizeImage + (int)(lpbi)->biClrUsed * sizeof(RGBQUAD))
  67. #define DibPtr(lpbi) (LPVOID)(DibColors(lpbi) + (UINT)(lpbi)->biClrUsed)
  68. #define DibColors(lpbi) ((LPRGBQUAD)((LPBYTE)(lpbi) + (int)(lpbi)->biSize))
  69. #define DibNumColors(lpbi) ((lpbi)->biClrUsed == 0 && (lpbi)->biBitCount <= 8 \
  70. ? (int)(1 << (int)(lpbi)->biBitCount) \
  71. : (int)(lpbi)->biClrUsed)