first usable version of kernel and commands
After an year of hard work, this is a first "usable" version of Jehanne.
This commit is contained in:
91
sys/src/lib/draw/ellipse.c
Normal file
91
sys/src/lib/draw/ellipse.c
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* This file is part of the UCB release of Plan 9. It is subject to the license
|
||||
* terms in the LICENSE file found in the top-level directory of this
|
||||
* distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
|
||||
* part of the UCB release of Plan 9, including this file, may be copied,
|
||||
* modified, propagated, or distributed except according to the terms contained
|
||||
* in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include <u.h>
|
||||
#include <libc.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)
|
||||
{
|
||||
uint8_t *a;
|
||||
|
||||
_setdrawop(dst->display, op);
|
||||
|
||||
a = bufimage(dst->display, 1+4+4+2*4+4+4+4+2*4+2*4);
|
||||
if(a == 0){
|
||||
fprint(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);
|
||||
}
|
Reference in New Issue
Block a user