DIBAPI.H 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* PortTool v2.2 dibapi.h */
  2. /*
  3. * dibapi.h
  4. *
  5. * ** Win32 Version **
  6. *
  7. * Copyright 1991-1998 Microsoft Corporation. All rights reserved
  8. *
  9. * Header file for Device-Independent Bitmap (DIB) API. Provides
  10. * function prototypes and constants for the following functions:
  11. *
  12. * BitmapToDIB() - Creates a DIB from a bitmap
  13. * ChangeBitmapFormat() - Changes a bitmap to a specified DIB format
  14. * ChangeDIBFormat() - Changes a DIB's BPP and/or compression format
  15. * CopyScreenToBitmap() - Copies entire screen to a standard Bitmap
  16. * CopyScreenToDIB() - Copies entire screen to a DIB
  17. * CopyWindowToBitmap() - Copies a window to a standard Bitmap
  18. * CopyWindowToDIB() - Copies a window to a DIB
  19. * CreateDIBPalette() - Creates a palette from a DIB
  20. * CreateDIB() - Creates a new DIB
  21. * DestroyDIB() - Deletes DIB when finished using it
  22. * DIBError() - Displays message box with error message
  23. * DIBHeight() - Gets the DIB height
  24. * DIBNumColors() - Calculates number of colors in the DIB's color table
  25. * DIBToBitmap() - Creates a bitmap from a DIB
  26. * DIBWidth() - Gets the DIB width
  27. * FindDIBBits() - Sets pointer to the DIB bits
  28. * GetSystemPalette() - Gets the current palette
  29. * LoadDIB() - Loads a DIB from a file
  30. * PaintBitmap() - Displays standard bitmap in the specified DC
  31. * PaintDIB() - Displays DIB in the specified DC
  32. * PalEntriesOnDevice() - Gets the number of palette entries
  33. * PaletteSize() - Calculates the buffer size required by a palette
  34. * PrintDIB() - Prints the specified DIB
  35. * PrintScreen() - Prints the entire screen
  36. * PrintWindow() - Prints all or part of a window
  37. * SaveDIB() - Saves the specified dib in a file
  38. *
  39. * See the file DIBAPI.TXT for more information about these functions.
  40. *
  41. */
  42. /* Handle to a DIB */
  43. #define HDIB HANDLE
  44. /* Print Area selection */
  45. #define PW_WINDOW 1
  46. #define PW_CLIENT 2
  47. /* Print Options selection */
  48. #define PW_BESTFIT 1
  49. #define PW_STRETCHTOPAGE 2
  50. #define PW_SCALE 3
  51. /* DIB Macros*/
  52. // WIDTHBYTES performs DWORD-aligning of DIB scanlines. The "bits"
  53. // parameter is the bit count for the scanline (biWidth * biBitCount),
  54. // and this macro returns the number of DWORD-aligned bytes needed
  55. // to hold those bits.
  56. #ifndef __AMVIDEO__
  57. #define WIDTHBYTES(bits) (((bits) + 31) / 32 * 4)
  58. #endif
  59. /* Error constants */
  60. enum {
  61. ERR_MIN = 0, // All error #s >= this value
  62. ERR_NOT_DIB = 0, // Tried to load a file, NOT a DIB!
  63. ERR_MEMORY, // Not enough memory!
  64. ERR_READ, // Error reading file!
  65. ERR_LOCK, // Error on a GlobalLock()!
  66. ERR_OPEN, // Error opening a file!
  67. ERR_CREATEPAL, // Error creating palette.
  68. ERR_GETDC, // Couldn't get a DC.
  69. ERR_CREATEDDB, // Error create a DDB.
  70. ERR_STRETCHBLT, // StretchBlt() returned failure.
  71. ERR_STRETCHDIBITS, // StretchDIBits() returned failure.
  72. ERR_SETDIBITSTODEVICE, // SetDIBitsToDevice() failed.
  73. ERR_STARTDOC, // Error calling StartDoc().
  74. ERR_NOGDIMODULE, // Couldn't find GDI module in memory.
  75. ERR_SETABORTPROC, // Error calling SetAbortProc().
  76. ERR_STARTPAGE, // Error calling StartPage().
  77. ERR_NEWFRAME, // Error calling NEWFRAME escape.
  78. ERR_ENDPAGE, // Error calling EndPage().
  79. ERR_ENDDOC, // Error calling EndDoc().
  80. ERR_SETDIBITS, // Error calling SetDIBits().
  81. ERR_FILENOTFOUND, // Error opening file in GetDib()
  82. ERR_INVALIDHANDLE, // Invalid Handle
  83. ERR_DIBFUNCTION, // Error on call to DIB function
  84. ERR_MAX // All error #s < this value
  85. };
  86. /* Function prototypes */
  87. HDIB BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal);
  88. HDIB ChangeBitmapFormat (HBITMAP hBitmap,
  89. WORD wBitCount,
  90. DWORD dwCompression,
  91. HPALETTE hPal);
  92. HDIB ChangeDIBFormat (HDIB hDIB, WORD wBitCount,
  93. DWORD dwCompression);
  94. HBITMAP CopyScreenToBitmap (LPRECT);
  95. HDIB CopyScreenToDIB (LPRECT);
  96. HBITMAP CopyWindowToBitmap (HWND, WORD);
  97. HDIB CopyWindowToDIB (HWND, WORD);
  98. HPALETTE CreateDIBPalette (HDIB);
  99. HDIB CreateDIB(DWORD, DWORD, WORD);
  100. WORD DestroyDIB (HDIB);
  101. void DIBError (int ErrNo);
  102. DWORD DIBHeight (LPSTR lpDIB);
  103. WORD DIBNumColors (LPSTR lpDIB);
  104. HBITMAP DIBToBitmap (HDIB hDIB, HPALETTE hPal);
  105. DWORD DIBWidth (LPSTR lpDIB);
  106. LPSTR FindDIBBits (LPSTR lpDIB);
  107. HPALETTE GetSystemPalette (void);
  108. HDIB LoadDIB (LPSTR);
  109. BOOL PaintBitmap (HDC, LPRECT, HBITMAP, LPRECT, HPALETTE);
  110. BOOL PaintDIB (HDC, LPRECT, HDIB, LPRECT, HPALETTE);
  111. int PalEntriesOnDevice (HDC hDC);
  112. WORD PaletteSize (LPSTR lpDIB);
  113. WORD PrintDIB (HDIB, WORD, WORD, WORD, LPSTR);
  114. WORD PrintScreen (LPRECT, WORD, WORD, WORD, LPSTR);
  115. WORD PrintWindow (HWND, WORD, WORD, WORD, WORD, LPSTR);
  116. WORD SaveDIB (HDIB, LPSTR);