MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / PSL_setdash

Function PSL_setdash

src/postscriptlight.c:4858–4885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4856}
4857
4858int PSL_setdash (struct PSL_CTRL *PSL, char *style, double offset) {
4859 /* Line structure in points
4860 * offset from currentpoint in points
4861 * style = "1 2", offset = 0:
4862 * 1 point of line, 2 points of space, start at current point
4863 * style = "5 3 1 3", offset = 2:
4864 * 5 points line, 3 points space, 1 points line, 3 points space,
4865 * starting 2 points from current point.
4866 */
4867
4868 if (PSL->current.style[0] == '\0') { /* No previous style, so previous offset does not matters */
4869 if (!style || style[0] == '\0') return (PSL_NO_ERROR); /* No new style given, so just return */
4870 }
4871 /* Here, we have a previous non-NULL style */
4872 if (!style || style[0] == '\0') { /* No style wanted going forwards, so we do a full reset */
4873 memset (PSL->current.style, 0, PSL_PEN_LEN);
4874 PSL->current.offset = 0;
4875 PSL_command (PSL, "[] 0 B\n");
4876 return (PSL_NO_ERROR);
4877 }
4878 /* Here we have a previous style AND we have specified a (possibly) new style */
4879 if (PSL_eq(offset,PSL->current.offset) && !strcmp (style, PSL->current.style)) return (PSL_NO_ERROR); /* Same as before, so just return */
4880 /* Finally, a new style has been given that differs from the previous and we need to update our settings */
4881 PSL->current.offset = offset;
4882 strncpy (PSL->current.style, style, PSL_PEN_LEN);
4883 PSL_command (PSL, "%s\n", psl_putdash (PSL, style, offset));
4884 return (PSL_NO_ERROR);
4885}
4886
4887int PSL_setfont (struct PSL_CTRL *PSL, int font_no) {
4888 if (font_no == PSL->current.font_no) return (PSL_NO_ERROR); /* Already set */

Callers 15

gmtplot_z_gridlinesFunction · 0.85
gmtplot_map_gridlinesFunction · 0.85
gmtplot_map_gridcrossFunction · 0.85
gmtplot_map_gridticksFunction · 0.85
gmtplot_map_tickmarksFunction · 0.85
gmtplot_map_griditemsFunction · 0.85
gmt_map_basemapFunction · 0.85
gmt_setpenFunction · 0.85
GMT_grdviewFunction · 0.85
PSL_endplotFunction · 0.85
PSL_setdash_Function · 0.85
GMT_psxyFunction · 0.85

Calls 2

PSL_commandFunction · 0.85
psl_putdashFunction · 0.85

Tested by

no test coverage detected