1
/* $Id: plplot.h,v 1.154 2004/06/14 21:51:57 rlaboiss Exp $
1
/* $Id: plplot.h,v 1.175 2006/05/13 05:22:43 airwin Exp $
3
3
Macros and prototypes for the PLplot package. This header file must
4
4
be included by all user codes.
28
28
You should have received a copy of the GNU Library General Public License
29
29
along with PLplot; if not, write to the Free Software
30
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33
33
#ifndef __PLPLOT_H__
115
115
* Only those that are necessary for function prototypes are defined here.
118
* PLINT is typedef'd to an int by default. This is a change from some
119
* previous versions, where a long was used. Under MSDOS, a PLINT is
120
* typedef'd to a long, since 16 bits is too inaccurate for some PLplot
121
* functions. So under MSDOS you must use type PLINT for integer array
122
* arguments to PLplot functions, but on other systems you can just use
118
* PLINT is typedef'd to a long by default. This is a change from some
119
* previous versions, where a int was used. However, so long as you have
120
* used type PLINT for integer array arguments as specified by the API,
121
* this change will be transparent for you.
125
123
* short is currently used for device page coordinates, so they are
126
124
* bounded by (-32767, 32767). This gives a max resolution of about 3000
127
125
* dpi, and improves performance in some areas over using a PLINT.
127
* PLUNICODE should be a 32-bit unsigned integer on all platforms.
128
* For now, we are using unsigned int for our Linux ix86 unicode experiments,
129
* but that doesn't guarantee 32 bits exactly on all platforms so this will
130
* be subject to change.
128
131
\*--------------------------------------------------------------------------*/
130
133
#if defined(PL_DOUBLE) || defined(DOUBLE)
137
140
#define PLFLT_MIN FLT_MIN
140
#if defined(MSDOS) && !defined(__WIN32__)
143
#if (defined(HAVE_STDINT_H) && !defined(__cplusplus)) ||\
144
(defined(__cplusplus) && defined(HAVE_CXX_STDINT_H))
146
/* This is apparently portable if stdint.h exists. */
147
typedef uint32_t PLUNICODE;
148
typedef int32_t PLINT;
150
/* A reasonable back-up in case stdint.h does not exist on the platform. */
151
typedef unsigned int PLUNICODE;
143
152
typedef int PLINT;
155
/* For identifying logical (boolean) arguments */
156
typedef PLINT PLBOOL;
146
158
/* For passing user data, as with X's XtPointer */
148
160
typedef void* PLPointer;
225
237
#define PL_PARSE_NODASH 0x0040 /* Set if leading dash NOT required */
226
238
#define PL_PARSE_SKIP 0x0080 /* Skip over unrecognized args */
240
/* FCI (font characterization integer) related constants. */
241
#define PL_FCI_MARK 0x80000000
242
#define PL_FCI_IMPOSSIBLE 0x00000000
243
#define PL_FCI_HEXDIGIT_MASK 0xf
244
#define PL_FCI_HEXPOWER_MASK 0x7
245
#define PL_FCI_HEXPOWER_IMPOSSIBLE 0xf
246
/* These define hexpower values corresponding to each font attribute. */
247
#define PL_FCI_FAMILY 0x0
248
#define PL_FCI_STYLE 0x1
249
#define PL_FCI_WEIGHT 0x2
250
/* These are legal values for font family attribute */
251
#define PL_FCI_SANS 0x0
252
#define PL_FCI_SERIF 0x1
253
#define PL_FCI_MONO 0x2
254
#define PL_FCI_SCRIPT 0x3
255
#define PL_FCI_SYMBOL 0x4
256
/* These are legal values for font style attribute */
257
#define PL_FCI_UPRIGHT 0x0
258
#define PL_FCI_ITALIC 0x1
259
#define PL_FCI_OBLIQUE 0x2
260
/* These are legal values for font weight attribute */
261
#define PL_FCI_MEDIUM 0x0
262
#define PL_FCI_BOLD 0x1
228
264
/* Obsolete names */
230
#define plParseInternalOpts(a, b, c) plParseOpts(a, b, c)
266
#define plParseInternalOpts(a, b, c) c_plparseopts(a, b, c)
231
267
#define plSetInternalOpt(a, b) plSetOpt(a, b)
233
268
/* Option table definition */
460
495
#define plgdiori c_plgdiori
461
496
#define plgdiplt c_plgdiplt
462
497
#define plgfam c_plgfam
498
#define plgfci c_plgfci
463
499
#define plgfnam c_plgfnam
464
500
#define plglevel c_plglevel
465
501
#define plgpage c_plgpage
614
656
c_plvect(PLFLT **u, PLFLT **v, PLINT nx, PLINT ny, PLFLT scale,
615
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
616
PLPointer pltr_data);
657
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
658
PLPointer pltr_data);
619
c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLINT fill);
661
c_plsvect(PLFLT *arrowx, PLFLT *arrowy, PLINT npts, PLBOOL fill);
621
663
/* This functions similarly to plbox() except that the origin of the axes */
622
664
/* is placed at the user-specified point (x0, y0). */
628
670
/* Plot a histogram using x to store data values and y to store frequencies */
672
/* Flags for plbin() - opt argument */
673
#define PL_BIN_DEFAULT 0
674
#define PL_BIN_CENTRED 1
675
#define PL_BIN_NOEXPAND 2
676
#define PL_BIN_NOEMPTY 4
631
c_plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT center);
679
c_plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT opt);
633
681
/* Start new page. Should only be used with pleop(). */
694
742
/* Copies state parameters from the reference stream to the current stream. */
697
c_plcpstrm(PLINT iplsr, PLINT flags);
745
c_plcpstrm(PLINT iplsr, PLBOOL flags);
699
747
/* Converts input values from relative device coordinates to relative plot */
700
748
/* coordinates. */
818
866
c_plgdiplt(PLFLT *p_xmin, PLFLT *p_ymin, PLFLT *p_xmax, PLFLT *p_ymax);
868
/* Get FCI (font characterization integer) */
871
c_plgfci(PLUNICODE *pfci);
820
873
/* Get family file parameters */
902
955
/* Draws a histogram of n values of a variable in array data[0..n-1] */
957
/* Flags for plhist() - opt argument; note: some flags are passed to
958
plbin() for the actual plotting */
959
#define PL_HIST_DEFAULT 0
960
#define PL_HIST_NOSCALING 1
961
#define PL_HIST_IGNORE_OUTLIERS 2
962
#define PL_HIST_NOEXPAND 8
963
#define PL_HIST_NOEMPTY 16
905
966
c_plhist(PLINT n, PLFLT *data, PLFLT datmin, PLFLT datmax,
906
PLINT nbin, PLINT oldwin);
967
PLINT nbin, PLINT opt);
908
969
/* Set current color (map 0) by hue, lightness, and saturation. */
911
972
c_plhls(PLFLT h, PLFLT l, PLFLT s);
974
/* Functions for converting between HLS and RGB color space */
977
c_plhlsrgb(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b);
913
979
/* Initializes PLplot, using preset or default options */
947
1013
/* plot continental outline in world coordinates */
950
plmap( void (*mapform)(PLINT, PLFLT *, PLFLT *), char *type,
1016
c_plmap( void (*mapform)(PLINT, PLFLT *, PLFLT *), char *type,
951
1017
PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
953
1019
/* Plot the latitudes and longitudes on the background. */
956
plmeridians( void (*mapform)(PLINT, PLFLT *, PLFLT *),
1022
c_plmeridians( void (*mapform)(PLINT, PLFLT *, PLFLT *),
957
1023
PLFLT dlong, PLFLT dlat,
958
1024
PLFLT minlong, PLFLT maxlong, PLFLT minlat, PLFLT maxlat );
985
1051
c_plot3d(PLFLT *x, PLFLT *y, PLFLT **z,
986
PLINT nx, PLINT ny, PLINT opt, PLINT side);
1052
PLINT nx, PLINT ny, PLINT opt, PLBOOL side);
988
1054
/* Plots a 3-d representation of the function z[x][y] with contour. */
999
1065
c_plot3dcl(PLFLT *x, PLFLT *y, PLFLT **z,
1000
1066
PLINT nx, PLINT ny, PLINT opt,
1001
PLFLT *clevel, PLINT nlevel,
1067
PLFLT *clevel, PLINT nlevel,
1002
1068
PLINT ixstart, PLINT ixn, PLINT *indexymin, PLINT*indexymax);
1047
1113
/* Draws a polygon in 3 space. */
1050
c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLINT *draw, PLINT ifcc);
1116
c_plpoly3(PLINT n, PLFLT *x, PLFLT *y, PLFLT *z, PLBOOL *draw, PLBOOL ifcc);
1052
1118
/* Set the floating point precision (in number of places) in numeric labels. */
1080
1146
c_plrgb1(PLINT r, PLINT g, PLINT b);
1148
/* Functions for converting between HLS and RGB color space */
1151
c_plrgbhls(PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s);
1082
1153
/* Set character height. */
1103
1174
/* intensity [0,1] (cmap 1 index) and position in HLS or RGB color space. */
1106
c_plscmap1l(PLINT itype, PLINT npts, PLFLT *intensity,
1107
PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLINT *rev);
1177
c_plscmap1l(PLBOOL itype, PLINT npts, PLFLT *intensity,
1178
PLFLT *coord1, PLFLT *coord2, PLFLT *coord3, PLBOOL *rev);
1109
1180
/* Set number of colors in cmap 1 */
1187
1263
PLINT sh_cmap, PLFLT sh_color, PLINT sh_width,
1188
1264
PLINT min_color, PLINT min_width,
1189
1265
PLINT max_color, PLINT max_width,
1190
void (*fill) (PLINT, PLFLT *, PLFLT *), PLINT rectangular,
1266
void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
1191
1267
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
1192
1268
PLPointer pltr_data);
1198
1274
PLINT sh_cmap, PLFLT sh_color, PLINT sh_width,
1199
1275
PLINT min_color, PLINT min_width,
1200
1276
PLINT max_color, PLINT max_width,
1201
void (*fill) (PLINT, PLFLT *, PLFLT *), PLINT rectangular,
1277
void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
1202
1278
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
1203
1279
PLPointer pltr_data);
1207
1283
PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax,
1208
1284
PLFLT *clevel, PLINT nlevel, PLINT fill_width,
1209
1285
PLINT cont_color, PLINT cont_width,
1210
void (*fill) (PLINT, PLFLT *, PLFLT *), PLINT rectangular,
1286
void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
1211
1287
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
1212
1288
PLPointer pltr_data);
1222
1298
PLINT sh_cmap, PLFLT sh_color, PLINT sh_width,
1223
1299
PLINT min_color, PLINT min_width,
1224
1300
PLINT max_color, PLINT max_width,
1225
void (*fill) (PLINT, PLFLT *, PLFLT *), PLINT rectangular,
1301
void (*fill) (PLINT, PLFLT *, PLFLT *), PLBOOL rectangular,
1226
1302
void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer),
1227
1303
PLPointer pltr_data);
1293
1369
c_plstripc(PLINT *id, char *xspec, char *yspec,
1294
1370
PLFLT xmin, PLFLT xmax, PLFLT xjump, PLFLT ymin, PLFLT ymax,
1295
1371
PLFLT xlpos, PLFLT ylpos,
1296
PLINT y_ascl, PLINT acc,
1372
PLBOOL y_ascl, PLBOOL acc,
1297
1373
PLINT colbox, PLINT collab,
1298
1374
PLINT colline[], PLINT styline[], char *legline[],
1299
1375
char *labx, char *laby, char *labtop);
1407
1483
/* set xor mode; mode = 1-enter, 0-leave, status = 0 if not interactive device */
1410
c_plxormod(PLINT mode, PLINT *status);
1486
c_plxormod(PLBOOL mode, PLBOOL *status);
1412
1488
/*--------------------------------------------------------------------------*\
1413
1489
* Functions for use from C or C++ only
1495
1571
pltr2f(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, void *pltr_data);
1497
/* Example linear transformation function for contour plotter. */
1500
xform(PLFLT x, PLFLT y, PLFLT * tx, PLFLT * ty);
1502
1573
/* Function evaluators */
1504
1575
/* Does a lookup from a 2d function array. Array is of type (PLFLT **), */
1554
1625
/* Process options list using current options info. */
1557
plParseOpts(int *p_argc, char **argv, PLINT mode);
1628
c_plparseopts(int *p_argc, char **argv, PLINT mode);
1559
1630
/* Print usage & syntax message. */
1627
1698
plMinMax2dGrid(PLFLT **f, PLINT nx, PLINT ny, PLFLT *fmax, PLFLT *fmin);
1629
/* Functions for converting between HLS and RGB color space */
1632
plHLS_RGB(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b);
1635
plRGB_HLS(PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s);
1637
1700
/* Wait for graphics input event and translate to world coordinates */
1645
1708
plTranslateCursor(PLGraphicsIn *gin);
1710
/* Deprecated function names which are handled as wrappers for strict
1711
* backwards compatibility of the library API*/
1714
plParseOpts(int *p_argc, char **argv, PLINT mode);
1717
plHLS_RGB(PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b);
1720
plRGB_HLS(PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s);
1647
1721
#ifdef __cplusplus