tline.c - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tline.c (731B)
---
1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4
5 void
6 line(Image *dst, Point p0, Point p1, int end0, int end1, int radius, Image *src, Point sp)
7 {
8 lineop(dst, p0, p1, end0, end1, radius, src, sp, SoverD);
9 }
10
11 void
12 lineop(Image *dst, Point p0, Point p1, int end0, int end1, int radius, Image *src, Point sp, Drawop op)
13 {
14 uchar *a;
15
16 _setdrawop(dst->display, op);
17
18 a = bufimage(dst->display, 1+4+2*4+2*4+4+4+4+4+2*4);
19 if(a == 0){
20 fprint(2, "image line: %r\n");
21 return;
22 }
23 a[0] = 'L';
24 BPLONG(a+1, dst->id);
25 BPLONG(a+5, p0.x);
26 BPLONG(a+9, p0.y);
27 BPLONG(a+13, p1.x);
28 BPLONG(a+17, p1.y);
29 BPLONG(a+21, end0);
30 BPLONG(a+25, end1);
31 BPLONG(a+29, radius);
32 BPLONG(a+33, src->id);
33 BPLONG(a+37, sp.x);
34 BPLONG(a+41, sp.y);
35 }