| 1721 | } |
| 1722 | |
| 1723 | static int psl_patch (struct PSL_CTRL *PSL, double *x, double *y, int np) { |
| 1724 | /* Like PSL_plotpolygon but intended for small polygons (< 20 points). No checking for |
| 1725 | * shorter path by calling psl_convert_path as in PSL_plotpolygon. |
| 1726 | */ |
| 1727 | |
| 1728 | int ix[20], iy[20], i, n, n1; |
| 1729 | |
| 1730 | if (np > 20) return (PSL_plotpolygon (PSL, x, y, np)); /* Must call PSL_plotpolygon instead */ |
| 1731 | |
| 1732 | ix[0] = psl_ix (PSL, x[0]); /* Convert inch to absolute pixel position for start of quadrilateral */ |
| 1733 | iy[0] = psl_iy (PSL, y[0]); |
| 1734 | |
| 1735 | for (i = n = 1, n1 = 0; i < np; i++) { /* Same but check if new point represent a different pixel */ |
| 1736 | ix[n] = psl_ix (PSL, x[i]); |
| 1737 | iy[n] = psl_iy (PSL, y[i]); |
| 1738 | if (ix[n] != ix[n1] || iy[n] != iy[n1]) n++, n1++; |
| 1739 | } |
| 1740 | if (ix[0] == ix[n1] && iy[0] == iy[n1]) n--, n1--; /* Closepath will do this automatically */ |
| 1741 | |
| 1742 | if (n < 1) return (PSL_NO_POLYGON); /* 0 points don't make a polygon */ |
| 1743 | |
| 1744 | n1 = --n; |
| 1745 | for (i = n - 1; i >= 0; i--, n--) PSL_command (PSL, "%d %d ", ix[n] - ix[i], iy[n] - iy[i]); |
| 1746 | PSL_command (PSL, "%d %d %d SP\n", n1, ix[0], iy[0]); |
| 1747 | PSL_command(PSL, "FO\n"); /* Close polygon and stroke/fill as set by PSL_setfill */ |
| 1748 | return (PSL_NO_ERROR); |
| 1749 | } |
| 1750 | |
| 1751 | static char *psl_getsharepath (struct PSL_CTRL *PSL, const char *subdir, const char *stem, const char *suffix, char *path) { |
| 1752 | /* stem is the name of the file, e.g., PSL_custom_fonts.txt |
no test coverage detected