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.

257 lines
7.7 KiB

  1. /****************************************************************************
  2. Unit GdiPrim; Interface
  3. *****************************************************************************
  4. The Gdi module is called directly by the QuickDraw (QD) module in order
  5. to emit metafile primitives. It is responsible for accessing the current
  6. CGrafPort structure in order to access the individual attribute settings.
  7. It also supports the caching and redundant elimination of duplicate
  8. elements when writing to the metafile.
  9. Module Prefix: Gdi
  10. *****************************************************************************/
  11. /*--- states ---*/
  12. #define Changed 0
  13. #define Current 1
  14. /*--- state table offsets ---*/
  15. #define GdiPnPat 0x0001 /* fill patterns */
  16. #define GdiBkPat 0x0002
  17. #define GdiFillPat 0x0003
  18. #define GdiPnSize 0x0004 /* pen attribs */
  19. #define GdiPnMode 0x0005
  20. #define GdiFgColor 0x0006 /* foreground, background */
  21. #define GdiBkColor 0x0007
  22. #define GdiPnFgColor 0x000A
  23. #define GdiBkFgColor 0x000B
  24. #define GdiFillFgColor 0x000C
  25. #define GdiPnBkColor 0x000D
  26. #define GdiBkBkColor 0x000E
  27. #define GdiFillBkColor 0x000F
  28. #define GdiTxFont 0x0010 /* text attribs */
  29. #define GdiTxFace 0x0011
  30. #define GdiTxSize 0x0012
  31. #define GdiTxMode 0x0013
  32. #define GdiTxRatio 0x0014
  33. #define GdiChExtra 0x0015
  34. #define GdiSpExtra 0x0016
  35. #define GdiLineJustify 0x0017
  36. #define GdiNumAttrib 0x0018
  37. /*--- Action verbs ---*/
  38. typedef Integer GrafVerb;
  39. #define GdiFrame 0
  40. #define GdiPaint 1
  41. #define GdiErase 2
  42. #define GdiInvert 3
  43. #define GdiFill 4
  44. /*--- metafile comment ---*/
  45. #define PUBLIC 0xFFFFFFFF /* '....' public */
  46. #define POWERPOINT_OLD 0x5050FE54 /* 'PP.T' PowerPoint 2.0 */
  47. #define POWERPOINT 0x50504E54 /* 'PPNT' PowerPoint 3.0 */
  48. #define PRIVATE 0x512D3E47 /* 'Q->G' QD2GDI */
  49. #define SUPERPAINT 0x53504E54 /* 'SPNT' SuperPaint */
  50. #define PC_REGISTERED 0x8000 /* PowerPoint callback flag */
  51. #define QG_SIGNATURE "QuickDraw -> GDI"
  52. #define BEGIN_GROUP 0 /* public comments */
  53. #define END_GROUP 1
  54. #define CREATOR 4
  55. #define BEGIN_BANDING 6
  56. #define END_BANDING 7
  57. #define PP_VERSION 0x00 /* PowerPoint comments */
  58. #define PP_BFILEBLOCK 0x01
  59. #define PP_BEGINPICTURE 0x02
  60. #define PP_ENDPICTURE 0x03
  61. #define PP_DEVINFO 0x04
  62. #define PP_BEGINHYPEROBJ 0x05
  63. #define PP_ENDHYPEROBJ 0x06
  64. #define PP_BEGINFADE 0x07
  65. #define PP_ENDFADE 0x08
  66. #define PP_FONTNAME 0x11 /* GDI2QD round-trip */
  67. #define PP_HATCHPATTERN 0x12
  68. #define PP_BEGINCLIPREGION 0x40 /* clip regions from QD2GDI */
  69. #define PP_ENDCLIPREGION 0x41
  70. #define PP_BEGINTRANSPARENCY 0x42
  71. #define PP_ENDTRANSPARENCY 0x43
  72. #define PP_MASK 0x44
  73. #define PP_TRANSPARENTOBJ 0x45
  74. #define PP_MACPP2COLOR 0x80
  75. #define PP_WINGRAPH 0xAB
  76. typedef struct
  77. {
  78. DWord signature;
  79. Word function;
  80. DWord size;
  81. } Comment, far * CommentLPtr;
  82. /*--- PostScript data buffer (POSTSCRIPT_DATA Escape) ---*/
  83. typedef struct psbuf
  84. {
  85. Word length;
  86. char data[1];
  87. } PSBuf;
  88. /*--- Conversion preferences ---*/
  89. #define GdiPrefOmit 0
  90. #define GdiPrefAbort 2
  91. typedef struct
  92. {
  93. StringLPtr metafileName;
  94. Byte penPatternAction;
  95. Byte nonSquarePenAction;
  96. Byte penModeAction;
  97. Byte textModeAction;
  98. Byte nonRectRegionAction;
  99. Boolean optimizePP;
  100. Byte noRLE;
  101. } ConvPrefs, far * ConvPrefsLPtr;
  102. /*--- Conversion results ---*/
  103. typedef struct
  104. {
  105. HANDLE hmf; /* Global memory handle to the metafile */
  106. RECT bbox; /* Tightly bounding rectangle in metafile units */
  107. short inch; /* Length of an inch in metafile units */
  108. } PICTINFO, FAR * PictInfoLPtr;
  109. /*********************** Exported Function Definitions **********************/
  110. void GdiOffsetOrigin( Point delta );
  111. /* offset the current window origin and picture bounding box */
  112. void GdiLineTo( Point newPt );
  113. /* Emit line primitive with square endcaps */
  114. void GdiRectangle( GrafVerb verb, Rect rect );
  115. /* Emit rectangle primitive using action and dimensions parameters */
  116. void GdiRoundRect( GrafVerb verb, Rect rect, Point oval );
  117. /* Emit rounded rectangle primitive */
  118. void GdiOval( GrafVerb verb, Rect rect );
  119. /* Emit an oval primitive */
  120. void GdiArc( GrafVerb verb, Rect rect, Integer startAngle, Integer arcAngle );
  121. /* Emit an arc primitive */
  122. void GdiPolygon( GrafVerb verb, Handle poly );
  123. /* Emit polygon primitive */
  124. void GdiRegion( GrafVerb verb, Handle rgn );
  125. /* Emit region primitive */
  126. void GdiTextOut( StringLPtr string, Point location );
  127. /* draw the text at the location specified by location parameter. */
  128. void GdiStretchDIBits( PixMapLPtr pixMapLPtr, Handle pixDataHandle,
  129. Rect src, Rect dst, Word mode, Handle mask );
  130. /* Draw a Windows device-independant bitmap */
  131. void GdiSelectClipRegion( RgnHandle rgn );
  132. /* Create a clipping rectangle or region using handle passed */
  133. void GdiHatchPattern( Integer hatchIndex );
  134. /* Use the hatch pattern index passed down to perform all ensuing fill
  135. operations - 0-6 for a hatch value, -1 turns off the substitution */
  136. void GdiFontName( Byte fontFamily, Byte charSet, StringLPtr fontName );
  137. /* Set font characteristics based upno metafile comment from GDI2QD */
  138. void GdiShortComment( CommentLPtr cmt );
  139. /* Write public or private comment with no associated data */
  140. void GdiEscape( Integer function, Integer count, StringLPtr data);
  141. /* Write out a GDI Escape structure with no returned data */
  142. void GdiSetConversionPrefs( ConvPrefsLPtr convPrefs);
  143. /* Provide conversion preferences via global data block */
  144. void GdiOpenMetafile( void );
  145. /* Open metafile passed by GdiSetMetafileName() and perform any
  146. initialization of the graphics state */
  147. void GdiSetBoundingBox( Rect bbox, Integer resolution );
  148. /* Set the overall picture size and picture resoulution in dpi */
  149. void GdiCloseMetafile( void );
  150. /* Close the metafile handle and end picture generation */
  151. void GdiGetConversionResults( PictInfoLPtr pictInfoLPtr );
  152. /* return results of the conversion */
  153. void GdiMarkAsChanged( Integer attribCode );
  154. /* indicate that the attribute passed in has changed */
  155. #ifdef WIN32
  156. int WINAPI EnumFontFunc( CONST LOGFONT *logFontLPtr, CONST TEXTMETRIC *tmLPtr,
  157. DWORD fontType, LPARAM dataLPtr );
  158. #else
  159. int FAR PASCAL EnumFontFunc( LPLOGFONT logFontLPtr, LPTEXTMETRIC tmLPtr,
  160. short fontType, LPSTR dataLPtr );
  161. #endif
  162. /* Callback function used to determine if a given font is available */
  163. void GdiSamePrimitive( Boolean same );
  164. /* indicate whether next primitive is the same or new */
  165. void GdiEPSPreamble(Rect far *);
  166. /* output GDI EPS filter PostScript preamble */
  167. void GdiEPSTrailer( void );
  168. /* output GDI EPS filter PostScript trailer */
  169. void GdiEPSData(PSBuf far*);
  170. /* output EPS PostScript data as GDI POSTSCRIPT_DATA Escape */