1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #include "sys-defines.h"
- #include "extern.h"
- int
- _API_flinedash (R___(Plotter *_plotter) int n, const double *dashes, double offset)
- {
- double *dash_array;
- int i;
- if (!_plotter->data->open)
- {
- _plotter->error (R___(_plotter)
- "flinedash: invalid operation");
- return -1;
- }
- if (_plotter->drawstate->path)
- _API_endpath (S___(_plotter));
-
- if (n < 0 || (n > 0 && dashes == NULL))
- return -1;
- for (i = 0; i < n; i++)
- if (dashes[i] < 0.0)
- return -1;
- if (_plotter->drawstate->dash_array_len > 0)
- free ((double *)_plotter->drawstate->dash_array);
- if (n > 0)
- dash_array = (double *)_pl_xmalloc (n * sizeof(double));
- else
- dash_array = NULL;
- _plotter->drawstate->dash_array_len = n;
- for (i = 0; i < n; i++)
- dash_array[i] = dashes[i];
- _plotter->drawstate->dash_array = dash_array;
- _plotter->drawstate->dash_offset = offset;
-
- _plotter->drawstate->dash_array_in_effect = true;
- return 0;
- }
|