tioga 1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/Tioga_README +372 -0
  2. data/lgpl.txt +504 -0
  3. data/split/Dtable/defs.h +33 -0
  4. data/split/Dtable/dtable.c +1928 -0
  5. data/split/Dtable/dtable_intern.h +144 -0
  6. data/split/Dtable/dvector.h +61 -0
  7. data/split/Dtable/extconf.rb +4 -0
  8. data/split/Dtable/include/dtable.h +35 -0
  9. data/split/Dtable/lib/Dtable_extras.rb +90 -0
  10. data/split/Dtable/namespace.h +47 -0
  11. data/split/Dtable/safe_double.h +104 -0
  12. data/split/Dtable/symbols.c +92 -0
  13. data/split/Dtable/symbols.h +52 -0
  14. data/split/Dvector/defs.h +33 -0
  15. data/split/Dvector/dvector.c +5486 -0
  16. data/split/Dvector/dvector_intern.h +142 -0
  17. data/split/Dvector/extconf.rb +4 -0
  18. data/split/Dvector/include/dvector.h +61 -0
  19. data/split/Dvector/lib/Dvector_extras.rb +328 -0
  20. data/split/Dvector/lib/Numeric_extras.rb +134 -0
  21. data/split/Dvector/namespace.h +47 -0
  22. data/split/Dvector/safe_double.h +104 -0
  23. data/split/Dvector/symbols.c +92 -0
  24. data/split/Dvector/symbols.h +52 -0
  25. data/split/Flate/defs.h +33 -0
  26. data/split/Flate/extconf.rb +19 -0
  27. data/split/Flate/flate.c +156 -0
  28. data/split/Flate/flate_intern.h +97 -0
  29. data/split/Flate/include/flate.h +98 -0
  30. data/split/Flate/namespace.h +47 -0
  31. data/split/Flate/safe_double.h +104 -0
  32. data/split/Flate/symbols.c +92 -0
  33. data/split/Flate/symbols.h +52 -0
  34. data/split/Function/defs.h +33 -0
  35. data/split/Function/dvector.h +61 -0
  36. data/split/Function/extconf.rb +4 -0
  37. data/split/Function/function.c +988 -0
  38. data/split/Function/joint_qsort.c +258 -0
  39. data/split/Function/lib/Function_extras.rb +44 -0
  40. data/split/Function/namespace.h +47 -0
  41. data/split/Function/safe_double.h +104 -0
  42. data/split/Function/symbols.c +92 -0
  43. data/split/Function/symbols.h +52 -0
  44. data/split/Tioga/axes.c +774 -0
  45. data/split/Tioga/defs.h +33 -0
  46. data/split/Tioga/dtable.h +35 -0
  47. data/split/Tioga/dvector.h +61 -0
  48. data/split/Tioga/extconf.rb +4 -0
  49. data/split/Tioga/figures.c +672 -0
  50. data/split/Tioga/figures.h +855 -0
  51. data/split/Tioga/flate.h +98 -0
  52. data/split/Tioga/init.c +524 -0
  53. data/split/Tioga/lib/Arcs_and_Circles.rb +64 -0
  54. data/split/Tioga/lib/ColorConstants.rb +274 -0
  55. data/split/Tioga/lib/Colorbars.rb +10 -0
  56. data/split/Tioga/lib/Colormaps.rb +105 -0
  57. data/split/Tioga/lib/Coordinate_Conversions.rb +194 -0
  58. data/split/Tioga/lib/Creating_Paths.rb +94 -0
  59. data/split/Tioga/lib/Doc.rb +91 -0
  60. data/split/Tioga/lib/Executive.rb +515 -0
  61. data/split/Tioga/lib/FigMkr.rb +2224 -0
  62. data/split/Tioga/lib/FigureConstants.rb +125 -0
  63. data/split/Tioga/lib/Figures_and_Plots.rb +268 -0
  64. data/split/Tioga/lib/Images.rb +278 -0
  65. data/split/Tioga/lib/Legends.rb +190 -0
  66. data/split/Tioga/lib/MarkerConstants.rb +122 -0
  67. data/split/Tioga/lib/Markers.rb +129 -0
  68. data/split/Tioga/lib/Page_Frame_Bounds.rb +567 -0
  69. data/split/Tioga/lib/Rectangles.rb +94 -0
  70. data/split/Tioga/lib/Shading.rb +100 -0
  71. data/split/Tioga/lib/Special_Paths.rb +307 -0
  72. data/split/Tioga/lib/Strokes.rb +129 -0
  73. data/split/Tioga/lib/TeX_Text.rb +454 -0
  74. data/split/Tioga/lib/TexPreamble.rb +358 -0
  75. data/split/Tioga/lib/Titles_and_Labels.rb +306 -0
  76. data/split/Tioga/lib/Transparency.rb +89 -0
  77. data/split/Tioga/lib/Using_Paths.rb +164 -0
  78. data/split/Tioga/lib/Utils.rb +74 -0
  79. data/split/Tioga/lib/X_and_Y_Axes.rb +749 -0
  80. data/split/Tioga/lib/irb_tioga.rb +122 -0
  81. data/split/Tioga/lib/tioga.rb +1 -0
  82. data/split/Tioga/lib/tioga_ui.rb +5 -0
  83. data/split/Tioga/lib/tioga_ui_cmds.rb +793 -0
  84. data/split/Tioga/makers.c +989 -0
  85. data/split/Tioga/mk_tioga_sty.rb +53 -0
  86. data/split/Tioga/namespace.h +47 -0
  87. data/split/Tioga/pdf_font_dicts.c +18253 -0
  88. data/split/Tioga/pdfcolor.c +486 -0
  89. data/split/Tioga/pdfcoords.c +505 -0
  90. data/split/Tioga/pdffile.c +342 -0
  91. data/split/Tioga/pdfimage.c +536 -0
  92. data/split/Tioga/pdfpath.c +914 -0
  93. data/split/Tioga/pdfs.h +229 -0
  94. data/split/Tioga/pdftext.c +443 -0
  95. data/split/Tioga/safe_double.h +104 -0
  96. data/split/Tioga/symbols.c +92 -0
  97. data/split/Tioga/symbols.h +52 -0
  98. data/split/Tioga/texout.c +380 -0
  99. data/split/defs.h +33 -0
  100. data/split/extconf.rb +107 -0
  101. data/split/mkmf2.rb +1612 -0
  102. data/split/namespace.h +47 -0
  103. data/split/safe_double.h +104 -0
  104. data/split/scripts/tioga +4 -0
  105. data/split/symbols.c +92 -0
  106. data/split/symbols.h +52 -0
  107. data/tests/dtable_test.data +6 -0
  108. data/tests/dvector_read_test.data +1 -0
  109. data/tests/dvector_test.data +101 -0
  110. data/tests/tc_Dtable.rb +221 -0
  111. data/tests/tc_Dvector.rb +791 -0
  112. data/tests/tc_FMkr.rb +162 -0
  113. data/tests/tc_Flate.rb +45 -0
  114. data/tests/tc_Function.rb +111 -0
  115. data/tests/ts_Tioga.rb +38 -0
  116. metadata +163 -0
@@ -0,0 +1,855 @@
1
+ /* figures.h */
2
+ /*
3
+ Copyright (C) 2005 Bill Paxton
4
+
5
+ This file is part of Tioga.
6
+
7
+ Tioga is free software; you can redistribute it and/or modify
8
+ it under the terms of the GNU General Library Public License as published
9
+ by the Free Software Foundation; either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ Tioga is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU Library General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Library General Public License
18
+ along with Tioga; if not, write to the Free Software
19
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ */
21
+
22
+ #ifndef __figures_H__
23
+ #define __figures_H__
24
+
25
+ #include <namespace.h>
26
+
27
+ #include <math.h>
28
+ #include <stdbool.h>
29
+ #include <ctype.h>
30
+ #include "dvector.h"
31
+ #include "dtable.h"
32
+ #include "ruby.h"
33
+ #include "intern.h"
34
+
35
+ // Axes
36
+
37
+ #define NO_TICKS 0
38
+ #define MAJOR_TICKS_ONLY 1
39
+ #define MAJOR_AND_MINOR_TICKS 2
40
+
41
+ // Y Label Orientation
42
+
43
+ #define VERTICAL_BOTTOM_TO_TOP 0
44
+ #define HORIZONTAL 1
45
+ #define VERTICAL_TOP_TO_BOTTOM 2
46
+
47
+ // Frame Sides
48
+
49
+ #define LEFT 0
50
+ #define RIGHT 1
51
+ #define TOP 2
52
+ #define BOTTOM 3
53
+
54
+ // PlotAxis locations = Frame Sides plus the following
55
+
56
+ #define AT_X_ORIGIN 4
57
+ #define AT_Y_ORIGIN 5
58
+
59
+ // axis types
60
+
61
+ #define AXIS_HIDDEN 0
62
+ #define AXIS_LINE_ONLY 1
63
+ #define AXIS_WITH_MAJOR_TICKS_ONLY 2
64
+ #define AXIS_WITH_TICKS_ONLY 3
65
+ #define AXIS_WITH_MAJOR_TICKS_AND_NUMERIC_LABELS 4
66
+ #define AXIS_WITH_TICKS_AND_NUMERIC_LABELS 5
67
+
68
+ // edge types
69
+
70
+ #define EDGE_HIDDEN 0
71
+ #define EDGE_LINE_ONLY 1
72
+ #define EDGE_WITH_MAJOR_TICKS_ONLY 2
73
+ #define EDGE_WITH_TICKS 3
74
+
75
+ // Lines
76
+
77
+ #define LINE_CAP_BUTT 0
78
+ #define LINE_CAP_ROUND 1
79
+ #define LINE_CAP_SQUARE 2
80
+
81
+ #define LINE_JOIN_MITER 0
82
+ #define LINE_JOIN_ROUND 1
83
+ #define LINE_JOIN_BEVEL 2
84
+
85
+ // Text and Markers
86
+
87
+ #define LEFT_JUSTIFIED -1
88
+ #define CENTERED 0
89
+ #define RIGHT_JUSTIFIED 1
90
+
91
+ #define ALIGNED_AT_TOP 0
92
+ #define ALIGNED_AT_MIDHEIGHT 1
93
+ #define ALIGNED_AT_BASELINE 2
94
+ #define ALIGNED_AT_BOTTOM 3
95
+
96
+ // Rendering Modes
97
+
98
+ #define FILL 0
99
+ #define STROKE 1
100
+ #define FILL_AND_STROKE 2
101
+ #define DISCARD 3
102
+ #define FILL_AND_CLIP 4
103
+ #define STROKE_AND_CLIP 5
104
+ #define FILL_STROKE_AND_CLIP 6
105
+ #define CLIP 7
106
+
107
+ typedef struct {
108
+
109
+ /* page attributes */
110
+ bool root_figure;
111
+ bool in_subplot;
112
+ double page_left, page_bottom, page_top, page_right, page_width, page_height;
113
+ // in output units. READ ONLY from Ruby.
114
+
115
+ /* frame and bounds attributes. READ ONLY from Ruby. */
116
+ // frame location as fractions of page width & height.
117
+ double frame_left, frame_right, frame_top, frame_bottom, frame_width, frame_height;
118
+ // bounds in figure coords.
119
+ double bounds_left, bounds_right, bounds_top, bounds_bottom;
120
+ double bounds_xmin, bounds_xmax, bounds_ymin, bounds_ymax;
121
+ double bounds_width, bounds_height;
122
+ bool xaxis_reversed, yaxis_reversed;
123
+
124
+ /* text attributes */
125
+ int justification;
126
+ int alignment;
127
+
128
+ double default_font_size; // in points
129
+ double default_text_scale;
130
+ double default_text_height_dx; // in figure coords. READ ONLY from Ruby. set when change default_text_scale.
131
+ double default_text_height_dy; // in figure coords. READ ONLY from Ruby. set when change default_text_scale.
132
+
133
+ double label_left_margin; // as fraction of frame width
134
+ double label_right_margin; // as fraction of frame width
135
+ double label_top_margin; // as fraction of frame height
136
+ double label_bottom_margin; // as fraction of frame height
137
+
138
+ double text_shift_on_left; // default shift for text on LEFT side of frame
139
+ double text_shift_on_right; // default shift for text on RIGHT side of frame
140
+ double text_shift_on_top; // default shift for text on TOP side of frame
141
+ double text_shift_on_bottom; // default shift for text on BOTTOM side of frame
142
+ double text_shift_from_x_origin; // default shift for text away from y axis at x origin
143
+ double text_shift_from_y_origin; // default shift for text away from x axis at y origin
144
+
145
+ /* graphics attributes */
146
+
147
+ /* color attributes */
148
+ VALUE stroke_color; // [r, g, b]
149
+ VALUE fill_color; // [r, g, b]
150
+
151
+ /* stroke attributes */
152
+ double default_line_scale; // multipler for line_width
153
+ double line_width; // in points (prior to multiplication by default_line_scale)
154
+ int line_cap;
155
+ int line_join;
156
+ double miter_limit;
157
+ VALUE line_type; // [ dashArray dashPhase ] in points
158
+
159
+ /* transparency */
160
+ double stroke_opacity;
161
+ double fill_opacity;
162
+
163
+ /* Title */
164
+ VALUE title; // text
165
+ bool title_visible;
166
+ int title_side;
167
+ double title_position;
168
+
169
+ double title_scale;
170
+ double title_shift; // in char heights, positive for out from edge (or toward larger x or y value)
171
+ double title_angle;
172
+ int title_alignment;
173
+ int title_justification;
174
+ VALUE title_color;
175
+
176
+ /* X label */
177
+ VALUE xlabel; // text
178
+ bool xlabel_visible;
179
+ double xlabel_position; // xlabel side is given by xaxis_loc
180
+
181
+ double xlabel_scale;
182
+ double xlabel_shift; // in char heights, positive for out from edge (or toward larger x or y value)
183
+ double xlabel_angle;
184
+ int xlabel_side;
185
+ int xlabel_alignment;
186
+ int xlabel_justification;
187
+ VALUE xlabel_color;
188
+
189
+ /* Y label */
190
+ VALUE ylabel; // text
191
+ bool ylabel_visible;
192
+ double ylabel_position; // ylabel side is given by yaxis_loc
193
+
194
+ double ylabel_scale;
195
+ double ylabel_shift; // in char heights, positive for out from edge (or toward larger x or y value)
196
+ double ylabel_angle;
197
+ int ylabel_side;
198
+ int ylabel_alignment;
199
+ int ylabel_justification;
200
+ VALUE ylabel_color;
201
+
202
+ /* X axis */
203
+ bool xaxis_visible;
204
+ int xaxis_type;
205
+ int xaxis_loc;
206
+ // line
207
+ double xaxis_line_width; // for axis line
208
+ VALUE xaxis_stroke_color; // for axis line and tick marks
209
+ // tick marks
210
+ double xaxis_major_tick_width; // same units as line_width
211
+ double xaxis_minor_tick_width; // same units as line_width
212
+ double xaxis_major_tick_length; // in units of numeric label char heights
213
+ double xaxis_minor_tick_length; // in units of numeric label char heights
214
+ bool xaxis_log_values;
215
+ bool xaxis_ticks_inside; // inside frame or toward larger x or y value for specific location
216
+ bool xaxis_ticks_outside; // inside frame or toward smaller x or y value for specific location
217
+ double xaxis_tick_interval; // set to 0 to use default
218
+ double xaxis_min_between_major_ticks; // in units of numeric label char heights
219
+ int xaxis_number_of_minor_intervals; // set to 0 to use default
220
+ VALUE xaxis_locations_for_major_ticks; // set to nil to use defaults
221
+ VALUE xaxis_locations_for_minor_ticks; // set to nil to use defaults
222
+ // numeric labels on major ticks
223
+ bool xaxis_use_fixed_pt;
224
+ int xaxis_digits_max;
225
+ VALUE xaxis_tick_labels; // set to nil to use defaults. else must have a label for each major tick
226
+ int xaxis_numeric_label_decimal_digits; // set to negative to use default
227
+ double xaxis_numeric_label_scale;
228
+ double xaxis_numeric_label_shift; // in char heights, positive for out from edge (or toward larger x or y value)
229
+ double xaxis_numeric_label_angle;
230
+ int xaxis_numeric_label_alignment;
231
+ int xaxis_numeric_label_justification;
232
+ // note that the top and bottom edges and drawn in addition to the x axis.
233
+ // if the edge type specifies ticks, the ticks match those of the x axis.
234
+ bool top_edge_visible;
235
+ int top_edge_type;
236
+ bool bottom_edge_visible;
237
+ int bottom_edge_type;
238
+
239
+ /* Y axis */
240
+ bool yaxis_visible;
241
+ int yaxis_type;
242
+ int yaxis_loc;
243
+ // line
244
+ double yaxis_line_width; // for axis line
245
+ VALUE yaxis_stroke_color; // for axis line and tick marks
246
+ // tick marks
247
+ double yaxis_major_tick_width; // same units as line_width
248
+ double yaxis_minor_tick_width; // same units as line_width
249
+ double yaxis_major_tick_length; // in units of numeric label char heights
250
+ double yaxis_minor_tick_length; // in units of numeric label char heights
251
+ bool yaxis_log_values;
252
+ bool yaxis_ticks_inside; // inside frame or toward larger x or y value for specific location
253
+ bool yaxis_ticks_outside; // inside frame or toward smaller x or y value for specific location
254
+ double yaxis_tick_interval; // set to 0 to use default
255
+ double yaxis_min_between_major_ticks; // in units of numeric label char heights
256
+ int yaxis_number_of_minor_intervals; // set to 0 to use default
257
+ VALUE yaxis_locations_for_major_ticks; // set to nil to use defaults
258
+ VALUE yaxis_locations_for_minor_ticks; // set to nil to use defaults
259
+ // numeric labels on major ticks
260
+ bool yaxis_use_fixed_pt;
261
+ int yaxis_digits_max;
262
+ VALUE yaxis_tick_labels; // set to nil to use defaults. else must have a label for each major tick
263
+ int yaxis_numeric_label_decimal_digits; // set to negative to use default
264
+ double yaxis_numeric_label_scale;
265
+ double yaxis_numeric_label_shift; // in char heights, positive for out from edge (or toward larger x or y value)
266
+ double yaxis_numeric_label_angle;
267
+ int yaxis_numeric_label_alignment;
268
+ int yaxis_numeric_label_justification;
269
+ // note that the left and right edges and drawn in addition to the y axis.
270
+ // if the edge type specifies ticks, the ticks match those of the y axis.
271
+ int left_edge_type;
272
+ bool left_edge_visible;
273
+ int right_edge_type;
274
+ bool right_edge_visible;
275
+
276
+ /* Legend */
277
+ // units are text heights for x and y for locations and sizes
278
+ double legend_line_x0; // x location of start of line
279
+ double legend_line_x1; // x location of end of line
280
+ double legend_line_dy; // move the line up by this amount from the text baseline
281
+ double legend_text_xstart; // x location of start of text
282
+ double legend_text_width; // in text heights measured from legend_text_xstart
283
+ double legend_text_ystart; // y location of first entry text
284
+ double legend_text_dy; // move down by this amount for subsequent legend entries
285
+ double legend_line_width; // for legend lines (or negative to use the weight from the plot)
286
+ double legend_scale; // scaling factor for size of legend text
287
+ int legend_alignment;
288
+ int legend_justification;
289
+
290
+ /* Debugging */
291
+ int debug_verbosity_level; // 0 turns off the trace info
292
+
293
+ /* Whether to complain about out non ok numbers in paths */
294
+ int croak_on_nonok_numbers;
295
+
296
+ /* PRIVATE -- not to be included in the Ruby interface */
297
+ double clip_left, clip_right, clip_top, clip_bottom; // in output coords
298
+ VALUE fm;
299
+ } FM;
300
+
301
+ typedef FM Figure_Maker;
302
+
303
+ extern VALUE cFM; /* class object for FigureMaker */
304
+ extern char *data_dir;
305
+
306
+ extern FM *Get_FM(VALUE fmkr);
307
+ extern bool Is_FM(VALUE fmkr);
308
+
309
+ #define SAVE_STATE FM saved = *p;
310
+ #define RESTORE_STATE *p = saved;
311
+
312
+ /*======================================================================*/
313
+
314
+ extern VALUE FM_set_device_pagesize(VALUE fmkr, VALUE width, VALUE height); // size in output coords (decipoints)
315
+ extern VALUE FM_set_frame_sides(VALUE fmkr, VALUE left, VALUE right, VALUE top, VALUE bottom); // in page coords [0..1]
316
+
317
+ extern VALUE FM_doing_subplot(VALUE fmkr);
318
+ extern VALUE FM_doing_subfigure(VALUE fmkr);
319
+
320
+ extern VALUE FM_no_title(VALUE fmkr);
321
+ extern VALUE FM_no_xlabel(VALUE fmkr);
322
+ extern VALUE FM_no_ylabel(VALUE fmkr);
323
+ extern VALUE FM_no_xaxis(VALUE fmkr);
324
+ extern VALUE FM_no_yaxis(VALUE fmkr);
325
+ extern VALUE FM_no_left_edge(VALUE fmkr);
326
+ extern VALUE FM_no_right_edge(VALUE fmkr);
327
+ extern VALUE FM_no_top_edge(VALUE fmkr);
328
+ extern VALUE FM_no_bottom_edge(VALUE fmkr);
329
+
330
+ extern VALUE FM_private_set_default_font_size(VALUE fmkr, VALUE size); // size in points
331
+
332
+
333
+ /* Colors */
334
+
335
+ /* in addition to RGB, colors are also often specified in terms of (HUE,LIGHTNESS,SATURATION) */
336
+ extern VALUE FM_hls_to_rgb(VALUE fmkr, VALUE hls_vec);
337
+ extern VALUE FM_rgb_to_hls(VALUE fmkr, VALUE rgb_vec);
338
+ /* hue is given as an angle from 0 to 360 around the color wheel.
339
+ 0, 60, 120, 180, 240, and 300 are respectively red, yellow, green, cyan, blue, and magenta. */
340
+ /* lightness and saturation are given as numbers from 0 to 1 */
341
+ extern void c_hls_to_rgb(double h, double l, double s, double *p_r, double *p_g, double *p_b); // from plplot plctrl.c
342
+ extern void c_rgb_to_hls(double r, double g, double b, double *p_h, double *p_l, double *p_s); // from plplot plctrl.c
343
+
344
+ /*======================================================================*/
345
+
346
+ /* Miscellaneous */
347
+
348
+ extern void Init_pdf(void);
349
+ extern void Open_pdf(VALUE fmkr, char *filename, bool quiet_mode);
350
+ extern void Close_pdf(VALUE fmkr, bool quiet_mode);
351
+ extern void Rename_pdf(char *oldname, char *newname);
352
+
353
+ extern void Init_tex(void);
354
+ extern void Open_tex(VALUE fmkr, char *filename, bool quiet_mode);
355
+ extern void Close_tex(VALUE fmkr, bool quiet_mode);
356
+ extern void Rename_tex(char *oldname, char *newname);
357
+
358
+ extern void Create_wrapper(VALUE fmkr, char *filename, bool quiet_mode);
359
+
360
+ extern void Recalc_Font_Hts(FM *p);
361
+
362
+ extern VALUE FM_rescale_text(VALUE fmkr, VALUE scaling);
363
+ extern VALUE FM_rescale_lines(VALUE fmkr, VALUE scaling);
364
+
365
+ extern double bbox_llx, bbox_lly, bbox_urx, bbox_ury;
366
+
367
+ // ENLARGE = the conversion factor from "big points" to output units
368
+ #define ENLARGE 10.0
369
+ #define BIG_POINTS_PER_INCH 72.0
370
+ #define INCHES_PER_MM 0.0393700787
371
+
372
+ // 10 miles should be enough!
373
+ #define iMAX_DEV_COORD_ALLOWED (BIG_POINTS_PER_INCH*12*5280*10)
374
+ #define MAX_DEV_COORD_ALLOWED ((double)iMAX_DEV_COORD_ALLOWED)
375
+
376
+ #define convert_inches_to_output(inches) ((ENLARGE*BIG_POINTS_PER_INCH)*(inches))
377
+ #define convert_output_to_inches(output) ((output)/(ENLARGE*BIG_POINTS_PER_INCH))
378
+
379
+ extern VALUE FM_convert_inches_to_output(VALUE fmkr, VALUE value);
380
+ extern VALUE FM_convert_output_to_inches(VALUE fmkr, VALUE value);
381
+
382
+ #define convert_mm_to_output(mm) ((ENLARGE*BIG_POINTS_PER_INCH*INCHES_PER_MM)*(mm))
383
+ #define convert_output_to_mm(output) ((output)/(ENLARGE*BIG_POINTS_PER_INCH*INCHES_PER_MM))
384
+
385
+ extern VALUE FM_convert_mm_to_output(VALUE fmkr, VALUE value);
386
+ extern VALUE FM_convert_output_to_mm(VALUE fmkr, VALUE value);
387
+
388
+ #define convert_page_to_output_x(p,x) ((p)->page_left + (x)*(p)->page_width)
389
+ #define convert_page_to_output_y(p,y) ((p)->page_bottom + (y)*(p)->page_height)
390
+ #define convert_page_to_output_dx(p,dx) ((dx)*(p)->page_width)
391
+ #define convert_page_to_output_dy(p,dy) ((dy)*(p)->page_height)
392
+
393
+ extern VALUE FM_convert_page_to_output_x(VALUE fmkr, VALUE value);
394
+ extern VALUE FM_convert_page_to_output_y(VALUE fmkr, VALUE value);
395
+ extern VALUE FM_convert_page_to_output_dx(VALUE fmkr, VALUE value);
396
+ extern VALUE FM_convert_page_to_output_dy(VALUE fmkr, VALUE value);
397
+
398
+ #define convert_output_to_page_x(p,x) (((x) - (p)->page_left)/(p)->page_width)
399
+ #define convert_output_to_page_y(p,y) (((y) - (p)->page_bottom)/(p)->page_height)
400
+ #define convert_output_to_page_dx(p,dx) ((dx)/(p)->page_width)
401
+ #define convert_output_to_page_dy(p,dy) ((dy)/(p)->page_height)
402
+
403
+ extern VALUE FM_convert_output_to_page_x(VALUE fmkr, VALUE value);
404
+ extern VALUE FM_convert_output_to_page_y(VALUE fmkr, VALUE value);
405
+ extern VALUE FM_convert_output_to_page_dx(VALUE fmkr, VALUE value);
406
+ extern VALUE FM_convert_output_to_page_dy(VALUE fmkr, VALUE value);
407
+
408
+ #define convert_frame_to_page_x(p,x) ((p)->frame_left + (x)*(p)->frame_width)
409
+ #define convert_frame_to_page_y(p,y) ((p)->frame_bottom + (y)*(p)->frame_height)
410
+ #define convert_frame_to_page_dx(p,dx) ((dx)*(p)->frame_width)
411
+ #define convert_frame_to_page_dy(p,dy) ((dy)*(p)->frame_height)
412
+
413
+ extern VALUE FM_convert_frame_to_page_x(VALUE fmkr, VALUE value);
414
+ extern VALUE FM_convert_frame_to_page_y(VALUE fmkr, VALUE value);
415
+ extern VALUE FM_convert_frame_to_page_dx(VALUE fmkr, VALUE value);
416
+ extern VALUE FM_convert_frame_to_page_dy(VALUE fmkr, VALUE value);
417
+
418
+ #define convert_page_to_frame_x(p,x) (((x) - (p)->frame_left)/(p)->frame_width)
419
+ #define convert_page_to_frame_y(p,y) (((y) - (p)->frame_bottom)/(p)->frame_height)
420
+ #define convert_page_to_frame_dx(p,dx) ((dx)/(p)->frame_width)
421
+ #define convert_page_to_frame_dy(p,dy) ((dy)/(p)->frame_height)
422
+
423
+ extern VALUE FM_convert_page_to_frame_x(VALUE fmkr, VALUE value);
424
+ extern VALUE FM_convert_page_to_frame_y(VALUE fmkr, VALUE value);
425
+ extern VALUE FM_convert_page_to_frame_dx(VALUE fmkr, VALUE value);
426
+ extern VALUE FM_convert_page_to_frame_dy(VALUE fmkr, VALUE value);
427
+
428
+ #define convert_figure_to_frame_x(p,x) (\
429
+ ((p)->bounds_left > (p)->bounds_right)? (1.0 - ((x)-(p)->bounds_xmin)/(p)->bounds_width) : ((x)-(p)->bounds_xmin)/(p)->bounds_width)
430
+ #define convert_figure_to_frame_y(p,y) (\
431
+ ((p)->bounds_bottom > (p)->bounds_top)? (1.0 - ((y)-(p)->bounds_ymin)/(p)->bounds_height) : ((y)-(p)->bounds_ymin)/(p)->bounds_height)
432
+ #define convert_figure_to_frame_dx(p,dx) (\
433
+ ((p)->bounds_left > (p)->bounds_right)? -(dx)/(p)->bounds_width : (dx)/(p)->bounds_width)
434
+ #define convert_figure_to_frame_dy(p,dy) (\
435
+ ((p)->bounds_bottom > (p)->bounds_top)? -(dy)/(p)->bounds_height : (dy)/(p)->bounds_height)
436
+
437
+ extern VALUE FM_convert_figure_to_frame_x(VALUE fmkr, VALUE value);
438
+ extern VALUE FM_convert_figure_to_frame_y(VALUE fmkr, VALUE value);
439
+ extern VALUE FM_convert_figure_to_frame_dx(VALUE fmkr, VALUE value);
440
+ extern VALUE FM_convert_figure_to_frame_dy(VALUE fmkr, VALUE value);
441
+
442
+ #define convert_frame_to_figure_x(p,x) (\
443
+ ((p)->bounds_left > (p)->bounds_right)? ((p)->bounds_left - (x)*(p)->bounds_width): ((p)->bounds_left + (x)*(p)->bounds_width))
444
+ #define convert_frame_to_figure_y(p,y) (\
445
+ ((p)->bounds_bottom > (p)->bounds_top)? ((p)->bounds_bottom - (y)*(p)->bounds_height): ((p)->bounds_bottom + (y)*(p)->bounds_height))
446
+ #define convert_frame_to_figure_dx(p,dx) (\
447
+ ((p)->bounds_left > (p)->bounds_right)? (-(dx)*(p)->bounds_width): ((dx)*(p)->bounds_width))
448
+ #define convert_frame_to_figure_dy(p,dy) (\
449
+ ((p)->bounds_bottom > (p)->bounds_top)? (-(dy)*(p)->bounds_height): ((dy)*(p)->bounds_height))
450
+
451
+ extern VALUE FM_convert_frame_to_figure_x(VALUE fmkr, VALUE value);
452
+ extern VALUE FM_convert_frame_to_figure_y(VALUE fmkr, VALUE value);
453
+ extern VALUE FM_convert_frame_to_figure_dx(VALUE fmkr, VALUE value);
454
+ extern VALUE FM_convert_frame_to_figure_dy(VALUE fmkr, VALUE value);
455
+
456
+ extern double convert_figure_to_output_x(FM *p, double x);
457
+ extern double convert_figure_to_output_y(FM *p, double y);
458
+ extern double convert_figure_to_output_dy(FM *p, double dy);
459
+ extern double convert_figure_to_output_dx(FM *p, double dx);
460
+
461
+ extern VALUE FM_convert_figure_to_output_x(VALUE fmkr, VALUE value);
462
+ extern VALUE FM_convert_figure_to_output_y(VALUE fmkr, VALUE value);
463
+ extern VALUE FM_convert_figure_to_output_dx(VALUE fmkr, VALUE value);
464
+ extern VALUE FM_convert_figure_to_output_dy(VALUE fmkr, VALUE value);
465
+
466
+ extern double convert_output_to_figure_x(FM *p, double x);
467
+ extern double convert_output_to_figure_y(FM *p, double y);
468
+ extern double convert_output_to_figure_dy(FM *p, double dy);
469
+ extern double convert_output_to_figure_dx(FM *p, double dx);
470
+
471
+ extern VALUE FM_convert_output_to_figure_x(VALUE fmkr, VALUE value);
472
+ extern VALUE FM_convert_output_to_figure_y(VALUE fmkr, VALUE value);
473
+ extern VALUE FM_convert_output_to_figure_dx(VALUE fmkr, VALUE value);
474
+ extern VALUE FM_convert_output_to_figure_dy(VALUE fmkr, VALUE value);
475
+
476
+ extern double c_convert_to_degrees(FM *p, double dx, double dy);
477
+ extern VALUE FM_convert_to_degrees(VALUE fmkr, VALUE dx, VALUE dy);
478
+
479
+ extern void update_bbox(FM *p, double x, double y);
480
+
481
+ extern void c_set_bounds(FM *p, double left, double right, double top, double bottom);
482
+ extern VALUE FM_private_set_bounds(VALUE fmkr, VALUE left, VALUE right, VALUE top, VALUE bottom); /* in figure coords */
483
+
484
+ extern VALUE FM_private_context(VALUE fmkr, VALUE cmd);
485
+
486
+ extern void c_set_subframe(FM *p, double left_margin, double right_margin, double top_margin, double bottom_margin);
487
+ extern VALUE FM_private_set_subframe(VALUE fmkr, VALUE left_margin, VALUE right_margin, VALUE top_margin, VALUE bottom_margin);
488
+
489
+ /* TeX text */
490
+
491
+ extern VALUE FM_rescale_text(VALUE fmkr, VALUE scale); // updates char_height_dx and char_height_dy too
492
+
493
+ extern VALUE FM_show_rotated_text(VALUE fmkr, VALUE text, VALUE frame_side, VALUE shift,
494
+ VALUE fraction, VALUE scale, VALUE angle, VALUE justification, VALUE alignment);
495
+
496
+ extern VALUE FM_show_rotated_label(VALUE fmkr, VALUE text,
497
+ VALUE xloc, VALUE yloc, VALUE scale, VALUE angle, VALUE justification, VALUE alignment);
498
+
499
+ extern VALUE FM_check_label_clip(VALUE fmkr, VALUE xloc, VALUE yloc);
500
+
501
+ /* PDF graphics */
502
+
503
+ /* graphics attributes */
504
+ extern VALUE FM_stroke_color_set(VALUE fmkr, VALUE value);
505
+ extern VALUE FM_fill_color_set(VALUE fmkr, VALUE value);
506
+ extern VALUE FM_line_width_set(VALUE fmkr, VALUE value);
507
+ extern VALUE FM_stroke_scale_set(VALUE fmkr, VALUE value);
508
+ extern VALUE FM_line_cap_set(VALUE fmkr, VALUE value);
509
+ extern VALUE FM_line_join_set(VALUE fmkr, VALUE value);
510
+ extern VALUE FM_miter_limit_set(VALUE fmkr, VALUE value);
511
+ extern VALUE FM_line_type_set(VALUE fmkr, VALUE line_type);
512
+ extern VALUE FM_stroke_opacity_set(VALUE fmkr, VALUE value);
513
+ extern VALUE FM_fill_opacity_set(VALUE fmkr, VALUE value);
514
+ extern VALUE FM_marker_horizontal_scaling_set(VALUE fmkr, VALUE value); // as fraction of normal width
515
+
516
+ /*
517
+ Once start a path, must finish with it before going on to anything else.
518
+ So, do sequence of path producer operations followed by a single path consumer operation.
519
+ After the path consumer operation finishes, the current path is reset to empty.
520
+ Can't mix in other kinds of operations in the middle of this; once start constructing a path,
521
+ cannot do any other graphics operations until have finished producing the path and have consumed it.
522
+ */
523
+
524
+ /* Path Producers */
525
+
526
+ /* path parameters are in figure coordinates */
527
+ /* are immediately converted to output coordinates; uneffected by later changes in figure coordinate system */
528
+
529
+ extern VALUE FM_move_to_point(VALUE fmkr, VALUE x, VALUE y); // x y m
530
+ extern VALUE FM_append_point_to_path(VALUE fmkr, VALUE x, VALUE y); // x y l
531
+ extern VALUE FM_append_curve_to_path(VALUE fmkr, VALUE x1, VALUE y1, VALUE x2, VALUE y2, VALUE x3, VALUE y3); // x1 y1 x2 y2 x3 y3 c
532
+ extern VALUE FM_close_path(VALUE fmkr); // h
533
+
534
+ extern VALUE FM_append_points_to_path(VALUE fmkr, VALUE x_vec, VALUE y_vec);
535
+ extern VALUE FM_private_append_points_with_gaps_to_path(VALUE fmkr, VALUE x_vec, VALUE y_vec, VALUE gaps, VALUE close_gaps);
536
+
537
+ extern VALUE FM_append_arc_to_path(VALUE fmkr, VALUE x_start, VALUE y_start, VALUE x_corner, VALUE y_corner,
538
+ VALUE x_end, VALUE y_end, VALUE dx, VALUE dy);
539
+ // dx and dy are converted to output coords and smaller is used as radius
540
+
541
+ extern VALUE FM_append_rect_to_path(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height); // x y w h re
542
+ extern VALUE FM_append_rounded_rect_to_path(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height, VALUE dx, VALUE dy);
543
+ // dx and dy are converted to output coords and smaller is used as radius
544
+
545
+ extern VALUE FM_append_circle_to_path(VALUE fmkr, VALUE x, VALUE y, VALUE dx);
546
+ extern VALUE FM_append_oval_to_path(VALUE fmkr, VALUE x, VALUE y, VALUE dx, VALUE dy, VALUE angle);
547
+
548
+ extern VALUE FM_append_frame_to_path(VALUE fmkr);
549
+
550
+ extern VALUE FM_update_bbox(VALUE fmkr, VALUE x, VALUE y);
551
+
552
+ extern VALUE FM_bbox_left(VALUE fmkr);
553
+ extern VALUE FM_bbox_right(VALUE fmkr);
554
+ extern VALUE FM_bbox_top(VALUE fmkr);
555
+ extern VALUE FM_bbox_bottom(VALUE fmkr);
556
+
557
+ /* Path Consumers */
558
+
559
+ extern VALUE FM_stroke(VALUE fmkr); // S
560
+ extern VALUE FM_close_and_stroke(VALUE fmkr); // s
561
+ extern VALUE FM_fill(VALUE fmkr); // f
562
+ extern VALUE FM_eofill(VALUE fmkr); // f*
563
+ extern VALUE FM_fill_and_stroke(VALUE fmkr); // B
564
+ extern VALUE FM_eofill_and_stroke(VALUE fmkr); // B*
565
+ extern VALUE FM_close_fill_and_stroke(VALUE fmkr); // b
566
+ extern VALUE FM_close_eofill_and_stroke(VALUE fmkr); // b*
567
+ extern VALUE FM_clip(VALUE fmkr); // W n
568
+ extern VALUE FM_eoclip(VALUE fmkr); // W* n
569
+ extern VALUE FM_discard_path(VALUE fmkr); // n
570
+
571
+ /* Combination Path Constructing and Using */
572
+
573
+ extern VALUE FM_stroke_line(VALUE fmkr, VALUE x1, VALUE y1, VALUE x2, VALUE y2);
574
+
575
+ extern VALUE FM_fill_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height);
576
+ extern VALUE FM_stroke_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height);
577
+ extern VALUE FM_fill_and_stroke_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height);
578
+ extern VALUE FM_clip_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height);
579
+
580
+ extern VALUE FM_fill_frame(VALUE fmkr);
581
+ extern VALUE FM_stroke_frame(VALUE fmkr);
582
+ extern VALUE FM_fill_and_stroke_frame(VALUE fmkr);
583
+ extern VALUE FM_clip_to_frame(VALUE fmkr);
584
+
585
+ extern VALUE FM_fill_oval(VALUE fmkr, VALUE x, VALUE y, VALUE dx, VALUE dy, VALUE angle);
586
+ extern VALUE FM_stroke_oval(VALUE fmkr, VALUE x, VALUE y, VALUE dx, VALUE dy, VALUE angle);
587
+ extern VALUE FM_fill_and_stroke_oval(VALUE fmkr, VALUE x, VALUE y, VALUE dx, VALUE dy, VALUE angle);
588
+ extern VALUE FM_clip_oval(VALUE fmkr, VALUE x, VALUE y, VALUE dx, VALUE dy, VALUE angle);
589
+
590
+ extern VALUE FM_fill_circle(VALUE fmkr, VALUE x, VALUE y, VALUE dx);
591
+ extern VALUE FM_stroke_circle(VALUE fmkr, VALUE x, VALUE y, VALUE dx);
592
+ extern VALUE FM_fill_and_stroke_circle(VALUE fmkr, VALUE x, VALUE y, VALUE dx);
593
+ extern VALUE FM_clip_circle(VALUE fmkr, VALUE x, VALUE y, VALUE dx);
594
+
595
+ extern VALUE FM_fill_rounded_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height, VALUE dx, VALUE dy);
596
+ extern VALUE FM_stroke_rounded_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height, VALUE dx, VALUE dy);
597
+ extern VALUE FM_fill_and_stroke_rounded_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height, VALUE dx, VALUE dy);
598
+ extern VALUE FM_clip_rounded_rect(VALUE fmkr, VALUE x, VALUE y, VALUE width, VALUE height, VALUE dx, VALUE dy);
599
+
600
+ /* Shading */
601
+
602
+ extern VALUE FM_private_axial_shading(VALUE fmkr, VALUE x0, VALUE y0,
603
+ VALUE x1, VALUE y1, VALUE colormap, VALUE extend_start, VALUE extend_end);
604
+ extern VALUE FM_private_radial_shading(VALUE fmkr, VALUE x0, VALUE y0, VALUE r0,
605
+ VALUE x1, VALUE y1, VALUE r1, VALUE colormap,
606
+ VALUE a, VALUE b, VALUE c, VALUE d,
607
+ VALUE extend_start, VALUE extend_end);
608
+
609
+ /* Markers */
610
+
611
+ // a marker is a [font number, character code]
612
+ // markers are filled with the current fill color and/or stroked with the current stroke color
613
+ // they are scaled by the current text_scale times the scale parameter passed to the drawing routine
614
+ // locations given in figure coords
615
+
616
+ extern VALUE FM_register_font(VALUE fmkr, VALUE font_name); // returns font number.
617
+
618
+ extern VALUE FM_private_show_marker(VALUE fmkr, VALUE integer_args, VALUE stroke_width, VALUE string,
619
+ VALUE x, VALUE y, VALUE x_vec, VALUE y_vec,
620
+ VALUE h_scale, VALUE v_scale, VALUE scale, VALUE it_angle, VALUE ascent_angle, VALUE angle,
621
+ VALUE fill_color, VALUE stroke_color);
622
+
623
+ extern VALUE FM_marker_string_info(VALUE fmkr, VALUE font_number, VALUE string, VALUE scale);
624
+ // [ width, llx, lly, urx, ury ] in figure coords
625
+
626
+ /* Images */
627
+
628
+ extern VALUE FM_private_show_jpg(VALUE fmkr, VALUE filename, VALUE width, VALUE height, VALUE image_destination, VALUE mask_xo_num);
629
+ extern VALUE FM_show_jp2(VALUE fmkr, VALUE filename, VALUE width, VALUE height, VALUE image_destination, VALUE mask_xo_num);
630
+
631
+ extern VALUE FM_private_show_rgb_image(VALUE fmkr, VALUE llx, VALUE lly, VALUE lrx, VALUE lry, VALUE ulx, VALUE uly,
632
+ VALUE interpolate, VALUE w, VALUE h, VALUE data, VALUE mask_xo_num);
633
+
634
+ extern VALUE FM_private_show_cmyk_image(VALUE fmkr, VALUE llx, VALUE lly, VALUE lrx, VALUE lry, VALUE ulx, VALUE uly,
635
+ VALUE interpolate, VALUE w, VALUE h, VALUE data, VALUE mask_xo_num);
636
+
637
+ extern VALUE FM_private_show_grayscale_image(VALUE fmkr, VALUE llx, VALUE lly, VALUE lrx, VALUE lry, VALUE ulx, VALUE uly,
638
+ VALUE interpolate, VALUE w, VALUE h, VALUE data, VALUE mask_xo_num);
639
+
640
+ extern VALUE FM_private_show_monochrome_image(VALUE fmkr, VALUE llx, VALUE lly, VALUE lrx, VALUE lry, VALUE ulx, VALUE uly,
641
+ VALUE interpolate, VALUE reversed, VALUE w, VALUE h, VALUE data, VALUE mask_xo_num);
642
+
643
+ extern VALUE FM_private_show_image(VALUE fmkr, VALUE llx, VALUE lly, VALUE lrx, VALUE lry, VALUE ulx, VALUE uly,
644
+ VALUE interpolate, VALUE w, VALUE h, VALUE data, VALUE value_mask_min, VALUE value_mask_max,
645
+ VALUE hival, VALUE lookup, VALUE mask_xo_num);
646
+
647
+ extern VALUE FM_private_create_image_data(VALUE fmkr, VALUE data,
648
+ VALUE first_row, VALUE last_row, VALUE first_column, VALUE last_column,
649
+ VALUE min_value, VALUE max_value, VALUE max_code, VALUE if_below_range, VALUE if_above_range);
650
+
651
+ extern VALUE FM_private_create_monochrome_image_data(VALUE fmkr, VALUE data,
652
+ VALUE first_row, VALUE last_row, VALUE first_column, VALUE last_column,
653
+ VALUE boundary, VALUE reverse);
654
+
655
+ /* Colormaps for Sampled Images */
656
+
657
+ extern VALUE FM_private_create_colormap(VALUE fmkr, VALUE rgb_flag,
658
+ VALUE length, VALUE Ps, VALUE C1s, VALUE C2s, VALUE C3s);
659
+ /*
660
+ create mappings from 'position' (0 to 1) to color (in HLS or RGB color spaces)
661
+ the length parameter determines the number of entries in the color map (any integer between 2 and 256).
662
+ for rgb, the colors are given as (red, green, blue) intensities from 0.0 to 1.0
663
+ for hls, the colors are given as (hue, lightness, saturation)
664
+ lightness and saturation given as values from 0.0 to 1.0
665
+ hue given as degrees (0 to 360) around the color wheel from red->green->blue->red
666
+ Ps are the locations in (0 to 1) for the control points -- in increasing order
667
+ must have Ps[0] == 0.0 and Ps[num_ps-1] == 1.0
668
+ */
669
+
670
+ extern VALUE FM_convert_to_colormap(VALUE fmkr, VALUE Rs, VALUE Gs, VALUE Bs);
671
+ /* this creates an arbitrary mapping from positions to colors given as (r,g,b) triples */
672
+ /* the colormap size is set to the length of the vectors */
673
+ /* the Rs, Gs, and Bs are VALUEs from 0 to 1 representing the intensity of the color component */
674
+
675
+ extern VALUE FM_get_color_from_colormap(VALUE fmkr, VALUE color_map, VALUE color_position);
676
+ /* color_position is from 0 to 1. this returns a vector for the RGB color from the given colormap */
677
+
678
+
679
+ /*======================================================================*/
680
+
681
+ /* Axes Operations */
682
+
683
+ extern VALUE FM_show_axis(VALUE fmkr, VALUE loc);
684
+ extern VALUE FM_show_edge(VALUE fmkr, VALUE loc);
685
+
686
+ /*======================================================================*/
687
+
688
+ /* Line Builders */
689
+
690
+ extern VALUE FM_private_make_contour(VALUE fmkr,
691
+ VALUE dest_xs, VALUE dest_ys, VALUE gaps, // these Dvectors get the results
692
+ VALUE xs, VALUE ys, // data x coordinates and y coordinates
693
+ VALUE zs, VALUE z_level, // the Dtable of values and the desired contour level
694
+ VALUE legit, // the Dtable of flags (nonzero means okay)
695
+ VALUE method // int == 1 means use CONREC
696
+ );
697
+
698
+ extern VALUE FM_private_make_steps(VALUE fmkr, VALUE Xvec, VALUE Yvec, VALUE Xdata, VALUE Ydata,
699
+ VALUE xfirst, VALUE yfirst, VALUE xlast, VALUE ylast);
700
+ /* adds n_pts_to_add points to Xs and Ys for steps with the given parameters.
701
+ X_data and Y_data are arrays of n values where n_pts_to_add = 2*(n+1)
702
+ (xfirst,yfirst) and (xlast,ylast) are extra data points to fix the first and last steps.
703
+ The X_data plus xfirst and xlast determine the widths of the steps.
704
+ The Y_data plus yfirst and ylast determine the height of the steps.
705
+ The steps occur at locations midway between the given x locations. */
706
+
707
+ extern VALUE FM_private_make_spline_interpolated_points(VALUE fmkr, VALUE Xvec, VALUE Yvec, VALUE Xdata, VALUE Ydata,
708
+ VALUE start_slope, VALUE end_slope);
709
+ /* uses Xvec_data and Yvec_data to create a cubic spline interpolant.
710
+ once the spline interpolant is created, it is sampled at the n_pts_to_add in Xs.
711
+ Xvec entry i is set to the value of the spline at Yvec entry i.
712
+ Both the X_data and the Xs should be stored in ascending order.
713
+ There is a boundary condition choice to be made for each end concerning the slope.
714
+ If clamped is true, the corresponding slope argument value sets the slope.
715
+ If clamped is false (known as a "free" or "natural" spline),
716
+ the 2nd derivative is set to 0 and the slope is determined by the fit.
717
+ In this case, the corresponding slope argument is ignored.
718
+ */
719
+
720
+ /*======================================================================*/
721
+
722
+ /* Some miscellaneous stuff */
723
+
724
+ extern void figure_moveto(FM *p, double x, double y); // figure coords
725
+ extern void figure_lineto(FM *p, double x, double y); // figure coords
726
+ extern void figure_join(FM *p, double x0, double y0, double x1, double y1); // figure coords
727
+ extern void figure_join_and_stroke(FM *p, double x0, double y0, double x1, double y1); // figure coords
728
+
729
+ extern double Get_double(VALUE obj, ID name_ID); // for instance variables of the obj
730
+ extern bool Get_bool(VALUE obj, ID name_ID);
731
+ extern int Get_int(VALUE obj, ID name_ID);
732
+ #define Get_value(obj, name_ID) rb_ivar_get(obj, name_ID)
733
+
734
+
735
+ extern VALUE FM_private_make(VALUE fmkr, VALUE name, VALUE cmd);
736
+ extern VALUE FM_get_save_filename(VALUE fmkr, VALUE name);
737
+
738
+ extern VALUE FM_private_make_portfolio(VALUE fmkr, VALUE name, VALUE fignums, VALUE fignames);
739
+ extern void private_make_portfolio(char *filename, VALUE fignums, VALUE fignames);
740
+
741
+ extern void Init_PlotAxis(void);
742
+ extern void Initialize_Figure(VALUE fmkr);
743
+ extern void c_setup_drawing(FM *p);
744
+ extern void Init_IDs(void);
745
+ extern void Initialize_Figure(VALUE fmkr);
746
+
747
+ extern void c_moveto(FM *p, double x, double y);
748
+ extern void c_lineto(FM *p, double x, double y);
749
+ extern void c_curveto(FM *p, double x1, double y1, double x2, double y2, double x3, double y3);
750
+ extern void c_line_width_set(FM *p, double line_width);
751
+ extern void c_line_cap_set(FM *p, int line_cap);
752
+ extern void c_line_join_set(FM *p, int line_cap);
753
+ extern void c_miter_limit_set(FM *p, double miter_limit);
754
+ extern void c_stroke_scale_set(FM *p, double stroke_scale);
755
+ extern void c_clip_rect(FM *p, double x, double y, double width, double height); // in output coords
756
+
757
+ extern int Blank_String(char *str);
758
+ extern char *Get_String(VALUE ary, int index);
759
+
760
+ extern void c_show_rotated_text(FM *p, char *text, int frame_side, double shift, double fraction,
761
+ double scale, double angle, int justification, int alignment);
762
+ extern void c_show_rotated_label(FM *p, char *text,
763
+ double xloc, double yloc, double scale, double angle, int justification, int alignment);
764
+
765
+ extern void pldtikmin(FM *p, double tick_min, double vmin, double vmax, double *tick, int *nsubt);
766
+ extern void draw_box_top_and_bottom(FM *p, char *xopt, double xtick, int nxsub);
767
+ extern void draw_box_left_and_right(FM *p, char *yopt, double ytick, int nysub);
768
+
769
+ extern VALUE do_cmd(VALUE fmkr, VALUE cmd);
770
+
771
+ extern char *Get_tex_preview_documentclass(VALUE fmkr);
772
+ extern char *Get_tex_preamble(VALUE fmkr);
773
+ extern char *Get_tex_xaxis_numeric_label(VALUE fmkr);
774
+ extern char *Get_tex_yaxis_numeric_label(VALUE fmkr);
775
+ extern char *Get_tex_preview_pagestyle(VALUE fmkr);
776
+ extern double Get_tex_xoffset(VALUE fmkr);
777
+ extern double Get_tex_yoffset(VALUE fmkr);
778
+
779
+ extern char *Get_tex_preview_paper_width(VALUE fmkr);
780
+ extern char *Get_tex_preview_paper_height(VALUE fmkr);
781
+ extern char *Get_tex_preview_hoffset(VALUE fmkr);
782
+ extern char *Get_tex_preview_voffset(VALUE fmkr);
783
+ extern char *Get_tex_preview_figure_width(VALUE fmkr);
784
+ extern char *Get_tex_preview_figure_height(VALUE fmkr);
785
+ extern char *Get_tex_preview_minwhitespace(VALUE fmkr);
786
+ extern bool Get_tex_preview_fullpage(VALUE fmkr);
787
+
788
+ extern char *Get_tex_preview_tiogafigure_command(VALUE fmkr);
789
+
790
+ extern char *Get_tex_fontsize(VALUE fmkr);
791
+ extern char *Get_tex_fontfamily(VALUE fmkr);
792
+ extern char *Get_tex_fontseries(VALUE fmkr);
793
+ extern char *Get_tex_fontshape(VALUE fmkr);
794
+
795
+ extern char *Get_tex_preview_generated_preamble(VALUE fmkr);
796
+
797
+ #ifndef USE_P
798
+ #define USE_P p = NULL;
799
+ #endif
800
+ #ifndef STRLEN
801
+ #define STRLEN 256
802
+ #endif
803
+ #ifndef PI
804
+ #define PI 3.1415926535897932384
805
+ #endif
806
+ #ifndef MAX
807
+ #define MAX(a,b) (((a) > (b)) ? (a) : (b))
808
+ #endif
809
+ #ifndef MIN
810
+ #define MIN(a,b) (((a) < (b)) ? (a) : (b))
811
+ #endif
812
+ #ifndef ABS
813
+ #define ABS(a) ((a)<0 ? -(a) : (a))
814
+ #endif
815
+ #ifndef ROUND
816
+ #define ROUND(a) (int)((a)<0.0 ? ((a)-0.5) : ((a)+0.5))
817
+ #endif
818
+ #ifndef SIGN
819
+ #define SIGN(a) ((a)<0 ? -1 : 1)
820
+ #endif
821
+
822
+ #define DBL_ATTR(attr) \
823
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return rb_float_new(p->attr); } \
824
+ static VALUE FM_##attr##_set(VALUE fmkr, VALUE val) { \
825
+ FM *p = Get_FM(fmkr); VALUE v = rb_Float(val); p->attr = NUM2DBL(v); return val; }
826
+
827
+ #define INT_ATTR(attr) \
828
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return INT2FIX(p->attr); } \
829
+ static VALUE FM_##attr##_set(VALUE fmkr, VALUE val) { \
830
+ FM *p = Get_FM(fmkr); VALUE v = rb_Integer(val); p->attr = NUM2INT(v); return val; }
831
+
832
+ #define VAL_ATTR(attr) \
833
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return p->attr; } \
834
+ static VALUE FM_##attr##_set(VALUE fmkr, VALUE val) { \
835
+ FM *p = Get_FM(fmkr); p->attr = val; return val; }
836
+
837
+ #define BOOL_ATTR(attr) \
838
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return (p->attr)? Qtrue : Qfalse; } \
839
+ static VALUE FM_##attr##_set(VALUE fmkr, VALUE val) { \
840
+ FM *p = Get_FM(fmkr); p->attr = (val != Qfalse); return val; }
841
+
842
+ #define RO_DBL_ATTR(attr) \
843
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return rb_float_new(p->attr); }
844
+
845
+ #define RO_INT_ATTR(attr) \
846
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return INT2FIX(p->attr); }
847
+
848
+ #define RO_VAL_ATTR(attr) \
849
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return p->attr; }
850
+
851
+ #define RO_BOOL_ATTR(attr) \
852
+ static VALUE FM_##attr##_get(VALUE fmkr) { FM *p = Get_FM(fmkr); return (p->attr)? Qtrue : Qfalse; }
853
+
854
+ #endif /* __figures_H__ */
855
+