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.

256 lines
9.3 KiB

  1. /***
  2. *pgchart.h - Declare constants, functions and macros for charting library.
  3. *
  4. * Copyright (c) 1988-1992, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file declares the presentation graphics library functions and
  8. * the structures and manifest constants that are used with them.
  9. *
  10. ***************************************************************************/
  11. #ifdef __cplusplus
  12. extern "C" { /* allow use with C++ */
  13. #endif
  14. #if (_MSC_VER <= 600)
  15. #define __cdecl _cdecl
  16. #define __far _far
  17. #endif
  18. /* Force word alignment to avoid possible -Zp override */
  19. #pragma pack(2)
  20. /* Required for the missing value definition */
  21. #ifndef FLT_MAX
  22. #define FLT_MAX 3.402823466e+38F /* max value */
  23. #endif
  24. #define _PG_PALETTELEN 16 /* Number of entries in internal palette */
  25. #define _PG_MAXCHARTTYPE 5 /* Maximum available chart type */
  26. #define _PG_MAXCHARTSTYLE 2 /* Maximum chart style */
  27. #define _PG_TITLELEN 70 /* Maximum title text length */
  28. #define _PG_LEFT 1 /* Positions used for titles and legends */
  29. #define _PG_CENTER 2
  30. #define _PG_RIGHT 3
  31. #define _PG_BOTTOM 4
  32. #define _PG_OVERLAY 5
  33. #define _PG_LINEARAXIS 1 /* Used to specify axis types */
  34. #define _PG_LOGAXIS 2
  35. #define _PG_DECFORMAT 1 /* Used to specify tic mark label format */
  36. #define _PG_EXPFORMAT 2
  37. #define _PG_BARCHART 1 /* Charttype for a bar chart */
  38. #define _PG_COLUMNCHART 2 /* Charttype for a column chart */
  39. #define _PG_PLAINBARS 1 /* Styles for bar and column charts */
  40. #define _PG_STACKEDBARS 2
  41. #define _PG_LINECHART 3 /* Charttype for a line chart */
  42. #define _PG_SCATTERCHART 4 /* Charttype for a scatter chart */
  43. #define _PG_POINTANDLINE 1 /* Styles for line and scatter charts */
  44. #define _PG_POINTONLY 2
  45. #define _PG_PIECHART 5 /* Charttype for pie chart */
  46. #define _PG_PERCENT 1 /* Styles for pie charts */
  47. #define _PG_NOPERCENT 2
  48. #define _PG_MISSINGVALUE (-FLT_MAX) /* Indicates missing data values */
  49. /* Error codes */
  50. /* Numbers greater than 100 will terminate chart routine, others will cause
  51. * default values to be used
  52. */
  53. #define _PG_NOTINITIALIZED 102 /* If library not initialized */
  54. #define _PG_BADSCREENMODE 103 /* Graphics mode not set before charting */
  55. #define _PG_BADCHARTSTYLE 04 /* Chart style invalid */
  56. #define _PG_BADCHARTTYPE 104 /* Chart type invalid */
  57. #define _PG_BADLEGENDWINDOW 105 /* Invalid legend window specified */
  58. #define _PG_BADCHARTWINDOW 07 /* x1=x2 or y1=y2 in chart window spec. */
  59. #define _PG_BADDATAWINDOW 107 /* If chart window is too small */
  60. #define _PG_NOMEMORY 108 /* Not enough memory for data arrays */
  61. #define _PG_BADLOGBASE 05 /* Log base <= 0 */
  62. #define _PG_BADSCALEFACTOR 06 /* Scale factor = 0 */
  63. #define _PG_TOOSMALLN 109 /* Number of data points <= 0 */
  64. #define _PG_TOOFEWSERIES 110 /* Number of series <= 0 */
  65. /* Typedefs */
  66. /* Typedef for chart title */
  67. #ifndef _TITLETYPE_DEFINED
  68. typedef struct {
  69. char title[_PG_TITLELEN]; /* Title text */
  70. short titlecolor; /* Internal palette color for title text */
  71. short justify; /* _PG_LEFT, _PG_CENTER, _PG_RIGHT */
  72. } _titletype;
  73. #define _TITLETYPE_DEFINED
  74. #endif
  75. /* Typedef for chart axes */
  76. #ifndef _AXISTYPE_DEFINED
  77. typedef struct {
  78. short grid; /* TRUE=grid lines drawn; FALSE no lines */
  79. short gridstyle; /* Style number from style pool for grid lines */
  80. _titletype axistitle; /* Title definition for axis */
  81. short axiscolor; /* Color for axis */
  82. short labeled; /* TRUE=tic marks and titles drawn */
  83. short rangetype; /* _PG_LINEARAXIS, _PG_LOGAXIS */
  84. float logbase; /* Base used if log axis */
  85. short autoscale; /* TRUE=next 7 values calculated by system */
  86. float scalemin; /* Minimum value of scale */
  87. float scalemax; /* Maximum value of scale */
  88. float scalefactor; /* Scale factor for data on this axis */
  89. _titletype scaletitle; /* Title definition for scaling factor */
  90. float ticinterval; /* Distance between tic marks (world coord.) */
  91. short ticformat; /* _PG_EXPFORMAT or _PG_DECFORMAT for tic labels */
  92. short ticdecimals; /* Number of decimals for tic labels (max=9)*/
  93. } _axistype;
  94. #define _AXISTYPE_DEFINED
  95. #endif
  96. /* Typedef used for defining chart and data windows */
  97. #ifndef _WINDOWTYPE_DEFINED
  98. typedef struct {
  99. short x1; /* Left edge of window in pixels */
  100. short y1; /* Top edge of window in pixels */
  101. short x2; /* Right edge of window in pixels */
  102. short y2; /* Bottom edge of window in pixels */
  103. short border; /* TRUE for border, FALSE otherwise */
  104. short background; /* Internal palette color for window bgnd */
  105. short borderstyle; /* Style bytes for window border */
  106. short bordercolor; /* Internal palette color for window border */
  107. } _windowtype;
  108. #define _WINDOWTYPE_DEFINED
  109. #endif
  110. /* Typedef for legend definition */
  111. #ifndef _LEGENDTYPE_DEFINED
  112. typedef struct {
  113. short legend; /* TRUE=draw legend; FALSE=no legend */
  114. short place; /* _PG_RIGHT, _PG_BOTTOM, _PG_OVERLAY */
  115. short textcolor; /* Internal palette color for text */
  116. short autosize; /* TRUE=system calculates size */
  117. _windowtype legendwindow; /* Window definition for legend */
  118. } _legendtype;
  119. #define _LEGENDTYPE_DEFINED
  120. #endif
  121. /* Typedef for legend definition */
  122. #ifndef _CHARTENV_DEFINED
  123. typedef struct {
  124. short charttype; /* _PG_BARCHART, _PG_COLUMNCHART,
  125. _PG_LINECHART, _PG_SCATTERCHART,
  126. _PG_PIECHART */
  127. short chartstyle; /* Style for selected chart type */
  128. _windowtype chartwindow; /* Window definition for overall chart */
  129. _windowtype datawindow; /* Window definition for data part of chart */
  130. _titletype maintitle; /* Main chart title */
  131. _titletype subtitle; /* Chart sub-title */
  132. _axistype xaxis; /* Definition for X-axis */
  133. _axistype yaxis; /* Definition for Y-axis */
  134. _legendtype legend; /* Definition for legend */
  135. } _chartenv;
  136. #define _CHARTENV_DEFINED
  137. #endif
  138. /* Typedef for character bitmap */
  139. #ifndef _CHARMAP_DEFINED
  140. typedef unsigned char _charmap[8];
  141. #define _CHARMAP_DEFINED
  142. #endif
  143. /* Typedef for pattern bitmap */
  144. #ifndef _FILLMAP_DEFINED
  145. typedef unsigned char _fillmap[8];
  146. #define _FILLMAP_DEFINED
  147. #endif
  148. /* Typedef for palette entry definition */
  149. #ifndef _PALETTEENTRY_DEFINED
  150. typedef struct {
  151. unsigned short color;
  152. unsigned short style;
  153. _fillmap fill;
  154. char plotchar;
  155. } _paletteentry;
  156. #define _PALETTEENTRY_DEFINED
  157. #endif
  158. /* Typedef for palette definition */
  159. #ifndef _PALETTETYPE_DEFINED
  160. typedef _paletteentry _palettetype[_PG_PALETTELEN];
  161. #define _PALETTETYPE_DEFINED
  162. #endif
  163. /* Typedef for style sets */
  164. #ifndef _STYLESET_DEFINED
  165. typedef unsigned short _styleset[_PG_PALETTELEN];
  166. #define _STYLESET_DEFINED
  167. #endif
  168. #ifndef __STDC__
  169. /* Non-ANSI names for compatibility */
  170. #define titletype _titletype
  171. #define axistype _axistype
  172. #define windowtype _windowtype
  173. #define legendtype _legendtype
  174. #define chartenv _chartenv
  175. #define charmap _charmap
  176. #define fillmap _fillmap
  177. #define paletteentry _paletteentry
  178. #define palettetype _palettetype
  179. #define styleset _styleset
  180. #endif
  181. /* Function prototypes for charting routines */
  182. short __far __cdecl _pg_initchart(void);
  183. short __far __cdecl _pg_defaultchart(_chartenv __far *, short, short);
  184. short __far __cdecl _pg_chart(_chartenv __far *, const char __far * const __far *, const float __far *, short);
  185. short __far __cdecl _pg_chartms(_chartenv __far *, const char __far * const __far *, const float __far *, short, short, short, const char __far * const __far *);
  186. short __far __cdecl _pg_chartscatter(_chartenv __far *, const float __far *, const float __far *, short);
  187. short __far __cdecl _pg_chartscatterms(_chartenv __far *, const float __far *, const float __far *, short, short, short, const char __far * const __far *);
  188. short __far __cdecl _pg_chartpie(_chartenv __far *, const char __far * const __far *, const float __far *, const short __far *, short);
  189. /* Function prototypes for support routines */
  190. short __far __cdecl _pg_hlabelchart(_chartenv __far *, short, short, short, const char __far *);
  191. short __far __cdecl _pg_vlabelchart(_chartenv __far *, short, short, short, const char __far *);
  192. short __far __cdecl _pg_analyzechart(_chartenv __far *, const char __far * const __far *, const float __far *, short);
  193. short __far __cdecl _pg_analyzechartms(_chartenv __far *, const char __far * const __far *, const float __far *, short, short, short, const char __far * const __far *);
  194. short __far __cdecl _pg_analyzescatter(_chartenv __far *, const float __far *, const float __far *, short);
  195. short __far __cdecl _pg_analyzescatterms(_chartenv __far *, const float __far *, const float __far *, short, short, short, const char __far * const __far *);
  196. short __far __cdecl _pg_analyzepie(_chartenv __far *, const char __far * const __far *, const float __far *, const short __far *, short);
  197. short __far __cdecl _pg_getpalette(_paletteentry __far *);
  198. short __far __cdecl _pg_setpalette(const _paletteentry __far *);
  199. short __far __cdecl _pg_resetpalette(void);
  200. void __far __cdecl _pg_getstyleset(unsigned short __far *);
  201. void __far __cdecl _pg_setstyleset(const unsigned short __far *);
  202. void __far __cdecl _pg_resetstyleset(void);
  203. short __far __cdecl _pg_getchardef(short, unsigned char __far *);
  204. short __far __cdecl _pg_setchardef(short, const unsigned char __far *);
  205. /* Restore default packing */
  206. #pragma pack()
  207. #ifdef __cplusplus
  208. }
  209. #endif