/* Amavect! */ #include #include #include Image *red; Image *chan1; Image *chan2; Image *chan4; Image *wtf; void eprint(void) { static ulong d; fprint(2,"%uld: %r\n", d); werrstr(""); d++; } Image * eallocimage(Rectangle r, ulong chan, int repl, ulong col) { Image *i; i = allocimage(display, r, chan, repl, col); if(i == nil) sysfatal("%r"); return i; } void sdraw(Image *dst, Image *src) { draw(dst, dst->r, src, nil, ZP); } void doflush(void) { flushimage(display, 1); sleep(1000); } void main(void) { if(initdraw(nil, nil, "oddcolor") < 0) sysfatal("%r"); red = eallocimage(Rect(0,0,1,1), RGB24, 1, DRed); chan1 = eallocimage(Rect(0,0,1,1), CHAN1(CRed,8), 1, DNofill); chan2 = eallocimage(Rect(0,0,1,1), CHAN2(CGreen,8,CGrey,8), 1, DNofill); chan4 = eallocimage(Rect(0,0,1,1), CHAN4(CRed,8,CGrey,8,CBlue,8,CRed,8), 1, DNofill); wtf = eallocimage(Rect(0,0,1,1), CHAN4(CBlue,4,CAlpha,2,CGrey,7,CRed,3), 1, DNofill); sdraw(screen, red); doflush(); sdraw(chan1, red); sdraw(screen, chan2); doflush(); sdraw(chan2, red); sdraw(screen, chan2);; doflush(); sdraw(chan4, red); sdraw(screen, chan4); doflush(); sdraw(wtf, red); sdraw(screen, wtf); doflush(); }