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.

213 lines
5.5 KiB

  1. /**************************************************************************
  2. DRAWDIB.H - routines for drawing DIBs to the screen.
  3. Copyright (c) 1990-1994, 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 RC_INVOKED
  20. #ifndef VFWAPI
  21. #define VFWAPI WINAPI
  22. #ifdef WINAPIV
  23. #define VFWAPIV WINAPIV
  24. #else
  25. #define VFWAPIV FAR CDECL
  26. #endif
  27. #endif
  28. #endif
  29. // begin_vfw32
  30. typedef HANDLE HDRAWDIB; /* hdd */
  31. /*********************************************************************
  32. DrawDib Flags
  33. **********************************************************************/
  34. #define DDF_UPDATE 0x0002 /* re-draw the last DIB */
  35. #define DDF_SAME_HDC 0x0004 /* HDC same as last call (all setup) */
  36. #define DDF_SAME_DRAW 0x0008 /* draw params are the same */
  37. #define DDF_DONTDRAW 0x0010 /* dont draw frame, just decompress */
  38. #define DDF_ANIMATE 0x0020 /* allow palette animation */
  39. #define DDF_BUFFER 0x0040 /* always buffer image */
  40. #define DDF_JUSTDRAWIT 0x0080 /* just draw it with GDI */
  41. #define DDF_FULLSCREEN 0x0100 /* use DisplayDib */
  42. #define DDF_BACKGROUNDPAL 0x0200 /* Realize palette in background */
  43. #define DDF_NOTKEYFRAME 0x0400 /* this is a partial frame update, hint */
  44. #define DDF_HURRYUP 0x0800 /* hurry up please! */
  45. #define DDF_HALFTONE 0x1000 /* always halftone */
  46. #define DDF_PREROLL DDF_DONTDRAW /* Builing up a non-keyframe */
  47. #define DDF_SAME_DIB DDF_SAME_DRAW
  48. #define DDF_SAME_SIZE DDF_SAME_DRAW
  49. /*********************************************************************
  50. DrawDib functions
  51. *********************************************************************/
  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. ** DrawDibGetPalette()
  69. **
  70. ** get the palette used for drawing DIBs
  71. **
  72. */
  73. extern HPALETTE VFWAPI DrawDibGetPalette(HDRAWDIB hdd);
  74. /*
  75. ** DrawDibSetPalette()
  76. **
  77. ** get the palette used for drawing DIBs
  78. **
  79. */
  80. extern BOOL VFWAPI DrawDibSetPalette(HDRAWDIB hdd, HPALETTE hpal);
  81. /*
  82. ** DrawDibChangePalette()
  83. */
  84. extern BOOL VFWAPI DrawDibChangePalette(HDRAWDIB hdd, int iStart, int iLen, LPPALETTEENTRY lppe);
  85. /*
  86. ** DrawDibRealize()
  87. **
  88. ** realize the palette in a HDD
  89. **
  90. */
  91. extern UINT VFWAPI DrawDibRealize(HDRAWDIB hdd, HDC hdc, BOOL fBackground);
  92. /*
  93. ** DrawDibStart()
  94. **
  95. ** start of streaming playback
  96. **
  97. */
  98. extern BOOL VFWAPI DrawDibStart(HDRAWDIB hdd, DWORD rate);
  99. /*
  100. ** DrawDibStop()
  101. **
  102. ** start of streaming playback
  103. **
  104. */
  105. extern BOOL VFWAPI DrawDibStop(HDRAWDIB hdd);
  106. /*
  107. ** DrawDibBegin()
  108. **
  109. ** prepare to draw
  110. **
  111. */
  112. extern BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
  113. HDC hdc,
  114. int dxDst,
  115. int dyDst,
  116. LPBITMAPINFOHEADER lpbi,
  117. int dxSrc,
  118. int dySrc,
  119. UINT wFlags);
  120. /*
  121. ** DrawDibDraw()
  122. **
  123. ** actualy draw a DIB to the screen.
  124. **
  125. */
  126. extern BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd,
  127. HDC hdc,
  128. int xDst,
  129. int yDst,
  130. int dxDst,
  131. int dyDst,
  132. LPBITMAPINFOHEADER lpbi,
  133. LPVOID lpBits,
  134. int xSrc,
  135. int ySrc,
  136. int dxSrc,
  137. int dySrc,
  138. UINT wFlags);
  139. /*
  140. ** DrawDibUpdate()
  141. **
  142. ** redraw the last image (may only be valid with DDF_BUFFER)
  143. */
  144. #define DrawDibUpdate(hdd, hdc, x, y) \
  145. DrawDibDraw(hdd, hdc, x, y, 0, 0, NULL, NULL, 0, 0, 0, 0, DDF_UPDATE)
  146. /*
  147. ** DrawDibEnd()
  148. */
  149. extern BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd);
  150. /*
  151. ** DrawDibTime() [for debugging purposes only]
  152. */
  153. typedef struct {
  154. LONG timeCount;
  155. LONG timeDraw;
  156. LONG timeDecompress;
  157. LONG timeDither;
  158. LONG timeStretch;
  159. LONG timeBlt;
  160. LONG timeSetDIBits;
  161. } DRAWDIBTIME, FAR *LPDRAWDIBTIME;
  162. BOOL VFWAPI DrawDibTime(HDRAWDIB hdd, LPDRAWDIBTIME lpddtime);
  163. /* display profiling */
  164. #define PD_CAN_DRAW_DIB 0x0001 /* if you can draw at all */
  165. #define PD_CAN_STRETCHDIB 0x0002 /* basicly RC_STRETCHDIB */
  166. #define PD_STRETCHDIB_1_1_OK 0x0004 /* is it fast? */
  167. #define PD_STRETCHDIB_1_2_OK 0x0008 /* ... */
  168. #define PD_STRETCHDIB_1_N_OK 0x0010 /* ... */
  169. DWORD VFWAPI DrawDibProfileDisplay(LPBITMAPINFOHEADER lpbi);
  170. // end_vfw32
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174. #endif // _INC_DRAWDIB