summaryrefslogtreecommitdiff
path: root/libdraw/ellipse.c
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 17:07:39 +0000
commit37da2899f40661e3e9631e497da8dc59b971cbd0 (patch)
treecbc6d4680e347d906f5fa7fca73214418741df72 /libdraw/ellipse.c
parent54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff)
20060303a
Diffstat (limited to 'libdraw/ellipse.c')
-rw-r--r--libdraw/ellipse.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/libdraw/ellipse.c b/libdraw/ellipse.c
new file mode 100644
index 00000000..51a993ab
--- /dev/null
+++ b/libdraw/ellipse.c
@@ -0,0 +1,81 @@
+#include "lib9.h"
+#include "draw.h"
+
+static
+void
+doellipse(int cmd, Image *dst, Point *c, int xr, int yr, int thick, Image *src, Point *sp, int alpha, int phi, Drawop op)
+{
+ uchar *a;
+
+ _setdrawop(dst->display, op);
+
+ a = bufimage(dst->display, 1+4+4+2*4+4+4+4+2*4+2*4);
+ if(a == 0){
+ _drawprint(2, "image ellipse: %r\n");
+ return;
+ }
+ a[0] = cmd;
+ BPLONG(a+1, dst->id);
+ BPLONG(a+5, src->id);
+ BPLONG(a+9, c->x);
+ BPLONG(a+13, c->y);
+ BPLONG(a+17, xr);
+ BPLONG(a+21, yr);
+ BPLONG(a+25, thick);
+ BPLONG(a+29, sp->x);
+ BPLONG(a+33, sp->y);
+ BPLONG(a+37, alpha);
+ BPLONG(a+41, phi);
+}
+
+void
+ellipse(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp)
+{
+ doellipse('e', dst, &c, a, b, thick, src, &sp, 0, 0, SoverD);
+}
+
+void
+ellipseop(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, Drawop op)
+{
+ doellipse('e', dst, &c, a, b, thick, src, &sp, 0, 0, op);
+}
+
+void
+fillellipse(Image *dst, Point c, int a, int b, Image *src, Point sp)
+{
+ doellipse('E', dst, &c, a, b, 0, src, &sp, 0, 0, SoverD);
+}
+
+void
+fillellipseop(Image *dst, Point c, int a, int b, Image *src, Point sp, Drawop op)
+{
+ doellipse('E', dst, &c, a, b, 0, src, &sp, 0, 0, op);
+}
+
+void
+arc(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, int alpha, int phi)
+{
+ alpha |= 1<<31;
+ doellipse('e', dst, &c, a, b, thick, src, &sp, alpha, phi, SoverD);
+}
+
+void
+arcop(Image *dst, Point c, int a, int b, int thick, Image *src, Point sp, int alpha, int phi, Drawop op)
+{
+ alpha |= 1<<31;
+ doellipse('e', dst, &c, a, b, thick, src, &sp, alpha, phi, op);
+}
+
+void
+fillarc(Image *dst, Point c, int a, int b, Image *src, Point sp, int alpha, int phi)
+{
+ alpha |= 1<<31;
+ doellipse('E', dst, &c, a, b, 0, src, &sp, alpha, phi, SoverD);
+}
+
+void
+fillarcop(Image *dst, Point c, int a, int b, Image *src, Point sp, int alpha, int phi, Drawop op)
+{
+ alpha |= 1<<31;
+ doellipse('E', dst, &c, a, b, 0, src, &sp, alpha, phi, op);
+}