Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/libdraw/border.c

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


#include <u.h>
#include <libc.h>
#include <draw.h>

void
border(Image *im, Rectangle r, int i, Image *color, Point sp)
{
	if(i < 0){
		r = insetrect(r, i);
		sp = addpt(sp, Pt(i,i));
		i = -i;
	}
	draw(im, Rect(r.min.x, r.min.y, r.max.x, r.min.y+i),
		color, nil, sp);
	draw(im, Rect(r.min.x, r.max.y-i, r.max.x, r.max.y),
		color, nil, Pt(sp.x, sp.y+Dy(r)-i));
	draw(im, Rect(r.min.x, r.min.y+i, r.min.x+i, r.max.y-i),
		color, nil, Pt(sp.x, sp.y+i));
	draw(im, Rect(r.max.x-i, r.min.y+i, r.max.x, r.max.y-i),
		color, nil, Pt(sp.x+Dx(r)-i, sp.y+i));
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.