Exemple #1
0
void GrUsrFilledBox(int x1,int y1,int x2,int y2,GrColor c)
{
	U2SX(x1,CURC);
	U2SY(y1,CURC);
	U2SX(x2,CURC);
	U2SY(y2,CURC);
	GrFilledBox(x1,y1,x2,y2,c);
}
Exemple #2
0
void displayfont(GrFont *font,char *text,int len)
{
	GrTextOption opt;
	int ww,hh;
	int bx,by;
	int bw,bh;
	GrEvent ev;

	memset(&opt,0,sizeof(opt));
	opt.txo_font   = font;
	opt.txo_xalign = GR_ALIGN_LEFT;
	opt.txo_yalign = GR_ALIGN_TOP;
	GrFilledBox(0,0,GrSizeX(),GrSizeY(),GrBlack());
	opt.txo_direct    = GR_TEXT_RIGHT;
	opt.txo_fgcolor.v = GrBlack();
	opt.txo_bgcolor.v = c1;
	ww = GrStringWidth(text,len,&opt);
	hh = GrStringHeight(text,len,&opt);
	bw = ww+2*hh;
	bh = ww;
	bx = cx - bw/2;
	by = cy - bh/2;
	GrDrawString(text,len,bx+hh,by,&opt);
	opt.txo_direct    = GR_TEXT_DOWN;
	opt.txo_bgcolor.v = c2;
	GrDrawString(text,len,bx+bw-hh,by,&opt);
	opt.txo_direct    = GR_TEXT_LEFT;
	opt.txo_bgcolor.v = c3;
	GrDrawString(text,len,bx+bw-ww-hh,by+bh-hh,&opt);
	opt.txo_direct    = GR_TEXT_UP;
	opt.txo_bgcolor.v = c4;
	GrDrawString(text,len,bx,by+bh-ww,&opt);
	GrEventWaitKeyOrClick(&ev);
	GrClearClipBox(GrBlack());
	opt.txo_direct    = GR_TEXT_RIGHT;
	opt.txo_fgcolor.v = c1;
	opt.txo_bgcolor.v = GrBlack();
	bx = GrSizeX() / 16;
	by = GrSizeY() / 16;
	bx = (bx + 7) & ~7;
	while(by < GrSizeY()) {
	    GrDrawString(test_text,strlen(test_text),bx,by,&opt);
	    opt.txo_fgcolor.v ^= GR_UNDERLINE_TEXT;
	    by += hh;
	}
	GrEventWaitKeyOrClick(&ev);
}
Exemple #3
0
void drawellip(int xc,int yc,int xa,int ya,GrColor c1,GrColor c2,GrColor c3)
{
    double ddx = (double)xa;
    double ddy = (double)ya;
    double R2 = ddx*ddx*ddy*ddy;
    double SQ;
    int x1,x2,y1,y2;
    int dx,dy;
    int *wdt, idx;
    GrLineOption *l;
    GrEvent ev;

    for (idx = 0, l = *Patterns; l != NULL; l = Patterns[++idx])
        for (wdt=widths; *wdt != 0; ++wdt) {
            GrClearScreen(GrBlack());

            GrFilledBox(xc-xa,yc-ya,xc+xa,yc+ya,c1);
            dx = xa;
            dy = 0;
            GrPlot(xc-dx,yc,c3);
            GrPlot(xc+dx,yc,c3);
            while(++dy <= ya) {
                SQ = R2 - (double)dy * (double)dy * ddx * ddx;
                dx = (int)(sqrt(SQ)/ddy + 0.5);
                x1 = xc - dx;
                x2 = xc + dx;
                y1 = yc - dy;
                y2 = yc + dy;
                GrPlot(x1,y1,c3);
                GrPlot(x2,y1,c3);
                GrPlot(x1,y2,c3);
                GrPlot(x2,y2,c3);
            }
            GrSleep(100);

            l->lno_color = c2;
            l->lno_width = *wdt;
            GrCustomEllipse(xc,yc,xa,ya,l);
            GrEventRead(&ev);
            if(ev.type == GREV_KEY && ev.p1 == 'q') {
                stop = 1;
                return;
            }
            GrSleep(100);
        }
}
Exemple #4
0
/* Draw a (filled) box with color c. */
void ws_drawfilledbox(int x1, int y1, int xsize, int ysize, int c, int xor) {
    GrFilledBox( x1, y1, x1 + xsize - 1, y1 + ysize - 1, c | (xor ? GrXOR : 0) );
}
Exemple #5
0
/*
**	Filled Box
*/
static void
DJGR_fillrect(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2, MWPIXELVAL c)
{
	GrFilledBox(x1, y1, x2, y2, c);
}