Initial release of Maemo 5 port of gnuplot
[gnuplot] / src / graphics.h
1 /*
2  * $Id: graphics.h,v 1.34.2.2 2008/02/28 22:58:25 sfeam Exp $
3  */
4
5 /* GNUPLOT - graphics.h */
6
7 /*[
8  * Copyright 1999, 2004
9  *
10  * Permission to use, copy, and distribute this software and its
11  * documentation for any purpose with or without fee is hereby granted,
12  * provided that the above copyright notice appear in all copies and
13  * that both that copyright notice and this permission notice appear
14  * in supporting documentation.
15  *
16  * Permission to modify the software is granted, but not the right to
17  * distribute the complete modified source code.  Modifications are to
18  * be distributed as patches to the released version.  Permission to
19  * distribute binaries produced by compiling modified sources is granted,
20  * provided you
21  *   1. distribute the corresponding source modifications from the
22  *    released version in the form of a patch file along with the binaries,
23  *   2. add special version identification to distinguish your version
24  *    in addition to the base release version number,
25  *   3. provide your name and address as the primary contact for the
26  *    support of your modified version, and
27  *   4. retain our contact information in regard to use of the base
28  *    software.
29  * Permission to distribute the released version of the source code along
30  * with corresponding source modifications in the form of a patch file is
31  * granted with same provisions 2 through 4 for binary distributions.
32  *
33  * This software is provided "as is" without express or implied warranty
34  * to the extent permitted by applicable law.
35 ]*/
36
37 #ifndef GNUPLOT_GRAPHICS_H
38 # define GNUPLOT_GRAPHICS_H
39
40 #include "syscfg.h"
41 #include "gp_types.h"
42
43 #include "gadgets.h"
44 #include "term_api.h"
45
46 /* types defined for 2D plotting */
47
48 typedef struct curve_points {
49     struct curve_points *next;  /* pointer to next plot in linked list */
50     int token;                  /* last token nr., for second pass */
51     enum PLOT_TYPE plot_type;   /* data, function? 3D? */
52     enum PLOT_STYLE plot_style; /* which "with" option in use? */
53     enum PLOT_SMOOTH plot_smooth; /* which "smooth" method to be used? */
54     char *title;                /* plot title, a.k.a. key entry */
55     TBOOLEAN title_no_enhanced; /* don't typeset title in enhanced mode */
56     TBOOLEAN title_is_filename; /* TRUE if title was auto-generated from filename */
57     TBOOLEAN title_is_suppressed;/* TRUE if 'notitle' was specified */
58     struct lp_style_type lp_properties;
59     struct arrow_style_type arrow_properties;
60     struct fill_style_type fill_properties;
61     int p_max;                  /* how many points are allocated */
62     int p_count;                /* count of points in points */
63     int x_axis;                 /* FIRST_X_AXIS or SECOND_X_AXIS */
64     int y_axis;                 /* FIRST_Y_AXIS or SECOND_Y_AXIS */
65     /* HBB 20000504: new field */
66     int z_axis;                 /* same as either x_axis or y_axis, for 5-column plot types */
67     /* pm 5.1.2002: new field */
68     filledcurves_opts filledcurves_options;
69     struct coordinate GPHUGE *points;
70 #ifdef EAM_DATASTRINGS
71     struct text_label *labels;  /* Only used if plot_style == LABELPOINTS */
72 #endif
73 #ifdef EAM_HISTOGRAMS
74     struct histogram_style *histogram;  /* Only used if plot_style == HISTOGRAM */
75     int histogram_sequence;     /* Ordering of this dataset within the histogram */
76 #endif
77 } curve_points;
78
79 /* From ESR's "Actual code patch" :) */
80 /* An exclusion box.
81  * Right now, the only exclusion region is the key box, but that will
82  * change when we support boxed labels.
83  */
84 struct clipbox {
85     int xl;
86     int xr;
87     int yt;
88     int yb;
89 };
90
91 /* externally visible variables of graphics.h */
92
93 /* 'set offset' status variables */
94 extern double loff, roff, toff, boff;
95
96 /* 'set bar' status */
97 extern double bar_size;
98
99 /* function prototypes */
100
101 void do_plot __PROTO((struct curve_points *, int));
102 int label_width __PROTO((const char *, int *));
103 void map_position __PROTO((struct position * pos, int *x, int *y, const char *what));
104 void map_position_r __PROTO((struct position* pos, double* x, double* y,
105                              const char* what));
106 #if defined(sun386) || defined(AMIGA_SC_6_1)
107 double CheckLog __PROTO((TBOOLEAN, double, double));
108 #endif
109 void apply_head_properties __PROTO((struct arrow_style_type *arrow_properties));
110
111 #ifdef EAM_HISTOGRAMS
112 void init_histogram __PROTO((struct histogram_style *hist, char *title));
113 void free_histlist __PROTO((struct histogram_style *hist));
114 #endif
115
116 #ifdef WITH_IMAGE
117 void plot_image_or_update_axes __PROTO((void *plot, t_imagecolor pixel_planes,
118                                         TBOOLEAN map_points, TBOOLEAN update_axes));
119 #define PLOT_IMAGE(plot, pixel_planes) \
120         plot_image_or_update_axes(plot, pixel_planes, FALSE, FALSE)
121 #define UPDATE_AXES_FOR_PLOT_IMAGE(plot, pixel_planes) \
122         plot_image_or_update_axes(plot, pixel_planes, FALSE, TRUE)
123 #define SPLOT_IMAGE(plot, pixel_planes) \
124         plot_image_or_update_axes(plot, pixel_planes, TRUE, FALSE)
125 #endif
126
127 #ifdef EAM_OBJECTS
128 void place_rectangles __PROTO((struct object *listhead, int layer, int dimensions, BoundingBox *clip_area));
129 #else
130 #define place_rectangles(listhead,layer,dimensions,clip_area) /* void() */
131 #endif
132
133 #endif /* GNUPLOT_GRAPHICS_H */