Leaked source code of windows server 2003
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.

269 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. graphics.h
  5. Abstract:
  6. Bitmap display support with text mode for
  7. upgrade. This file has three core abstractions
  8. Bitmap, Animated bitmap and Graphics
  9. Progress bar.
  10. Author:
  11. Vijay Jayaseelan (vijayj) 01 July 2000
  12. Revision History:
  13. None
  14. --*/
  15. #ifndef _GRAPHICS_H_
  16. #define _GRAPHICS_H_
  17. #include "spprecmp.h"
  18. #pragma hdrstop
  19. #define MAX_ANIMATED_BITMAPS 256
  20. //
  21. // Bitmap abstraction
  22. //
  23. // A textmode bitmap can be created using a resource ID
  24. // or a fully qualified bitmap file name.
  25. //
  26. // Note : Since currently we support only 640 * 480 * 16 (colors)
  27. // VGA mode, its necessary that all the bitmap
  28. // resources and files adhere to this format.
  29. //
  30. typedef struct _TM_BITMAP {
  31. PVOID ViewBase;
  32. PVOID Data;
  33. WCHAR FileName[MAX_PATH];
  34. HANDLE FileHandle;
  35. HANDLE SectionHandle;
  36. } TM_BITMAP, *PTM_BITMAP, *TM_BITMAP_HANDLE;
  37. //
  38. // Bitmap methods
  39. //
  40. TM_BITMAP_HANDLE
  41. TextmodeBitmapCreate(
  42. IN ULONG ResourceId
  43. );
  44. TM_BITMAP_HANDLE
  45. TextmodeBitmapCreateFromFile(
  46. IN PWSTR FileName
  47. );
  48. NTSTATUS
  49. TextmodeBitmapDelete(
  50. IN TM_BITMAP_HANDLE hBitmap
  51. );
  52. NTSTATUS
  53. TextmodeBitmapDisplay(
  54. IN TM_BITMAP_HANDLE hBitmap,
  55. IN ULONG X,
  56. IN ULONG Y
  57. );
  58. //
  59. // Animated bitmap abstraction
  60. //
  61. // Animated bitmap consists of multiple bitmaps of the same
  62. // size. Each next bitmap is drawn at the same location
  63. // after the specified time out, creating an illusion of
  64. // animation.
  65. //
  66. // Note : Since animated bitmap is just a collection of
  67. // regular textmode bitmap abstraction, its format
  68. // is also restricted as regular textmode bitmap.
  69. //
  70. typedef struct _TM_ANIMATED_BITMAP {
  71. TM_BITMAP_HANDLE Bitmaps[MAX_ANIMATED_BITMAPS];
  72. ULONG FlipTime;
  73. ULONG CurrentBitmap;
  74. ULONG X;
  75. ULONG Y;
  76. HANDLE ThreadHandle;
  77. LONG StopAnimating;
  78. } TM_ANIMATED_BITMAP, *PTM_ANIMATED_BITMAP, *TM_ANIMATED_BITMAP_HANDLE;
  79. //
  80. // Animated bitmap methods
  81. //
  82. TM_ANIMATED_BITMAP_HANDLE
  83. TextmodeAnimatedBitmapCreate(
  84. IN ULONG *ResourceIds
  85. );
  86. TM_ANIMATED_BITMAP_HANDLE
  87. TextmodeAnimatedBitmapCreateFromFiles(
  88. IN WCHAR *FileNames[]
  89. );
  90. NTSTATUS
  91. TexmodeAnimatedBitmapDelete(
  92. IN TM_ANIMATED_BITMAP_HANDLE hAnimatedBitmap
  93. );
  94. NTSTATUS
  95. TextmodeAnimatedBitmapAnimate(
  96. IN TM_ANIMATED_BITMAP_HANDLE hAnimatedBitmap,
  97. IN ULONG X,
  98. IN ULONG Y,
  99. IN ULONG Speed
  100. );
  101. VOID
  102. TextmodeAnimatedBitmapAnimator(
  103. IN PVOID Context
  104. );
  105. //
  106. // Progress Bar abstraction
  107. //
  108. // Note : Progress bar can use bitmaps or solid
  109. // fills based on the way its created. In case
  110. // the progress bar uses bitmaps, then the
  111. // foreground & background bitmaps are each 1 pixel
  112. // wide and background bitmap is assumed to be
  113. // 2 pixels shorter than foreground bitmap.
  114. //
  115. //
  116. typedef struct _TM_GRAPHICS_PRGBAR {
  117. ULONG X;
  118. ULONG Y;
  119. ULONG Length;
  120. ULONG Height;
  121. ULONG BackgroundColor;
  122. ULONG ForegroundColor;
  123. ULONG Fill;
  124. TM_BITMAP_HANDLE Background;
  125. TM_BITMAP_HANDLE Foreground;
  126. } TM_GRAPHICS_PRGBAR, *TM_GRAPHICS_PRGBAR_HANDLE;
  127. //
  128. // Progress bar methods
  129. //
  130. TM_GRAPHICS_PRGBAR_HANDLE
  131. TextmodeGraphicsProgBarCreate(
  132. IN ULONG X,
  133. IN ULONG Y,
  134. IN ULONG Length,
  135. IN ULONG Height,
  136. IN ULONG ForegroundColor,
  137. IN ULONG BackgroundColor,
  138. IN ULONG InitialFill
  139. );
  140. TM_GRAPHICS_PRGBAR_HANDLE
  141. TextmodeGraphicsProgBarCreateUsingBmps(
  142. IN ULONG X,
  143. IN ULONG Y,
  144. IN ULONG Length,
  145. IN ULONG Height,
  146. IN ULONG BackgroundBmpId,
  147. IN ULONG CellBmpId,
  148. IN ULONG InitialFill
  149. );
  150. NTSTATUS
  151. TextmodeGraphicsProgBarUpdate(
  152. IN TM_GRAPHICS_PRGBAR_HANDLE hPrgBar,
  153. IN ULONG Fill
  154. );
  155. NTSTATUS
  156. TextmodeGraphicsProgBarRefresh(
  157. IN TM_GRAPHICS_PRGBAR_HANDLE hPrgBar,
  158. IN BOOLEAN UpdateBackground
  159. );
  160. NTSTATUS
  161. TextmodeGraphicsProgBarDelete(
  162. IN TM_GRAPHICS_PRGBAR_HANDLE hPrgBar
  163. );
  164. //
  165. // Vga graphics interface
  166. //
  167. NTSTATUS
  168. VgaGraphicsInit(
  169. PSP_VIDEO_VARS VideoVars
  170. );
  171. NTSTATUS
  172. VgaGraphicsTerminate(
  173. PSP_VIDEO_VARS VideoVars
  174. );
  175. VOID
  176. VgaGraphicsSolidColorFill(
  177. IN ULONG x1,
  178. IN ULONG y1,
  179. IN ULONG x2,
  180. IN ULONG y2,
  181. IN ULONG Color
  182. );
  183. VOID
  184. VgaGraphicsBitBlt(
  185. IN PUCHAR Buffer,
  186. IN ULONG x,
  187. IN ULONG y
  188. );
  189. //
  190. // Misc functions
  191. //
  192. NTSTATUS
  193. UpgradeGraphicsInit(
  194. VOID
  195. );
  196. NTSTATUS
  197. UpgradeGraphicsStart(
  198. VOID
  199. );
  200. VOID
  201. GraphicsModeProgressUpdate(
  202. IN TM_SETUP_MAJOR_EVENT MajorEvent,
  203. IN TM_SETUP_MINOR_EVENT MinorEvent,
  204. IN PVOID Context,
  205. IN PVOID EventData
  206. );
  207. VOID
  208. UpgradeGraphicsThread(
  209. IN PVOID Context
  210. );
  211. //
  212. // Indicates that graphics mode is needed for upgrade
  213. // cases, with actual textmode running in the background
  214. //
  215. #define SP_IS_UPGRADE_GRAPHICS_MODE() (VideoVars.UpgradeGraphicsMode)
  216. #define SP_SET_UPGRADE_GRAPHICS_MODE(_Value) \
  217. (VideoVars.UpgradeGraphicsMode = (_Value));
  218. //
  219. // #define _GRAPHICS_TESTING_ TRUE
  220. //
  221. #endif // for _GRAPHICS_H_