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

Function PSL_plotpoint

src/postscriptlight.c:4487–4531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4485}
4486
4487int PSL_plotpoint (struct PSL_CTRL *PSL, double x, double y, int pen) {
4488 int ix, iy, idx, idy;
4489
4490 /* Convert user coordinates to dots */
4491 ix = psl_ix (PSL, x);
4492 iy = psl_iy (PSL, y);
4493
4494 if (pen & PSL_REL) {
4495 /* Relative move or relative draw */
4496 if (pen & PSL_STROKE) {
4497 /* Always draw-stroke even when displacement is 0 */
4498 PSL_command (PSL, "%d %d D S\n", ix, iy);
4499 }
4500 else if (ix == 0 && iy == 0)
4501 return (PSL_NO_ERROR);
4502 else if (pen & PSL_MOVE)
4503 PSL_command (PSL, "%d %d G\n", ix, iy);
4504 else
4505 PSL_command (PSL, "%d %d D\n", ix, iy);
4506 PSL->internal.ix += ix; /* Update absolute position */
4507 PSL->internal.iy += iy;
4508 }
4509 else {
4510 /* Absolute move or absolute draw converted to relative */
4511 idx = ix - PSL->internal.ix;
4512 idy = iy - PSL->internal.iy;
4513 if (pen & PSL_STROKE) {
4514 /* Always draw-stroke even when displacement is 0 */
4515 PSL_command (PSL, "%d %d D S\n", idx, idy);
4516 }
4517 else if (pen & PSL_MOVE) {
4518 /* Do this always, even if idx = idy = 0, just to be sure we are where we are supposed to be */
4519 PSL_command (PSL, "%d %d M\n", ix, iy);
4520 }
4521 else if (idx == 0 && idy == 0)
4522 return (PSL_NO_ERROR);
4523 else {
4524 /* Convert to relative draw to have smaller numbers */
4525 PSL_command (PSL, "%d %d D\n", idx, idy);
4526 }
4527 PSL->internal.ix = ix; /* Update absolute position */
4528 PSL->internal.iy = iy;
4529 }
4530 return (PSL_NO_ERROR);
4531}
4532
4533int PSL_endplot (struct PSL_CTRL *PSL, int lastpage) {
4534 /* Finalizes the current plot layer; see PSL_endsession for terminating PSL session. */

Callers 4

gmt_plot_lineFunction · 0.85
psl_matharcFunction · 0.85
PSL_plotpoint_Function · 0.85
GMT_psroseFunction · 0.85

Calls 3

psl_ixFunction · 0.85
psl_iyFunction · 0.85
PSL_commandFunction · 0.85

Tested by

no test coverage detected