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.

295 lines
18 KiB

  1. ;/*
  2. ;----------------------------------------------------------------------------
  3. ; DIBENG.INC
  4. ; Copyright (c) 1992 Microsoft Corporation
  5. ;
  6. ; Dib Engine Interface Definitions
  7. ;----------------------------------------------------------------------------
  8. ;----------------------------------------------------------------------------
  9. ; General Comments:
  10. ; The DIB Engine is non-palettized from GDI's perspective. When an app
  11. ; selects a DIB into a memory DC, GDI will create a DIB Engine PDevice
  12. ; (see definition below) and will stuff in a 'DI' in the deType field.
  13. ; Subsequent operations on this DC will result in calls to the DIB Engine
  14. ; with this PDevice.
  15. ; Device drivers can also use the DIB Engine to handle most, if not all,
  16. ; of their rendering work. A device driver exports the DIB Engine PDevice
  17. ; as it's own PDevice to GDI. This PDevice contains a pointer to a
  18. ; BitmapInfo header in the driver's data segment. Immediately following
  19. ; this is an optional color table for devices less than 16 bpp.
  20. ;----------------------------------------------------------------------------
  21. ;----------------------------------------------------------------------------
  22. ; E Q U A T E S
  23. ;----------------------------------------------------------------------------
  24. BRUSHSIZE equ 8 ;height and width in pixels.
  25. VER_DIBENG equ 400h ;version = 4.0
  26. TYPE_DIBENG equ 'RP' ;deType
  27. comment ~
  28. */
  29. #define BRUSHSIZE 8
  30. #define VER_DIBENG 0x400
  31. #define TYPE_DIBENG 0x5250
  32. /*
  33. end comment ~
  34. ;----------------------------------------------------------------------------
  35. ; S T R U C T U R E S
  36. ;----------------------------------------------------------------------------
  37. ;----------------------------------------------------------------------------
  38. ; PDevice Structure for the DIB Engine. deType will contain 'DI' when GDI
  39. ; calls the DIB Engine to perform graphics operations on the dib. deType
  40. ; will contain a 0 or a Selector if a mini-driver is calling the DIB Engine
  41. ; to do graphics operations.
  42. ;----------------------------------------------------------------------------
  43. deCursorExclude equ deBeginAccess
  44. deCursorUnexclude equ deEndAccess
  45. comment ~
  46. */
  47. #define deCursorExclude deBeginAccess
  48. #define deCursorUnexclude deEndAccess
  49. /*
  50. end comment ~
  51. DIBENGINE struc ;*/ typedef struct { /*
  52. deType dw ? ; contains TYPE_DIBENG or 0 ;*/ WORD deType; /*
  53. deWidth dw ? ; Width of dib in pixels ;*/ WORD deWidth; /*
  54. deHeight dw ? ; Height of dib in pixels ;*/ WORD deHeight; /*
  55. deWidthBytes dw ? ; #bytes per scan line ;*/ WORD deWidthBytes; /*
  56. dePlanes db ? ; # of planes in bitmap ;*/ BYTE dePlanes; /*
  57. deBitsPixel db ? ; # of bits per pixel ;*/ BYTE deBitsPixel; /*
  58. deReserved1 dd ? ; cannot be used. ;*/ DWORD deReserved1; /*
  59. deDeltaScan dd ? ; + or -. Displacement to next scan. ;*/ DWORD deDeltaScan; /*
  60. delpPDevice dd ? ; Pointer to associated PDevice ;*/ LPBYTE delpPDevice; /*
  61. deBits df ? ; fword offset to bits of dib ;*/ DWORD deBitsOffset; /*
  62. ; ;*/ WORD deBitsSelector; /*
  63. deFlags dw ? ; additional flags ;*/ WORD deFlags; /*
  64. deVersion dw ? ; lsb=minor, msb=major (0400h = 4.0) ;*/ WORD deVersion; /*
  65. deBitmapInfo dd ? ; pointer to the bitmapinfo header ;*/ LPBITMAPINFO deBitmapInfo; /*
  66. deBeginAccess dd ? ; Begin surface access call back ;*/ void (FAR *deBeginAccess)(); /*
  67. deEndAccess dd ? ; End surface access call back ;*/ void (FAR *deEndAccess)(); /*
  68. deDriverReserved dd ? ; Reserved for Minidriver use. ;*/ DWORD deDriverReserved; /*
  69. DIBENGINE ends ;*/ } DIBENGINE, FAR *LPDIBENGINE; /*
  70. ;----------------------------------------------------------------------------
  71. ; Definitions for DIBEngine.deFlags
  72. ;----------------------------------------------------------------------------
  73. MINIDRIVER equ 0000000000000001b ;display driver
  74. PALETTIZED equ 0000000000000010b ;paletized device
  75. SELECTEDDIB equ 0000000000000100b ;DIB Section
  76. OFFSCREEN equ 0000000000001000b ;offscreen surface (use with VRAM)
  77. DISABLED equ 0000000000010000b ;going away -- please use BUSY instead [raypat]
  78. BUSY equ 0000000000010000b ;
  79. NOT_FRAMEBUFFER equ 0000000000100000b ;example: 8514/a
  80. FIVE6FIVE equ 0000000001000000b ;16 bpp, 565 color format.
  81. NON64KBANK equ 0000000010000000b ;bank size is not 64K
  82. VRAM equ 1000000000000000b ;physical surface (video memory)
  83. BANKEDVRAM equ 0100000000000000b ;VFlatD simulated
  84. BANKEDSCAN equ 0010000000000000b ;VFlatD simulated (broken rasters)
  85. PALETTE_XLAT equ 0001000000000000b ;background palette xlat
  86. VGADITHER equ 0000100000000000b ;dither to VGA colors (first 8, and last 8)
  87. CTCHANGE equ 0000010000000000b ;color table has been changed
  88. DITHER256 equ 0000001000000000b ;dither to 256 fixed colors
  89. FREE2 equ 0000000100000000b ;free
  90. BUSY_BIT equ 4 ;bit number to test for BUSY
  91. comment ~
  92. */
  93. #define MINIDRIVER 0x0001
  94. #define PALETTIZED 0x0002
  95. #define SELECTEDDIB 0x0004
  96. #define OFFSCREEN 0x0008
  97. #define DISABLED 0x0010
  98. #define BUSY 0x0010
  99. #define NOT_FRAMEBUFFER 0x0020
  100. #define FIVE6FIVE 0x0040
  101. #define NON64KBANK 0x0080
  102. #define VRAM 0x8000
  103. #define BANKEDVRAM 0x4000
  104. #define BANKEDSCAN 0x2000
  105. #define PALETTE_XLAT 0x1000
  106. #define VGADITHER 0x0800
  107. #define CTCHANGE 0x0400
  108. #define DITHER256 0x0200
  109. #define BUSY_BIT 0x0004
  110. /*
  111. end comment ~
  112. ;----------------------------------------------------------------------------
  113. ; Definitions for DIBEngine.deBeginAccess flags
  114. ;----------------------------------------------------------------------------
  115. FB_ACCESS equ 0000000000000001b
  116. CURSOREXCLUDE equ 0000000000001000b
  117. comment ~
  118. */
  119. #define FB_ACCESS 0x0001
  120. #define CURSOREXCLUDE 0x0008
  121. /*
  122. end comment ~
  123. ;----------------------------------------------------------------------------
  124. ; Definitions for most significant byte of a physical color.
  125. ;----------------------------------------------------------------------------
  126. GREY_BIT equ 01000000b ;color is grey (r=g=b)
  127. comment ~
  128. */
  129. #define GREY_BIT 0x40
  130. /*
  131. end comment ~
  132. ;----------------------------------------------------------------------------
  133. ; DIB Engine Color Table entry structure. This structure is used by device
  134. ; drivers that are using DIB Engine services for rendering. This structure
  135. ; is identical to the RGBQuad structure except for some bit definitions
  136. ; in the 4th byte.
  137. ;----------------------------------------------------------------------------
  138. DIBColorEntry struc ;*/ typedef struct { /*
  139. dceBlue db ? ;*/ BYTE dceBlue; /*
  140. dceGreen db ? ;*/ BYTE dceGreen; /*
  141. dceRed db ? ;*/ BYTE dceRed; /*
  142. dceFlags db ? ;*/ BYTE dceFlags; /*
  143. DIBColorEntry ends ;*/ } DIBColorEntry; /*
  144. ;----------------------------------------------------------------------------
  145. ; Definitions for DIBColorEntry.dceFlags
  146. ;----------------------------------------------------------------------------
  147. NONSTATIC equ 10000000b ;Inhibits color matching to this entry.
  148. MAPTOWHITE equ 00000001b ;0=Black, 1=White
  149. comment ~
  150. */
  151. #define NONSTATIC 0x80
  152. #define MAPTOWHITE 0x01
  153. /*
  154. end comment ~
  155. ;----------------------------------------------------------------------------
  156. ;----------------------------------------------------------------------------
  157. ; DIB Engine Physical Object Definitions
  158. ;----------------------------------------------------------------------------
  159. DIB_Pen struc ;*/ typedef struct { /*
  160. dpPenStyle dw ? ;*/ WORD dpPenStyle; /*
  161. dpPenFlags db ? ;currently none undefined. ;*/ BYTE dpPenFlags; /*
  162. dpPenBpp db ? ;*/ BYTE dpPenBpp; /*
  163. dpPenMono dd ? ;*/ DWORD dpPenMono; /*
  164. dpPenColor dd ? ;*/ DWORD dpPenColor; /*
  165. DIB_Pen ends ;*/ } DIB_Pen; /*
  166. DIB_Brush1 struc ;*/ typedef struct { /*
  167. dp1BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp1BrushFlags; /*
  168. dp1BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp1BrushBpp; /*
  169. dp1BrushStyle dw ? ;Style of the brush ;*/ WORD dp1BrushStyle; /*
  170. dp1FgColor dd ? ;Physical fg color ;*/ DWORD dp1FgColor; /*
  171. dp1Hatch dw ? ;Hatching style ;*/ WORD dp1Hatch; /*
  172. dp1BgColor dd ? ;Physical bg color ;*/ DWORD dp1BgColor; /*
  173. dp1BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp1BrushMono [BRUSHSIZE*4];/*
  174. dp1BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp1BrushMask [BRUSHSIZE*4];/*
  175. dp1BrushBits db BRUSHSIZE*4 dup (?) ;8 rows, 8 columns of 1 bit/pixel ;*/ BYTE dp1BrushBits [BRUSHSIZE*4];/*
  176. DIB_Brush1 ends ;*/ } DIB_Brush1; /*
  177. DIB_Brush4 struc ;*/ typedef struct { /*
  178. dp4BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp4BrushFlags; /*
  179. dp4BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp4BrushBpp; /*
  180. dp4BrushStyle dw ? ;Style of the brush ;*/ WORD dp4BrushStyle; /*
  181. dp4FgColor dd ? ;Physical fg color ;*/ DWORD dp4FgColor; /*
  182. dp4Hatch dw ? ;Hatching style ;*/ WORD dp4Hatch; /*
  183. dp4BgColor dd ? ;Physical bg color ;*/ DWORD dp4BgColor; /*
  184. dp4BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp4BrushMono [BRUSHSIZE*4];/*
  185. dp4BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp4BrushMask [BRUSHSIZE*4];/*
  186. dp4BrushBits db BRUSHSIZE*4 dup (?) ;8 rows, 8 columns of 4 bit/pixel ;*/ BYTE dp4BrushBits [BRUSHSIZE*4];/*
  187. DIB_Brush4 ends ;*/ } DIB_Brush4; /*
  188. DIB_Brush8 struc ;*/ typedef struct { /*
  189. dp8BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp8BrushFlags; /*
  190. dp8BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp8BrushBpp; /*
  191. dp8BrushStyle dw ? ;Style of the brush ;*/ WORD dp8BrushStyle; /*
  192. dp8FgColor dd ? ;Physical fg color ;*/ DWORD dp8FgColor; /*
  193. dp8Hatch dw ? ;Hatching style ;*/ WORD dp8Hatch; /*
  194. dp8BgColor dd ? ;Physical bg color ;*/ DWORD dp8BgColor; /*
  195. dp8BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp8BrushMono [BRUSHSIZE*4];/*
  196. dp8BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp8BrushMask [BRUSHSIZE*4];/*
  197. dp8BrushBits db BRUSHSIZE*8 dup (?) ;8 rows,8 columns of 8 bit/pixel ;*/ BYTE dp8BrushBits [BRUSHSIZE*8];/*
  198. DIB_Brush8 ends ;*/ } DIB_Brush8; /*
  199. DIB_Brush16 struc ;*/ typedef struct { /*
  200. dp16BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp16BrushFlags; /*
  201. dp16BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp16BrushBpp; /*
  202. dp16BrushStyle dw ? ;Style of the brush ;*/ WORD dp16BrushStyle; /*
  203. dp16FgColor dd ? ;Physical fg color ;*/ DWORD dp16FgColor; /*
  204. dp16Hatch dw ? ;Hatching style ;*/ WORD dp16Hatch; /*
  205. dp16BgColor dd ? ;Physical bg color ;*/ DWORD dp16BgColor; /*
  206. dp16BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp16BrushMono [BRUSHSIZE*4];/*
  207. dp16BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp16BrushMask [BRUSHSIZE*4];/*
  208. dp16BrushBits db BRUSHSIZE*16 dup (?);8 rows,8 columns of 16 bit/pixel;*/ BYTE dp16BrushBits [BRUSHSIZE*16];/*
  209. DIB_Brush16 ends ;*/ } DIB_Brush16; /*
  210. DIB_Brush24 struc ;*/ typedef struct { /*
  211. dp24BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp24BrushFlags; /*
  212. dp24BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp24BrushBpp; /*
  213. dp24BrushStyle dw ? ;Style of the brush ;*/ WORD dp24BrushStyle; /*
  214. dp24FgColor dd ? ;Physical fg color ;*/ DWORD dp24FgColor; /*
  215. dp24Hatch dw ? ;Hatching style ;*/ WORD dp24Hatch; /*
  216. dp24BgColor dd ? ;Physical bg color ;*/ DWORD dp24BgColor; /*
  217. dp24BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp24BrushMono [BRUSHSIZE*4];/*
  218. dp24BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp24BrushMask [BRUSHSIZE*4];/*
  219. dp24BrushBits db BRUSHSIZE*24 dup (?);8 rows,8 columns of 24 bit/pixel ;*/ BYTE dp24BrushBits [BRUSHSIZE*24];/*
  220. DIB_Brush24 ends ;*/ } DIB_Brush24; /*
  221. DIB_Brush32 struc ;*/ typedef struct { /*
  222. dp32BrushFlags db ? ;Accelerator for solids ;*/ BYTE dp32BrushFlags; /*
  223. dp32BrushBpp db ? ;Brush Bits per pixel format ;*/ BYTE dp32BrushBpp; /*
  224. dp32BrushStyle dw ? ;Style of the brush ;*/ WORD dp32BrushStyle; /*
  225. dp32FgColor dd ? ;Physical fg color ;*/ DWORD dp32FgColor; /*
  226. dp32Hatch dw ? ;Hatching style ;*/ WORD dp32Hatch; /*
  227. dp32BgColor dd ? ;Physical bg color ;*/ DWORD dp32BgColor; /*
  228. dp32BrushMono db BRUSHSIZE*4 dup (?) ;Mono portion ;*/ BYTE dp32BrushMono [BRUSHSIZE*4];/*
  229. dp32BrushMask db BRUSHSIZE*4 dup (?) ;transparency mask (hatch pattern);*/ BYTE dp32BrushMask [BRUSHSIZE*4];/*
  230. dp32BrushBits db BRUSHSIZE*32 dup (?);8 rows,8 columns of 32 bit/pixel ;*/ BYTE dp32BrushBits [BRUSHSIZE*32];/*
  231. DIB_Brush32 ends ;*/ } DIB_Brush32; /*
  232. ;----------------------------------------------------------------------------
  233. ; Definitions for DIB_Brushxx.dpxxBrushFlags
  234. ;----------------------------------------------------------------------------
  235. COLORSOLID equ 00000001b ;Color part is solid.
  236. MONOSOLID equ 00000010b ;Mono part is solid.
  237. PATTERNMONO equ 00000100b ;Pattern brush came from a mono bitmap.
  238. MONOVALID equ 00001000b ;Mono part is valid.
  239. MASKVALID equ 00010000b ;Transparency Mask part is valid.
  240. PRIVATEDATA equ 00100000b ;Vendor specific bit for Pens, Brushes
  241. comment ~
  242. */
  243. #define COLORSOLID 0x01
  244. #define MONOSOLID 0x02
  245. #define PATTERNMONO 0x04
  246. #define MONOVALID 0x08
  247. #define MASKVALID 0x10
  248. #define PRIVATEDATA 0x20
  249. /*
  250. end comment ~
  251. ;----------------------------------------------------------------------------
  252. ; ColorToMono
  253. ; Entry: red, green, blue
  254. ; Exit: blue = intensity.
  255. ;----------------------------------------------------------------------------
  256. ColorToMono macro red, green, blue
  257. add blue,red ;R+B
  258. rcr blue,1 ;(R+B)/2
  259. add blue,green ;pitch in Green
  260. rcr blue,1 ;G/2 + (R+B)/4
  261. endm ColorToMono
  262. ;----------------------------------------------------------------------------
  263. ; ColorToMonoBit
  264. ; Entry: red, green, blue
  265. ; Exit: blue = 0 if color maps to black
  266. ; blue = 1 if color maps to white
  267. ;----------------------------------------------------------------------------
  268. ColorToMonoBit macro red, green, blue
  269. ColorToMono red,green,blue ; Call ColorToMono to derive intensity.
  270. cmp blue,127
  271. setnc blue
  272. endm ColorToMonoBit
  273. ;*/