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.

216 lines
5.7 KiB

  1. /**************************************************************************
  2. DRAWDIB.H - routines for drawing DIBs to the screen.
  3. Copyright (c) 1990-1993, Microsoft Corp. All rights reserved.
  4. this code handles stretching and dithering with custom code.
  5. the following DIB formats are supported:
  6. 8bpp
  7. 16bpp
  8. 24bpp
  9. drawing to:
  10. 16 color DC (will dither 8bpp down)
  11. 256 (palletized) DC (will dither 16 and 24bpp down)
  12. Full-color DC (will just draw it!)
  13. **************************************************************************/
  14. #ifndef _INC_DRAWDIB
  15. #define _INC_DRAWDIB
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifndef VFWAPI
  20. #define VFWAPI FAR PASCAL
  21. #define VFWAPIV FAR CDECL
  22. #endif
  23. typedef HANDLE HDRAWDIB; /* hdd */
  24. /*********************************************************************
  25. DrawDib Flags
  26. **********************************************************************/
  27. #define DDF_0001 0x0001 /* */ /* Internal */
  28. #define DDF_UPDATE 0x0002 /* re-draw the last DIB */
  29. #define DDF_SAME_HDC 0x0004 /* HDC same as last call (all setup) */
  30. #define DDF_SAME_DRAW 0x0008 /* draw params are the same */
  31. #define DDF_DONTDRAW 0x0010 /* dont draw frame, just decompress */
  32. #define DDF_ANIMATE 0x0020 /* allow palette animation */
  33. #define DDF_BUFFER 0x0040 /* always buffer image */
  34. #define DDF_JUSTDRAWIT 0x0080 /* just draw it with GDI */
  35. #define DDF_FULLSCREEN 0x0100 /* use DisplayDib */
  36. #define DDF_BACKGROUNDPAL 0x0200 /* Realize palette in background */
  37. #define DDF_NOTKEYFRAME 0x0400 /* this is a partial frame update, hint */
  38. #define DDF_HURRYUP 0x0800 /* hurry up please! */
  39. #define DDF_HALFTONE 0x1000 /* always halftone */
  40. #define DDF_2000 0x2000 /* */ /* Internal */
  41. #define DDF_PREROLL DDF_DONTDRAW /* Builing up a non-keyframe */
  42. #define DDF_SAME_DIB DDF_SAME_DRAW
  43. #define DDF_SAME_SIZE DDF_SAME_DRAW
  44. /*********************************************************************
  45. DrawDib functions
  46. *********************************************************************/
  47. /*
  48. ** DrawDibInit()
  49. **
  50. */
  51. extern BOOL VFWAPI DrawDibInit(void);
  52. /*
  53. ** DrawDibOpen()
  54. **
  55. */
  56. extern HDRAWDIB VFWAPI DrawDibOpen(void);
  57. /*
  58. ** DrawDibClose()
  59. **
  60. */
  61. extern BOOL VFWAPI DrawDibClose(HDRAWDIB hdd);
  62. /*
  63. ** DrawDibGetBuffer()
  64. **
  65. */
  66. extern LPVOID VFWAPI DrawDibGetBuffer(HDRAWDIB hdd, LPBITMAPINFOHEADER lpbi, DWORD dwSize, DWORD dwFlags);
  67. /*
  68. ** DrawDibError()
  69. */
  70. extern UINT VFWAPI DrawDibError(HDRAWDIB hdd);
  71. /*
  72. ** DrawDibGetPalette()
  73. **
  74. ** get the palette used for drawing DIBs
  75. **
  76. */
  77. extern HPALETTE VFWAPI DrawDibGetPalette(HDRAWDIB hdd);
  78. /*
  79. ** DrawDibSetPalette()
  80. **
  81. ** get the palette used for drawing DIBs
  82. **
  83. */
  84. extern BOOL VFWAPI DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal);
  85. /*
  86. ** DrawDibChangePalette()
  87. */
  88. extern BOOL VFWAPI DrawDibChangePalette(HDRAWDIB hdd, int iStart, int iLen, LPPALETTEENTRY lppe);
  89. /*
  90. ** DrawDibRealize()
  91. **
  92. ** realize the palette in a HDD
  93. **
  94. */
  95. extern UINT VFWAPI DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground);
  96. /*
  97. ** DrawDibStart()
  98. **
  99. ** start of streaming playback
  100. **
  101. */
  102. extern BOOL VFWAPI DrawDibStart(HDRAWDIB hdd, DWORD rate);
  103. /*
  104. ** DrawDibStop()
  105. **
  106. ** start of streaming playback
  107. **
  108. */
  109. extern BOOL VFWAPI DrawDibStop(HDRAWDIB hdd);
  110. /*
  111. ** DrawDibBegin()
  112. **
  113. ** prepare to draw
  114. **
  115. */
  116. extern BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
  117. HDC hdc,
  118. int dxDst,
  119. int dyDst,
  120. LPBITMAPINFOHEADER lpbi,
  121. int dxSrc,
  122. int dySrc,
  123. UINT wFlags);
  124. /*
  125. ** DrawDibDraw()
  126. **
  127. ** actualy draw a DIB to the screen.
  128. **
  129. */
  130. extern BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd,
  131. HDC hdc,
  132. int xDst,
  133. int yDst,
  134. int dxDst,
  135. int dyDst,
  136. LPBITMAPINFOHEADER lpbi,
  137. LPVOID lpBits,
  138. int xSrc,
  139. int ySrc,
  140. int dxSrc,
  141. int dySrc,
  142. UINT wFlags);
  143. /*
  144. ** DrawDibUpdate()
  145. **
  146. ** redraw the last image (may only be valid with DDF_BUFFER)
  147. */
  148. #define DrawDibUpdate(hdd, hdc, x, y) \
  149. DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
  150. /*
  151. ** DrawDibEnd()
  152. */
  153. extern BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd);
  154. /*
  155. ** DrawDibTime() [for debugging purposes only]
  156. */
  157. typedef struct {
  158. LONG timeCount;
  159. LONG timeDraw;
  160. LONG timeDecompress;
  161. LONG timeDither;
  162. LONG timeStretch;
  163. LONG timeBlt;
  164. LONG timeSetDIBits;
  165. } DRAWDIBTIME, FAR *LPDRAWDIBTIME;
  166. BOOL VFWAPI DrawDibTime(HDRAWDIB hdd, LPDRAWDIBTIME lpddtime);
  167. /* display profiling */
  168. #define PD_CAN_DRAW_DIB 0x0001 /* if you can draw at all */
  169. #define PD_CAN_STRETCHDIB 0x0002 /* basicly RC_STRETCHDIB */
  170. #define PD_STRETCHDIB_1_1_OK 0x0004 /* is it fast? */
  171. #define PD_STRETCHDIB_1_2_OK 0x0008 /* ... */
  172. #define PD_STRETCHDIB_1_N_OK 0x0010 /* ... */
  173. DWORD VFWAPI DrawDibProfileDisplay(LPBITMAPINFOHEADER lpbi);
  174. #ifdef __cplusplus
  175. }
  176. #endif
  177. #endif // _INC_DRAWDIB