Plan 9 from Bell Labs’s /usr/web/sources/extra/art/test/test.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/*
 * definitions used in more than one file
 */
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
#include <cursor.h>
#include <bio.h>

short tcur[16]={
	 0x0100, 0x0100, 0x0380, 0x0380,
	 0x07C0, 0x07C0, 0x0FE0, 0x0EE0,
	 0x1C70, 0x1830, 0x3018, 0x2008,
	 0x0000, 0x0000, 0x0000, 0x0000,
};
short anc[16]={
	0x3838, 0x7C7C, 0xF01E, 0xF83E,
	0xDC76, 0x4EE4, 0x07C0, 0x0280,
	0x07C0, 0x4EE4, 0xDC76, 0xF83E,
	0xF01E, 0x7C7C, 0x3838, 0x0000,
};

Image *paleyellow;
Image *cur, *anchormark;

void eresized(int new){
}

void main(int argc, char *argv[]){
	Point p;

	initdraw(0, 0, "test");
	einit(Emouse|Ekeyboard);

	paleyellow=allocimage(display, Rect(0, 0, 1, 1), RGB16, 1, DPaleyellow);
	cur=allocimage(display, Rect(0, 0, 16, 16), RGB16, 1, DPaleyellow);
	anchormark=allocimage(display, Rect(0, 0, 16, 16), RGB16, 1, DPaleyellow);

	for(p.y=0;p.y<16;p.y++) for(p.x=0;p.x<16;p.x++){
		if(tcur[p.y]&(1<<p.x))
			line(cur, p, p, 0, 0, 0, display->black, ZP);
		else
			line(cur, p, p, 0, 0, 0, paleyellow, ZP);

		if(anc[p.y]&(1<<p.x))
			line(anchormark, p, p, 0, 0, 0, display->black, ZP);
		else
			line(anchormark, p, p, 0, 0, 0, paleyellow, ZP);

	}
	draw(screen, Rpt(addpt(screen->r.min, Pt(150, 150)), addpt(screen->r.min, Pt(166, 166))), cur, 0, ZP);
	draw(screen, Rpt(addpt(screen->r.min, Pt(250, 250)), addpt(screen->r.min, Pt(266, 266))), anchormark, 0, ZP);

	flushimage(display, 1);

	for(;;);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.