コード例 #1
0
ファイル: tablewindow.c プロジェクト: dvincent/frontier
static void tableverbresize (void) {
	
	hdltableformats hf = tableformatsdata;
	Rect r;
	
	if (hf != nil) {

		r = (**hf).wholerect;
		
	//	eraserect (r);
		
	//	tabledirty ();
		
		r = (**hf).tablerect;
		
		#ifdef gray3Dlook
			insetrect (&r, -2, -2);
		#else
			insetrect (&r, 1, 1);
		#endif
				
		opresize (r);
		
		tablerecalccolwidths (false); // 5.0a5 dmb: don't insist on recalc
				
		#ifdef WIN95VERSION
			opupdatenow ();
		#endif
		}
	} /*tableverbresize*/
コード例 #2
0
ファイル: tabs.c プロジェクト: 99years/plan9
void
laytable(Itable *it, Rectangle r)
{
	Rectangle cr;
	Tablecell *c;
	Table *t;
	int x, y, h, w;
	int sep, i;

	t = it->table;

	sep = (t->cellpadding+t->border) * 2;
	r = insetrect(r, t->cellspacing+t->border);
	for(c=t->cells; c!=nil; c=c->next){
		w = cellwidth(t, c, sep);
		h = cellheight(t, c, sep);
		x = r.min.x;
		if(c->col > 0)
			for(i=0; i<c->col; i++)
				x += t->cols[i].width + sep + t->cellspacing;
		y = r.min.y;
		if(c->row > 0)
			for(i=0;i <c->row; i++)
				y += t->rows[i].height + sep + t->cellspacing;
		cr = Rect(x, y, x+w+sep, y+h+sep);
		c->lay = layitems(c->content, insetrect(cr, sep/2), TRUE);
		c->lay->r = cr;
	}
}
コード例 #3
0
ファイル: util.c プロジェクト: grobe0ba/plan9front
void
rect3d(Image *im, Rectangle r, int i, Image **c, Point sp)
{
    Point p[6];

    if(i < 0) {
        r = insetrect(r, i);
        sp = addpt(sp, Pt(i,i));
        i = -i;
    }
    draw(im, Rect(r.min.x+i, r.min.y+i, r.max.x-i, r.max.y-i), c[2], nil, sp);
    p[0] = r.min;
    p[1] = Pt(r.min.x, r.max.y);
    p[2] = Pt(r.min.x+i, r.max.y-i);
    p[3] = Pt(r.min.x+i, r.min.y+i);
    p[4] = Pt(r.max.x-i, r.min.y+i);
    p[5] = Pt(r.max.x, r.min.y);
    fillpoly(im, p, 6, 0, c[0], sp);
    p[0] = r.max;
    p[1] = Pt(r.min.x, r.max.y);
    p[2] = Pt(r.min.x+i, r.max.y-i);
    p[3] = Pt(r.max.x-i, r.max.y-i);
    p[4] = Pt(r.max.x-i, r.min.y+i);
    p[5] = Pt(r.max.x, r.min.y);
    fillpoly(im, p, 6, 0, c[1], sp);
}
コード例 #4
0
ファイル: win.c プロジェクト: grobe0ba/plan9front
Win *
newwin(int t, Rectangle r, File *f)
{
	Win *w;
	
	w = emalloc(sizeof(*w));
	w->next = &wlist;
	w->prev = wlist.prev;
	w->next->prev = w;
	w->prev->next = w;
	w->type = t;
	w->tab = tabs[t];
	w->entire = r;
	w->inner = insetrect(r, BORDSIZ);
	w->im = allocwindow(scr, r, Refbackup, 0);
	draw(w->im, w->inner, w->tab->cols[BACK], nil, ZP);
	if(f != nil){
		incref(f);
		w->wprev = f->wins.wprev;
		w->wnext = &f->wins;
		f->wins.wprev->wnext = w;
		f->wins.wprev = w;
		w->f = f;
	}
	w->tab->init(w);
	setfocus(w);
	w->tab->draw(w);
	return w;
}
コード例 #5
0
ファイル: cline.c プロジェクト: 8l/inferno
void
tkcvslinesize(TkCitem *i)
{
	TkCline *l;
	int j, w, as, shape[3], arrow;

	l = TKobj(TkCline, i);
	w = TKF2I(l->width);

	i->p.bb = bbnil;
	tkpolybound(i->p.drawpt, i->p.npoint, &i->p.bb);

	l->arrowf = l->capstyle;
	l->arrowl = l->capstyle;
	if(l->arrow != 0) {
		as = w/3;
		if(as < 1)
			as = 1;
		for(j = 0; j < 3; j++) {
			shape[j] = l->shape[j];
			if(shape[j] == 0)
				shape[j] = as * cvslshape[j];
		}
		arrow = ARROW(TKF2I(shape[0]), TKF2I(shape[1]), TKF2I(shape[2]));
		if(l->arrow & TkCarrowf)
			l->arrowf = arrow;
		if(l->arrow & TkCarrowl)
			l->arrowl = arrow;
		w += shape[2];
	}

	i->p.bb = insetrect(i->p.bb, -w);
}
コード例 #6
0
ファイル: init.c プロジェクト: 99years/plan9
/*
 * Attach, or possibly reattach, to window.
 * If reattaching, maintain value of screen pointer.
 */
int
gengetwindow(Display *d, char *winname, Image **winp, Screen **scrp, int ref)
{
	int n, fd;
	char buf[64+1];
	Image *image;
	Rectangle r;

	fd = open(winname, OREAD);
	if(fd<0 || (n=read(fd, buf, sizeof buf-1))<=0){
		if((image=d->image) == nil){
			fprint(2, "gengetwindow: %r\n");
			*winp = nil;
			d->screenimage = nil;
			return -1;
		}
		strcpy(buf, "noborder");
	}else{
		close(fd);
		buf[n] = '\0';
		if(*winp != nil){
			_freeimage1(*winp);
			freeimage((*scrp)->image);
			freescreen(*scrp);
			*scrp = nil;
		}
		image = namedimage(d, buf);
		if(image == 0){
			fprint(2, "namedimage %s failed: %r\n", buf);
			*winp = nil;
			d->screenimage = nil;
			return -1;
		}
		assert(image->chan != 0);
	}

	d->screenimage = image;
	*scrp = allocscreen(image, d->white, 0);
	if(*scrp == nil){
		freeimage(d->screenimage);
		*winp = nil;
		d->screenimage = nil;
		return -1;
	}

	r = image->r;
	if(strncmp(buf, "noborder", 8) != 0)
		r = insetrect(image->r, Borderwidth);
	*winp = _allocwindow(*winp, *scrp, r, ref, DWhite);
	if(*winp == nil){
		freescreen(*scrp);
		*scrp = nil;
		freeimage(image);
		d->screenimage = nil;
		return -1;
	}
	d->screenimage = *winp;
	assert((*winp)->chan != 0);
	return 1;
}
コード例 #7
0
ファイル: opdraggingmove.c プロジェクト: pombredanne/Frontier
static short oppointlevel (Point pt) {
	
	/*
	give me a point in the display rectangle, and I'll tell you what 
	level it refers to.
	
	to visualize the process, draw vertical lines on the screen at 
	(**outlinedata).lineindent increments.  each line corresponds to a
	level in the outline.  we match the pt up with the levels.
	*/
	
	register hdloutlinerecord ho = outlinedata;
	hdlheadrecord hsummit = (**ho).hsummit;
	Rect r = (**ho).outlinerect;
	short indent;
	
	insetrect (&r, -draggingsloppix, -draggingsloppix);
	
	if (!pointinrect (pt, r)) /*too sloppy -- no move*/
		return (-1);
	
	indent = (pt.h - (**ho).outlinerect.left) - (opnodeindent (hsummit) + dragginghotspot);
	
	return ((**hsummit).headlevel + divround (indent, (**ho).lineindent));
	} /*oppointlevel*/
コード例 #8
0
ファイル: win.c プロジェクト: grobe0ba/plan9front
void
resize(void)
{
	Rectangle old, r;
	int dxo, dyo, dxn, dyn;
	Win *w;
	
	old = screen->r;
	dxo = Dx(old);
	dyo = Dy(old);
	if(getwindow(display, Refnone) < 0)
		sysfatal("resize failed: %r");
	dxn = Dx(screen->r);
	dyn = Dy(screen->r);
	freescreen(scr);
	scr = allocscreen(screen, display->white, 0);
	if(scr == nil)
		sysfatal("allocscreen: %r");
	for(w = wlist.next; w != &wlist; w = w->next){
		r = rectsubpt(w->entire, old.min);
		r.min.x = muldiv(r.min.x, dxn, dxo);
		r.max.x = muldiv(r.max.x, dxn, dxo);
		r.min.y = muldiv(r.min.y, dyn, dyo);
		r.max.y = muldiv(r.max.y, dyn, dyo);
		w->entire = rectaddpt(r, screen->r.min);
		w->inner = insetrect(w->entire, BORDSIZ);
		freeimage(w->im);
		w->im = allocwindow(scr, w->entire, Refbackup, 0);
		if(w->im == nil)
			sysfatal("allocwindow: %r");
		draw(w->im, w->inner, w->tab->cols[BACK], nil, ZP);
		border(w->im, w->entire, BORDSIZ, w->tab->cols[w == actw ? BORD : DISB], ZP);
		w->tab->draw(w);
	}
}
コード例 #9
0
ファイル: wpverbs.c プロジェクト: pombredanne/Frontier
static void wplinkwindowinfo (void) {
	
	/*
	link wpdata to wpwindowinfo, and make sure that the content rect of 
	the WS handle is up to date.
	
	5.0a2 dmb: use paperrect, not contentrect, as bounds
	*/
	
	register hdlwindowinfo hw = wpwindowinfo;
	Rect rbounds;
	
	wpsetupwindow ();
	
	rbounds = (**hw).contentrect;
	
	insetrect (&rbounds, 3, 3);
	
	rbounds.right = rbounds.left + shellprintinfo.paperrect.right - shellprintinfo.paperrect.left;
	
	rbounds.bottom = rbounds.top + shellprintinfo.paperrect.bottom - shellprintinfo.paperrect.top;
	
	wpsetbufferrect ((**hw).contentrect, rbounds);
	
	(**wpdata).setscrollbarsroutine = &wpverbsetscrollbarsroutine;
	} /*wplinkwindowinfo*/
コード例 #10
0
ファイル: menuhit.c プロジェクト: 00001/plan9port
/*
 * r is a rectangle holding the text elements.
 * return the element number containing p.
 */
static int
menusel(Rectangle r, Point p)
{
	r = insetrect(r, Margin);
	if(!ptinrect(p, r))
		return -1;
	return (p.y-r.min.y)/(font->height+Vspacing);
}
コード例 #11
0
ファイル: progressbar.c プロジェクト: dvincent/frontier
static void aboutupdate (void) {
	
	/*
	1/22/91 dmb: openbitmap moves memory; its result cannot be assigned 
	into a double-dereferenced handle.  (ahem!)
	
	2.1b5 dmb: special case for nil cancoondata (during revert). also, removed 
	unneeded flbitmapactive logic
	*/
	
	register hdlwindowinfo hw = aboutwindowinfo;
	Rect r;
	
	displayedaboutdata = aboutdata;

	aboutport = aboutwindow;

	flhavemiscrect = false;

	if (aboutdata == nil) /*in the middle of a revert*/
		return;
	
	r = (**hw).contentrect;
	
	eraserect (r);
	
	shelldrawgrowicon (hw);
	
	if ((**aboutdata).flbigwindow) {
		
		ccdrawabout ();
		
	//	ccgetmsgrect (&r);
		getmessagecontentrect (&r);
		
		insetrect (&r, -1, -1);
		
	//	grayframerect (r);
		movepento (r.left, r.top);
		
		pushpen ();
		
		setgraypen ();
		
		pendrawline (r.right, r.top);
		
		poppen ();

		flhavemiscrect = ccgettextitemrect (miscinfoitem, &miscinforect);
		}
	
	if (!(**aboutdata).flbootsplash) {
		
		ccdrawagentpopup ();
		
		ccdrawmsg ();
		}
	} /*aboutupdate*/
コード例 #12
0
ファイル: machdep.c プロジェクト: CoryXie/nix-os
void m_dblbuf(void){
	if(offscreen==screen){
		offscreen=allocimage(display, insetrect(screen->r, 4), screen->chan, 0, -1);
		if(offscreen==0){
			fprintf(stderr, "Can't double buffer\n");
			offscreen=screen;
		}
	}
}
コード例 #13
0
ファイル: menuhit.c プロジェクト: 00001/plan9port
/*
 * r is a rectangle holding the text elements.
 * return the rectangle, including its black edge, holding element i.
 */
static Rectangle
menurect(Rectangle r, int i)
{
	if(i < 0)
		return Rect(0, 0, 0, 0);
	r.min.y += (font->height+Vspacing)*i;
	r.max.y = r.min.y+font->height+Vspacing;
	return insetrect(r, Border-Margin);
}
コード例 #14
0
ファイル: menuhit.c プロジェクト: 00001/plan9port
static void
menupaint(Image *m, Menu *menu, Rectangle textr, int off, int nitemdrawn)
{
	int i;

	draw(m, insetrect(textr, Border-Margin), back, nil, ZP);
	for(i = 0; i<nitemdrawn; i++)
		paintitem(m, menu, textr, off, i, 0, nil, nil);
}
コード例 #15
0
ファイル: xs.c プロジェクト: npe9/harvey
void
drawsq(Image *b, Point p, int ptx) {
    Rectangle r;

    r.min = p;
    r.max.x = r.min.x+pcsz;
    r.max.y = r.min.y+pcsz;
    draw(b, r, display->black, nil, ZP);
    draw(b, insetrect(r, 1), tx[ptx], nil, ZP);
}
コード例 #16
0
ファイル: menuresize.c プロジェクト: pombredanne/Frontier
void meresize (void) {
	
	Rect outlinerect;
	
	megetoutlinerect (&outlinerect); /*flow through code that adjusts the rect*/
	
	insetrect (&outlinerect, 1, 1);
	
	mesetalloutlinerects (outlinerect);
	} /*meresize*/
コード例 #17
0
ファイル: winwatch.c プロジェクト: vrthra/9front-tmp
void
drawnowin(int i)
{
	Rectangle r;

	r = Rect(0,0,(Dx(screen->r)-2*MARGIN+PAD)/cols-PAD, font->height);
	r = rectaddpt(rectaddpt(r, Pt(MARGIN+(PAD+Dx(r))*(i/rows),
				MARGIN+(PAD+Dy(r))*(i%rows))), screen->r.min);
	draw(screen, insetrect(r, -1), lightblue, nil, ZP);
}
コード例 #18
0
ファイル: screen.c プロジェクト: Nurb432/plan9front
static void
screenwin(void)
{
	Point p, q;
	char *greet;
	Memimage *orange;
	Rectangle r;

	memsetchan(gscreen, RGB16);

	back = memwhite;
	conscol = memblack;

	orange = allocmemimage(Rect(0,0,1,1), RGB16);
	orange->flags |= Frepl;
	orange->clipr = gscreen->r;
	orange->data->bdata[0] = 0x40;
	orange->data->bdata[1] = 0xfd;

	w = memdefont->info[' '].width;
	h = memdefont->height;

	r = insetrect(gscreen->r, 4);

	memimagedraw(gscreen, r, memblack, ZP, memopaque, ZP, S);
	window = insetrect(r, 4);
	memimagedraw(gscreen, window, memwhite, ZP, memopaque, ZP, S);

	memimagedraw(gscreen, Rect(window.min.x, window.min.y,
			window.max.x, window.min.y+h+5+6), orange, ZP, nil, ZP, S);
	freememimage(orange);
	window = insetrect(window, 5);

	greet = " Plan 9 Console ";
	p = addpt(window.min, Pt(10, 0));
	q = memsubfontwidth(memdefont, greet);
	memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
	flushmemscreen(r);
	window.min.y += h+6;
	curpos = window.min;
	window.max.y = window.min.y+((window.max.y-window.min.y)/h)*h;
}
コード例 #19
0
ファイル: about.c プロジェクト: pombredanne/Frontier
static boolean aboutresetrects (hdlwindowinfo hinfo) {
	
	/*
	12/28/90 dmb: the resetrects routine is called while the windowinfo is 
	being created, before any data has been created for it.  we can't assume that 
	cancoondata or aboutwindowinfo are not nil
	*/
	
	register hdlwindowinfo hw = hinfo;
	hdlaboutrecord ha = (hdlaboutrecord) (**hw).hdata;
	Rect rmessage, rabout;
	
	if (ha == nil)
		return (false);
	
	rmessage = (**hw).contentrect;
	
	shellcalcgrowiconrect (rmessage, hw);
	
	zerorect (&rabout);
	
	if ((**aboutdata).flbigwindow) { /*divide window into message and about*/
		
		rabout = rmessage; /*set left, right, bottom*/
		
		rabout.bottom = rabout.top + aboutrectheight();
		
		rmessage.top = rabout.bottom + msgvertgap;
		
	//	rmessage.bottom -= aboutlineheight;
		
		insetrect (&rabout, abouthorizinset, aboutvertinset);
		
		insetrect (&rmessage, abouthorizinset, aboutvertinset);
		}
	
	(**aboutdata).messagearea = rmessage;
	
	(**aboutdata).aboutarea = rabout;
	
	return (true);
	} /*aboutresetrects*/
コード例 #20
0
ファイル: term.c プロジェクト: npe9/harvey
static void
screenwin(void)
{
	Point p;
	char *greet;
	Memimage *grey;

	drawqlock();
	back = memwhite;
	conscol = memblack;
	memfillcolor(gscreen, 0x444488FF);
	
	h = memdefont->height;

	window.min = addpt(gscreen->r.min, Pt(20,20));
	window.max.x = window.min.x + Dx(gscreen->r)*3/4-40;
	window.max.y = window.min.y + Dy(gscreen->r)*3/4-100;

	memimagedraw(gscreen, window, memblack, ZP, memopaque, ZP, S);
	window = insetrect(window, 4);
	memimagedraw(gscreen, window, memwhite, ZP, memopaque, ZP, S);

	/* a lot of work to get a grey color */
	grey = allocmemimage(Rect(0,0,1,1), CMAP8);
	grey->flags |= Frepl;
	grey->clipr = gscreen->r;
	memfillcolor(grey, 0xAAAAAAFF);
	memimagedraw(gscreen, Rect(window.min.x, window.min.y,
			window.max.x, window.min.y+h+5+6), grey, ZP, nil, ZP, S);
	freememimage(grey);
	window = insetrect(window, 5);

	greet = " Plan 9 Console ";
	p = addpt(window.min, Pt(10, 0));
	memimagestring(gscreen, p, conscol, ZP, memdefont, greet);
	window.min.y += h+6;
	curpos = window.min;
	window.max.y = window.min.y+((window.max.y-window.min.y)/h)*h;
	flushmemscreen(gscreen->r);
	drawqunlock();
}
コード例 #21
0
ファイル: gif.c プロジェクト: aahud/harvey
Rectangle
imager(void)
{
	Rectangle r;

	if(allims==nil || allims[0]==nil)
		return screen->r;
	r = insetrect(screen->clipr, Edge+Border);
	r.max.x = r.min.x+Dx(allims[0]->r);
	r.max.y = r.min.y+Dy(allims[0]->r);
	return r;
}
コード例 #22
0
ファイル: cmdw.c プロジェクト: grobe0ba/plan9front
static void
cmddraw(Win *w)
{
	Rectangle r;
	
	frclear(&w->fr, 0);
	r = insetrect(w->inner, 1);
	r.min.x += SCRTSIZ;
	scrollbar(w);
	frinit(&w->fr, r, display->defaultfont, w->im, w->tab->cols);
	frinsert(&w->fr, w->runes + w->toprune, w->runes + w->nrunes, 0);
}
コード例 #23
0
ファイル: acme.c プロジェクト: UNGLinux/9base
void
iconinit(void)
{
	Rectangle r;
	Image *tmp;

	if(tagcols[BACK] == nil) {
		/* Blue */
		tagcols[BACK] = allocimagemix(display, DPalebluegreen, DWhite);
		tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPalegreygreen);
		tagcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DPurpleblue);
		tagcols[TEXT] = display->black;
		tagcols[HTEXT] = display->black;
	
		/* Yellow */
		textcols[BACK] = allocimagemix(display, DPaleyellow, DWhite);
		textcols[HIGH] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DDarkyellow);
		textcols[BORD] = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellowgreen);
		textcols[TEXT] = display->black;
		textcols[HTEXT] = display->black;
	}
	
	r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
	if(button && eqrect(r, button->r))
		return;

	if(button){
		freeimage(button);
		freeimage(modbutton);
		freeimage(colbutton);
	}

	button = allocimage(display, r, screen->chan, 0, DNofill);
	draw(button, r, tagcols[BACK], nil, r.min);
	r.max.x -= ButtonBorder;
	border(button, r, ButtonBorder, tagcols[BORD], ZP);

	r = button->r;
	modbutton = allocimage(display, r, screen->chan, 0, DNofill);
	draw(modbutton, r, tagcols[BACK], nil, r.min);
	r.max.x -= ButtonBorder;
	border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
	r = insetrect(r, ButtonBorder);
	tmp = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DMedblue);
	draw(modbutton, r, tmp, nil, ZP);
	freeimage(tmp);

	r = button->r;
	colbutton = allocimage(display, r, screen->chan, 0, DPurpleblue);

	but2col = allocimage(display, r, screen->chan, 1, 0xAA0000FF);
	but3col = allocimage(display, r, screen->chan, 1, 0x006600FF);
}
コード例 #24
0
ファイル: sudoku.c プロジェクト: AustenConrad/plan-9
void
drawbar(int digit, int selected)
{
	Rectangle r = Rect((digit - 1)*Square, 0, digit*Square, Square);

	if(digit < 1 || digit > 9)
		return;

	r = insetrect(r, Border);
	r.max = addpt(r.max, Pt(2, 2));
	draw(screen, rectaddpt(r, screen->r.min), selected ? backselect : background, nil, ZP);
	draw(screen, rectaddpt(r, screen->r.min), display->black, dig[digit-1], ZP);
}
コード例 #25
0
ファイル: crect.c プロジェクト: 8l/inferno
void
tkcvsrectsize(TkCitem *i)
{
	TkCrect *r;
	int w;

	r = TKobj(TkCrect, i);
	w = TKF2I(r->width)*2;

	i->p.bb = bbnil;
	tkpolybound(i->p.drawpt, i->p.npoint, &i->p.bb);
	i->p.bb = insetrect(i->p.bb, -w);
}
コード例 #26
0
ファイル: sudoku.c プロジェクト: AustenConrad/plan-9
void
drawcell(int x, int y, int num, Image *col)
{
	Rectangle r = Rect(x*Square, y*Square, (x+1)*Square, (y+1)*Square);

	if(num < 0 || num > 9)
		return;

	r = insetrect(r, Border);
	r = rectaddpt(r, Pt(0, Square));
	r.max = addpt(r.max, Pt(2, 2));
	
	draw(screen, rectaddpt(r, screen->r.min), col, dig[num], ZP);
}
コード例 #27
0
ファイル: menuresize.c プロジェクト: pombredanne/Frontier
static void mesetalloutlinerects (Rect r) {

	oppushoutline ((**menudata).menuoutline);
	
	insetrect (&r, 1, 1);
	
	opresize (r);
	
	#ifdef WIN95VERSION
		opupdatenow ();
	#endif

	oppopoutline ();
	} /*mesetalloutlinerects*/
コード例 #28
0
ファイル: view.c プロジェクト: dancrossnyc/harvey
/*
 * Translate the image in the window by delta.
 */
static void
translate(Point delta)
{
	Point u;
	Rectangle r, or;

	if(im == nil)
		return;

	u = pclip(addpt(ul, delta), ulrange);
	delta = subpt(u, ul);
	if(delta.x == 0 && delta.y == 0)
		return;

	/*
	 * The upper left corner of the image is currently at ul.
	 * We want to move it to u.
	 */
	or = rectaddpt(Rpt(ZP, Pt(Dx(im->r), Dy(im->r))), ul);
	r = rectaddpt(or, delta);

	drawop(screen, r, screen, nil, ul, S);
	ul = u;

	/* fill in gray where image used to be but isn't. */
	drawdiff(screen, insetrect(or, -2), insetrect(r, -2), gray, nil, ZP, S);

	/* fill in black border */
	drawdiff(screen, insetrect(r, -2), r, display->black, nil, ZP, S);

	/* fill in image where it used to be off the screen. */
	if(rectclip(&or, screen->r))
		drawdiff(screen, r, rectaddpt(or, delta), im, nil, im->r.min, S);
	else
		drawop(screen, r, im, nil, im->r.min, S);
	flushimage(display, 1);
}
コード例 #29
0
ファイル: vga.c プロジェクト: 8l/inferno
void
vgascreenwin(VGAscr* scr)
{
	int h, w;

	h = scr->memdefont->height;
	w = scr->memdefont->info[' '].width;

	window = insetrect(scr->gscreen->r, 48);
	window.max.x = window.min.x+((window.max.x-window.min.x)/w)*w;
	window.max.y = window.min.y+((window.max.y-window.min.y)/h)*h;
	curpos = window.min;

	screenputs = vgascreenputs;
}
コード例 #30
0
ファイル: xs.c プロジェクト: npe9/harvey
void
drawboard(void)
{
    int i, j;

    border(screen, insetrect(rboard, -2), 2, display->black, ZP);
    draw(screen, Rect(rboard.min.x, rboard.min.y-2, rboard.max.x, rboard.min.y),
         display->white, nil, ZP);
    for(i=0; i<NY; i++)
        for(j=0; j<NX; j++)
            if(board[i][j])
                drawsq(screen, Pt(rboard.min.x+j*pcsz, rboard.min.y+i*pcsz), board[i][j]-16);
    score(0);
    if (suspended)
        draw(screen, screen->r, display->white, whitemask, ZP);
}