Annotation of researchv9/jtools/src/sunlib/t0.c, revision 1.1

1.1     ! root        1: /*
        !             2:        t0:     bitblt graphics tests
        !             3: */
        !             4: #include "jerq.h"
        !             5: short coffeecup_bits[]={
        !             6:        0x0100, 0x00E0, 0x0010, 0x03E0, 0x0400, 0x0FE0, 0x123C, 0x1FE2,
        !             7:        0x101A, 0x101A, 0x1002, 0x103C, 0x1810, 0x6FEC, 0x4004, 0x3FF8,
        !             8: };
        !             9: 
        !            10: main(argc, argv)
        !            11: char **argv;
        !            12: {
        !            13:        Rectangle r;
        !            14:        Bitmap *b64, *bmap;
        !            15:        Texture cup;
        !            16: 
        !            17:        request(KBD|MOUSE);
        !            18:        initdisplay(argc, argv);
        !            19:                        /* allocate and tile bitmap     */
        !            20:        b64 = balloc(Rect(0,0,64,64));
        !            21:        bmap = balloc(Rect(0,0,64,64));
        !            22:        cup = ToTexture(coffeecup_bits);
        !            23:        texture(b64, Rect(0,0,64,64), &cup, F_STORE);
        !            24:                        /* add some stripes             */
        !            25:        rectf(b64, Rect(0,0,32,64), F_XOR);
        !            26:        rectf(&display, Rect(0,0,256,32), F_STORE);
        !            27:        rectf(&display, Rect(0,64,256,96), F_STORE);
        !            28:                        /* bitblt pr to pw              */
        !            29:        bitblt(b64, b64->rect, &display, Pt(0,0), F_STORE);
        !            30:        bitblt(b64, b64->rect, &display, Pt(0,64), F_XOR);
        !            31:        bitblt(b64, b64->rect, &display, Pt(64,0), F_CLR);
        !            32:        bitblt(b64, b64->rect, &display, Pt(64,64), F_OR);
        !            33:                        /* bitblt pw to pw              */
        !            34:        bitblt(&display, Rect(0,0,64,64), &display, Pt(128,0), F_STORE);
        !            35:        bitblt(&display, Rect(0,0,64,64), &display, Pt(128,64), F_XOR);
        !            36:        bitblt(&display, Rect(0,0,64,64), &display, Pt(192,0), F_CLR);
        !            37:        bitblt(&display, Rect(0,0,64,64), &display, Pt(192,64), F_OR);
        !            38:                        /* bitblt pr to pr              */
        !            39:        bitblt(b64, b64->rect, bmap, Pt(0,0), F_STORE);
        !            40:        bitblt(bmap, bmap->rect, &display, Pt(0,128), F_STORE);
        !            41:        rectf(bmap, bmap->rect, F_CLR);
        !            42:        bitblt(b64, b64->rect, bmap, Pt(0,0), F_XOR);
        !            43:        bitblt(bmap, bmap->rect, &display, Pt(0,192), F_STORE);
        !            44:        rectf(bmap, bmap->rect, F_CLR);
        !            45:        bitblt(b64, b64->rect, bmap, Pt(0,0), F_CLR);
        !            46:        bitblt(bmap, bmap->rect, &display, Pt(64,128), F_STORE);
        !            47:        rectf(bmap, bmap->rect, F_CLR);
        !            48:        bitblt(b64, b64->rect, bmap, Pt(0,0), F_OR);
        !            49:        bitblt(bmap, bmap->rect, &display, Pt(64,192), F_STORE);
        !            50:                        /* bitblt pw to pr              */
        !            51:        bitblt(&display, Rect(0,0,64,64), bmap, Pt(0,0), F_STORE);
        !            52:        bitblt(bmap, bmap->rect, &display, Pt(128,128), F_STORE);
        !            53:        rectf(bmap, bmap->rect, F_CLR);
        !            54:        bitblt(&display, Rect(0,0,64,64), bmap, Pt(0,0), F_XOR);
        !            55:        bitblt(bmap, bmap->rect, &display, Pt(128,192), F_STORE);
        !            56:        rectf(bmap, bmap->rect, F_CLR);
        !            57:        bitblt(&display, Rect(0,0,64,64), bmap, Pt(0,0), F_CLR);
        !            58:        bitblt(bmap, bmap->rect, &display, Pt(192,128), F_STORE);
        !            59:        rectf(bmap, bmap->rect, F_CLR);
        !            60:        bitblt(&display, Rect(0,0,64,64), bmap, Pt(0,0), F_OR);
        !            61:        bitblt(bmap, bmap->rect, &display, Pt(192,192), F_STORE);
        !            62: 
        !            63:                        /* points       */
        !            64:        point(&display, Pt(256,256), F_STORE);
        !            65:        point(&display, Pt(257,256), F_XOR);
        !            66:        point(&display, Pt(258,256), F_OR);
        !            67:        point(&display, Pt(259,256), F_CLR);
        !            68:        rectf(bmap, bmap->rect, F_CLR);
        !            69:        point(bmap, Pt(0,0), F_STORE);
        !            70:        point(bmap, Pt(1,0), F_XOR);
        !            71:        point(bmap, Pt(2,0), F_OR);
        !            72:        point(bmap, Pt(3,0), F_CLR);
        !            73:        bitblt(bmap, bmap->rect, &display, Pt(260,256), F_STORE);
        !            74: 
        !            75:                        /* rectf        */
        !            76:        rectf(&display, Rect(0,256,32,288), F_STORE);
        !            77:        rectf(&display, Rect(32,256,64,288), F_XOR);
        !            78:        rectf(&display, Rect(0,288,32,320), F_OR);
        !            79:        rectf(&display, Rect(32,288,64,320), F_CLR);
        !            80:        rectf(bmap, bmap->rect, F_CLR);
        !            81:        rectf(bmap, Rect(0,0,32,32), F_STORE);
        !            82:        rectf(bmap, Rect(32,0,64,32), F_XOR);
        !            83:        rectf(bmap, Rect(0,32,32,64), F_OR);
        !            84:        rectf(bmap, Rect(32,32,64,64), F_CLR);
        !            85:        bitblt(bmap, bmap->rect, &display, Pt(64,256), F_STORE);
        !            86:                        /* screenswap   */
        !            87:        screenswap(&display, Rect(0,0,128,128), Rect(0,256,128,384));
        !            88:                        /* texture      */
        !            89:        texture(&display, Rect(0,0,64,64), &cup, F_STORE);
        !            90:        texture(&display, Rect(0,64,64,128), &cup, F_XOR);
        !            91:        texture(&display, Rect(64,0,128,64), &cup, F_OR);
        !            92:        texture(&display, Rect(64,64,128,128), &cup, F_CLR);
        !            93:        for(;;jnap(1)){
        !            94:                if(button123())
        !            95:                        break;
        !            96:        }
        !            97: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.