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.

222 lines
7.2 KiB

  1. /*************************************************************************
  2. *
  3. * PSTODIB.H - Public header for PSTODIB, any user of pstodib must
  4. * include this header.
  5. *
  6. *
  7. *************************************************************************/
  8. //
  9. // Define the defualt resolution of the interpreter
  10. //
  11. #define PSTODIB_X_DPI 300 // Set the default DPI for the interpreter
  12. #define PSTODIB_Y_DPI 300
  13. //
  14. // event type definitions
  15. // these event types are the events that will be passed from
  16. // the PStoDib() API to the callback function
  17. //
  18. enum _PSEVENT {
  19. PSEVENT_NOP = 0,
  20. PSEVENT_INIT, // Perform any intialization required in
  21. PSEVENT_PAGE_READY, // Page worth of data is ready!!!
  22. PSEVENT_STDIN, // Interpreter wants more data!!
  23. PSEVENT_SCALE, // requesting scale information this is called
  24. // for every page (at the beggining)
  25. PSEVENT_ERROR, // Postscript error occured
  26. PSEVENT_ERROR_REPORT, // Report at end of job about ERRORS
  27. PSEVENT_GET_CURRENT_PAGE_TYPE, // The current page type
  28. PSEVENT_NON_PS_ERROR, // Non PS error occured
  29. // THIS MUST BE THE LAST ENTRY IN THE TABLE
  30. PSEVENT_LAST_EVENT
  31. };
  32. typedef enum _PSEVENT PSEVENT;
  33. //
  34. // PSEVENTSTRUCT - The structure passed to the callers callback that defines
  35. // the current event
  36. //
  37. typedef struct {
  38. DWORD cbSize; // Size of this structure
  39. PSEVENT uiEvent; // The event of type PSEVENT
  40. UINT uiSubEvent; // Currently zero (reserved)
  41. LPVOID lpVoid; // Pointer to event specific
  42. // structure
  43. } PSEVENTSTRUCT;
  44. typedef PSEVENTSTRUCT *PPSEVENTSTRUCT;
  45. // Dummy definition so we can compile!
  46. //
  47. struct _PSDIBPARMS;
  48. // Define the format for the callers callback
  49. //
  50. typedef BOOL (CALLBACK *PSEVENTPROC)(struct _PSDIBPARMS *,PPSEVENTSTRUCT);
  51. //
  52. // uiOpFlags section......
  53. //
  54. #define PSTODIBFLAGS_INTERPRET_BINARY 0x00000001 // Dont tread cntr D as EOF
  55. //
  56. // PSDIBPARMS - The structure passed in to PSTODIB's main entry point
  57. // this starts an instance of the interpreter
  58. //
  59. typedef struct _PSDIBPARMS {
  60. DWORD cbSize; // The size of this structure
  61. PSEVENTPROC fpEventProc;
  62. HANDLE hPrivateData;
  63. UINT uiOpFlags; // operation mask bits
  64. UINT uiXres; // rendering x resolution
  65. UINT uiYres; // rendering y resolution
  66. UINT uiXDestRes; // x res of final destination
  67. UINT uiYDestRes; // y res of final destination
  68. UINT uirectDestBounding; // bounding rect of destination
  69. // in uiXDestRes and uiYDestRes
  70. // coordinates. this will be used
  71. // primarily for EPS stuff
  72. } PSDIBPARMS;
  73. typedef PSDIBPARMS *PPSDIBPARMS;
  74. //
  75. // PSEVENT_PAGE_READY_STRUCT - The structure that defines the event of page
  76. // ready. This is typically called at showpage
  77. // time.
  78. //
  79. typedef struct {
  80. DWORD cbSize; // The size of the structure
  81. LPBITMAPINFO lpBitmapInfo; // A ptr that describes the format
  82. // of the bitmap
  83. LPBYTE lpBuf; // pointer to buffer
  84. DWORD dwWide; // width in bits
  85. DWORD dwHigh; // height in bits
  86. UINT uiCopies; // number of copies to print
  87. INT iWinPageType; // Page type as a DMPAPER_*
  88. } PSEVENT_PAGE_READY_STRUCT;
  89. typedef PSEVENT_PAGE_READY_STRUCT *PPSEVENT_PAGE_READY_STRUCT;
  90. //
  91. // PSEVENT_NON_PS_ERROR_STRUCT - The structure that defines a non-ps error
  92. //
  93. typedef struct {
  94. DWORD cbSize; // Size of the structure
  95. DWORD dwErrorCode; // The error code
  96. DWORD dwCount; // Number of bytes of extra data
  97. LPBYTE lpByte; // Pointer to buffer with extra data
  98. BOOL bError; // TRUE - if error , FALSE = Warning
  99. } PSEVENT_NON_PS_ERROR_STRUCT, *PPSEVENT_NON_PS_ERROR_STRUCT;
  100. //
  101. // PSEVENT_CURRENT_PAGE_STRUCT
  102. // The structure that defines the event that gets generated when the
  103. // interpreter wants to know the default page size
  104. //
  105. typedef struct {
  106. DWORD cbSize;
  107. short dmPaperSize; // The current page type of the printer DMPAPER_*
  108. // defined in the windows header files
  109. } PSEVENT_CURRENT_PAGE_STRUCT, *PPSEVENT_CURRENT_PAGE_STRUCT;
  110. //
  111. // PSEVENT_ERROR_REPORT_STRUCT
  112. // The report errors event dwErrFlags can have the following flags set
  113. //
  114. enum {
  115. //
  116. // The interpreter had a fatal postscript error and had to flush the job
  117. //
  118. PSEVENT_ERROR_REPORT_FLAG_FLUSHING = 0x00000001
  119. };
  120. //
  121. // PSEVENT_ERROR_REPORT_STRUCT
  122. // The structure defining the ERROR REPORT that occurs at the end of the
  123. // Job.
  124. //
  125. typedef struct {
  126. DWORD dwErrCount; // Number of errors
  127. DWORD dwErrFlags; // Flags defined above
  128. PCHAR *paErrs; // Pointer to an array of pointers to strings
  129. } PSEVENT_ERROR_REPORT_STRUCT, *PPSEVENT_ERROR_REPORT_STRUCT;
  130. //
  131. // PSEVENT_STDIN_STRUCT
  132. // This event is generated whenever the interpreter needs data
  133. //
  134. enum {
  135. PSSTDIN_FLAG_EOF = 0x00000001 // There is no more DATA
  136. };
  137. //
  138. // stdin structure
  139. //
  140. typedef struct {
  141. DWORD cbSize; // Size of the structure
  142. LPBYTE lpBuff; // Buffer where interpreter wants us to stick data
  143. DWORD dwBuffSize; // Max bytes to take into buffer
  144. DWORD dwActualBytes; // Actual bytes loaded up
  145. UINT uiFlags; // flags of the type PSSTDIN_FLAG_*
  146. } PSEVENT_STDIN_STRUCT;
  147. typedef PSEVENT_STDIN_STRUCT *PPSEVENT_STDIN_STRUCT;
  148. // Scale structure
  149. // Allows the caller to scale the current page size
  150. typedef struct {
  151. DWORD cbSize;
  152. double dbScaleX; // scale factor for x axis set by user
  153. double dbScaleY; // scale factor for y axis set by user
  154. UINT uiXRes; // pstodib's x res in pels/inch
  155. UINT uiYRes; // pstodib's y res in pels/inch
  156. } PS_SCALE;
  157. typedef PS_SCALE *PPS_SCALE;
  158. typedef struct {
  159. PSZ pszErrorString; // string of error
  160. UINT uiErrVal; // error value
  161. } PS_ERROR;
  162. typedef PS_ERROR *PPS_ERROR;
  163. //
  164. // Entry point for PSTODIB,the caller fills the structure passed in
  165. // and calls the entry point. When the job is done pstodib returns.
  166. //
  167. BOOL WINAPI PStoDIB( PPSDIBPARMS );
  168. // Define the errors that the interpreter can generate
  169. #define PSERR_INTERPRETER_INIT_ACCESS_VIOLATION 1L
  170. #define PSERR_INTERPRETER_JOB_ACCESS_VIOLATION 2L
  171. #define PSERR_LOG_ERROR_STRING_OUT_OF_SEQUENCE 3L
  172. #define PSERR_FRAME_BUFFER_MEM_ALLOC_FAILED 4L
  173. #define PSERR_FONT_QUERY_PROBLEM 5L
  174. #define PSERR_EXCEEDED_INTERNAL_FONT_LIMIT 6L
  175. #define PSERR_LOG_MEMORY_ALLOCATION_FAILURE 7L
  176.