Skip to content

Commit

Permalink
pdf: add splines
Browse files Browse the repository at this point in the history
This is identical to the code in draws in ps.
  • Loading branch information
Eolien55 authored and aligrudi committed May 16, 2024
1 parent d95ce8a commit 7651b53
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,21 @@ void drawa(int h1, int v1, int h2, int v2)
drawl(h1 + h2, v1 + v2);
}

/* draw an spline */
/* draw a spline */
void draws(int h1, int v1, int h2, int v2)
{
int x0 = o_h;
int y0 = o_v;
int x1 = x0 + h1;
int y1 = y0 + v1;
int x2 = x1 + h2;
int y2 = y1 + v2;

sbuf_printf(pg, "%s ", pdfpos((x0 + 5 * x1) / 6, (y0 + 5 * y1) / 6));
sbuf_printf(pg, "%s ", pdfpos((x2 + 5 * x1) / 6, (y2 + 5 * y1) / 6));
sbuf_printf(pg, "%s c\n", pdfpos((x1 + x2) / 2, (y1 + y2) / 2));

outrel(h1, v1);
sbuf_printf(pg, "%s l\n", pdfpos(o_h, o_v));
}

void docheader(char *title, int pagewidth, int pageheight, int linewidth)
Expand Down

0 comments on commit 7651b53

Please sign in to comment.