Annotation of 43BSDTahoe/new/X/libapollo/draw.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char *rcsid_draw_c = "$Header: draw.c,v 10.1 86/11/29 13:51:24 jg Rel $";
        !             3: #endif lint
        !             4:     /*
        !             5: 
        !             6:     Copyright 1986 by the University of Utah
        !             7: 
        !             8:     Permission to use, copy, modify, and distribute this
        !             9:     software and its documentation for any purpose and without
        !            10:     fee is hereby granted, provided that the above copyright
        !            11:     notice appear in all copies and that both that copyright
        !            12:     notice and this permission notice appear in supporting
        !            13:     documentation, and that the name of the University of Utah
        !            14:     not be used in advertising or publicity pertaining to 
        !            15:     distribution of the software without specific, written 
        !            16:     prior permission. The University of Utah makes no
        !            17:     representations about the suitability of this software for
        !            18:     any purpose.  It is provided "as is" without express or
        !            19:     implied warranty.
        !            20: 
        !            21:     */
        !            22: 
        !            23: /* draw.c      Draw lines, curves, and polygons on the screen
        !            24:  *
        !            25:  *     DrawCurve       Draw a generalized line/polygon/combination
        !            26:  *
        !            27:  */
        !            28: 
        !            29: /*
        !            30:  *     ToDo:
        !            31:  *             Brush shapes
        !            32:  *              Patterned Curves
        !            33:  *             Curves
        !            34:  */
        !            35: 
        !            36: #include "Xapollo.h"
        !            37: status_$t status;
        !            38: 
        !            39: static
        !            40: Draw_Solid(srcpix, xbase, ybase, op, vertcount, verts, clipcount, clips, zmask)
        !            41:     int srcpix;        /* Pixel value to write */
        !            42:     int xbase, ybase;  /* Origin of curve */
        !            43:     int op;            /* Opcode */
        !            44:     int vertcount;     /* Length of Vertex array */
        !            45:     Vertex *verts;     /* Vertices */
        !            46:     int clipcount;     /* Length of clip array */
        !            47:     CLIP *clips;       /* clipping rectangles */
        !            48:     int zmask;
        !            49: {
        !            50:     register Vertex *v = verts;
        !            51:     char *kind;
        !            52:     int i;
        !            53:     int allmask = -1;
        !            54:     gpr_$window_t cwindow;
        !            55: 
        !            56:     gpr_$set_draw_value((gpr_$pixel_value_t)srcpix, status);
        !            57:     set_zmask( zmask );
        !            58:     set_op( op );
        !            59:     do {
        !            60:        register int xp, yp;
        !            61:        register Vertex *v = verts;
        !            62:        register int vc = vertcount;
        !            63: 
        !            64:         GetNextClip(clips, cwindow);
        !            65:         CheckCursor(cwindow.x_coord, cwindow.y_coord,
        !            66:                     cwindow.x_size, cwindow.y_size);
        !            67:         gpr_$set_clip_window( cwindow, status);   
        !            68:        do {
        !            69: 
        !            70:            if (v->flags & VertexRelative) {
        !            71:                xp += v->x;
        !            72:                yp += v->y;
        !            73:              }
        !            74:            else {
        !            75:                xp = v->x + xbase;
        !            76:                yp = v->y + ybase;
        !            77:              }
        !            78:            /* XXX - ignore VertexCurved for now */
        !            79:            /* XXX - ignore VertexDrawLastPoint for now */
        !            80: 
        !            81:            if (v->flags & VertexDontDraw)
        !            82:                gpr_$move((short)xp, (short)yp, status);
        !            83:            else
        !            84:                gpr_$line((short)xp, (short)yp, status);
        !            85: 
        !            86:            v++;
        !            87:          } while (--vc > 0);
        !            88:       } while (--clipcount > 0);
        !            89:     RestoreCursor();   
        !            90: }
        !            91: 
        !            92: DrawCurve (verts, vertcount, xbase, ybase, srcpix, altpix, mode,
        !            93:           bwidth, bheight, pat, patlen, patmul, clips, clipcount, func, zmask)
        !            94:        Vertex *verts;
        !            95:        int vertcount, xbase, ybase, srcpix, altpix, mode, bwidth, bheight;
        !            96:        int pat, patlen, patmul, clipcount, zmask;
        !            97:        register int func;
        !            98:        CLIP *clips;
        !            99: {
        !           100:     static gpr_$line_pattern_t pattern = {0, 0, 0, 0};
        !           101:     int op = func;
        !           102: 
        !           103:     pattern[0] = pat; /* must invert bits ? */ 
        !           104:     if (mode == DrawSolidLine) patlen = 0;
        !           105:     gpr_$set_line_pattern((short)patmul, pattern, (short)patlen, status);
        !           106:     if (bwidth == 1 && bheight == 1)
        !           107:        switch (mode) {
        !           108:        case DrawSolidLine:
        !           109:            Draw_Solid(srcpix, xbase, ybase, op,
        !           110:                       vertcount, verts, clipcount, clips, zmask);
        !           111:            break;
        !           112:        case DrawDashedLine:
        !           113:            Draw_Solid(srcpix, xbase, ybase, op,
        !           114:                       vertcount, verts, clipcount, clips, zmask);
        !           115:            break;
        !           116:        case DrawPatternedLine:
        !           117:            Draw_Solid(srcpix, xbase, ybase, op,
        !           118:                       vertcount, verts, clipcount, clips, zmask);
        !           119:            break;
        !           120:        }
        !           121:     else
        !           122:        switch (mode) {
        !           123:            /* XXX - ignores brush specification for now */
        !           124:        case DrawSolidLine:
        !           125:            Draw_Solid(srcpix, xbase, ybase, op,
        !           126:                       vertcount, verts, clipcount, clips, zmask);
        !           127:            break;
        !           128:        case DrawDashedLine:
        !           129:            Draw_Solid(srcpix, xbase, ybase, op,
        !           130:                       vertcount, verts, clipcount, clips, zmask);
        !           131:            break;
        !           132:        case DrawPatternedLine:
        !           133:            Draw_Solid(srcpix, xbase, ybase, op,
        !           134:                       vertcount, verts, clipcount, clips, zmask);
        !           135:            break;
        !           136:        }
        !           137: 
        !           138: }

unix.superglobalmegacorp.com

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