Initial release of Maemo 5 port of gnuplot
[gnuplot] / src / pm3d.h
1 /*
2  * $Id: pm3d.h,v 1.26 2006/06/15 15:42:33 sfeam Exp $
3  */
4
5 /* GNUPLOT - pm3d.h */
6
7 /*[
8  *
9  * Petr Mikulik, since December 1998
10  * Copyright: open source as much as possible
11  *
12  *
13  * What is here: #defines, global variables and declaration of routines for
14  * the pm3d plotting mode
15  *
16 ]*/
17
18
19 /* avoid multiple includes */
20 #ifdef HAVE_CONFIG_H
21 #   include "config.h"
22 #endif
23
24 #ifndef TERM_HELP
25
26 #ifndef PM3D_H
27 #define PM3D_H
28
29 #include "graph3d.h" /* struct surface_points */
30
31
32
33 /****
34   Global options for pm3d algorithm (to be accessed by set / show)
35 ****/
36
37 /* HBB NEW 20040311: setting this to 0 removes the pm3d option
38  * {transparent|solid} --- it's a duplicate of 'set grid front' */
39 #ifndef PM3D_HAVE_SOLID
40 # define PM3D_HAVE_SOLID 0
41 #endif
42
43 /*
44   where to plot pm3d: base or top (color map) or surface (color surface)
45   The string pm3d.where can be any combination of the #defines below.
46   For instance, "b" plot at botton only, "st" plots firstly surface, then top, etc.
47 */
48 #define PM3D_AT_BASE    'b'
49 #define PM3D_AT_TOP     't'
50 #define PM3D_AT_SURFACE 's'
51
52 /*
53   options for flushing scans (for pm3d.flush)
54   Note: new terminology compared to my pm3d program; in gnuplot it became
55   begin and right instead of left and right
56 */
57 #define PM3D_FLUSH_BEGIN   'b'
58 #define PM3D_FLUSH_END     'r'
59 #define PM3D_FLUSH_CENTER  'c'
60
61 /*
62   direction of taking the scans: forward = as the scans are stored in the
63   file; backward = opposite direction, i.e. like from the end of the file
64 */
65 #define PM3D_SCANS_AUTOMATIC  'a'
66 #define PM3D_SCANS_FORWARD    'f'
67 #define PM3D_SCANS_BACKWARD   'b'
68 #define PM3D_DEPTH            'd'
69
70 /*
71   clipping method:
72     PM3D_CLIP_1IN: all 4 points of the quadrangle must be defined and at least
73                    1 point of the quadrangle must be in the x and y ranges
74     PM3D_CLIP_4IN: all 4 points of the quadrangle must be in the x and y ranges
75 */
76 #define PM3D_CLIP_1IN '1'
77 #define PM3D_CLIP_4IN '4'
78
79 /*
80   is pm3d plotting style implicit or explicit?
81 */
82 typedef enum {
83     PM3D_EXPLICIT = 0,
84     PM3D_IMPLICIT = 1
85 } PM3D_IMPL_MODE;
86
87 /*
88   from which corner take the color?
89 */
90 typedef enum {
91     /* keep the following order of PM3D_WHICHCORNER_C1 .. _C4 */
92     PM3D_WHICHCORNER_C1 = 0,    /* corner 1: first scan, first point   */
93     PM3D_WHICHCORNER_C2 = 1,    /* corner 2: first scan, second point  */
94     PM3D_WHICHCORNER_C3 = 2,    /* corner 3: second scan, first point  */
95     PM3D_WHICHCORNER_C4 = 3,    /* corner 4: second scan, second point */
96     /* now in any order */
97     PM3D_WHICHCORNER_MEAN    = 4, /* average z-value from all 4 corners */
98     PM3D_WHICHCORNER_GEOMEAN = 5, /* geometrical mean of 4 corners */
99     PM3D_WHICHCORNER_MEDIAN  = 6, /* median of 4 corners */
100     PM3D_WHICHCORNER_MIN     = 7, /* minimum of 4 corners */
101     PM3D_WHICHCORNER_MAX     = 8  /* maximum of 4 corners */
102 } PM3D_WHICH_CORNERS2COLOR;
103
104 /*
105   structure defining all properties of pm3d plotting mode
106   (except for the properties of the smooth color box, see color_box instead)
107 */
108 typedef struct {
109   char where[7];        /* base, top, surface */
110   char flush;           /* left, right, center */
111   char ftriangles;      /* 0/1 (don't) draw flushing triangles */
112   char direction;       /* forward, backward */
113   char clip;            /* 1in, 4in */
114   int hidden3d_tag;     /* if this is > 0, pm3d hidden lines are drawn with
115                            this linestyle (which must naturally present). */
116 #if PM3D_HAVE_SOLID
117   int solid;            /* if this is != 0, border tics and labels might be
118                            hidden by the surface */
119 #endif
120   PM3D_IMPL_MODE implicit;
121                         /* 1: [default] draw ALL surfaces with pm3d
122                            0: only surfaces specified with 'with pm3d' */
123   PM3D_WHICH_CORNERS2COLOR which_corner_color;
124                         /* default: average color from all 4 points */
125   int interp_i;         /* # of interpolation steps along scanline */
126   int interp_j;         /* # of interpolation steps between scanlines */
127 } pm3d_struct;
128
129
130 extern pm3d_struct pm3d;
131
132
133 /****
134   Declaration of routines
135 ****/
136
137 int get_pm3d_at_option __PROTO((char *pm3d_where));
138 void pm3d_depth_queue_clear __PROTO((void));
139 void pm3d_depth_queue_flush __PROTO((void));
140 void pm3d_reset __PROTO((void));
141 void pm3d_draw_one __PROTO((struct surface_points* plots));
142 double z2cb __PROTO((double z));
143 double cb2gray __PROTO((double cb));
144 void
145 pm3d_rearrange_scan_array __PROTO((struct surface_points* this_plot,
146     struct iso_curve*** first_ptr, int* first_n, int* first_invert,
147     struct iso_curve*** second_ptr, int* second_n, int* second_invert));
148
149 void set_plot_with_palette __PROTO((int plot_num, int plot_mode));
150
151 TBOOLEAN is_plot_with_palette __PROTO((void));
152 TBOOLEAN is_plot_with_colorbox __PROTO((void));
153
154 #endif /* PM3D_H */
155
156 #endif /* TERM_HELP */
157
158 /* eof pm3d.h */