1: /************************************************************************/ 2: /************************************************************************/ 3: /* */ 4: /* DDX DRAW CURVE INTERFACE */ 5: /* */ 6: /* written by : MATT CORKUM 09-12-85 */ 7: /* modified 09-23-85: make it look like the ddx interface */ 8: /* */ 9: /* */ 10: /* The ddx draw curve interface code */ 11: /* */ 12: /* MODIFICATION HISTORY */ 13: /* */ 14: /* Carver 8510.21 Fixed "bwidth, bwidth" to be "bwidth, bheight" */ 15: /* */ 16: /* Carver 8510.21 Put in single plane code. */ 17: /* */ 18: /* Carver 8510.09 Fixed "if (mode = 1)" to be "if (mode == 1)" */ 19: /* */ 20: /* Carver 8510.03 Bad idea... after a few infinite loops we don't */ 21: /* ignore errors returned by the path list */ 22: /* converter anymore. */ 23: /* */ 24: /* Carver 8509.25 Removed error handling code */ 25: /* */ 26: /* */ 27: /************************************************************************/ 28: /************************************************************************/ 29: 30: /* THERE IS A CONFLICT BETWEEN ddxqvss.h and qvss.h (wpitch) SO MAKE SURE 31: TO INCLUDE ddxqvss.h FIRST */ 32: 33: #include "ddxqvss.h" 34: #include "qvss.h" 35: #include "extern.h" 36: #include "vstagbl.h" 37: 38: extern BITMAP pbm; 39: 40: 41: 42: DrawCurve( verts, vertcnt, xbase, ybase, srcpix, altpix, mode, bwidth, bheight, 43: pat, patlen, patmult, clips, clipcount, func, zmask ) 44: 45: Vertex *verts; /* vertexes and flags */ 46: int vertcnt; /* vertex count */ 47: int xbase; /* destination offset in x */ 48: int ybase; /* destination offset in y */ 49: int srcpix; /* source pixel */ 50: int altpix; /* alternate source pixel */ 51: int mode; /* 0:solid 1:dashed 2:patterned */ 52: int bwidth; /* brush width */ 53: int bheight; /* brush height */ 54: int pat; /* pattern */ 55: int patlen; /* pattern length */ 56: int patmult; /* pattern repeat count */ 57: CLIP *clips; /* clipping rectangles */ 58: int clipcount; /* count of clipping rectangles */ 59: int func; /* GX display function */ 60: int zmask; /* plane mask */ 61: 62: { 63: long error; /* error value to be returned*/ 64: char s_pixel_flag; /* single pixel flag */ 65: short *newvert; /* new vertex list */ 66: int newvertcnt; /* new vertex count */ 67: 68: 69: /* LIMIT THE DRAW OPERATION TO ONE PLANE */ 70: 71: if ((zmask & 1) == 0) 72: return; 73: 74: srcpix = srcpix & 1; 75: 76: altpix = altpix & 1; 77: 78: /* pre-process the specified path list ..... create another one 79: containing only absolute straight line drawing */ 80: 81: 82: error = path_list_converter ( &verts, &vertcnt, xbase, ybase, 83: &newvert, &newvertcnt ); 84: 85: if ( error ) 86: { 87: DeviceError ("DrawCurve failure\n"); 88: }; 89: 90: /* are we in single pixel mode or not ? */ 91: 92: if ( (bwidth == 1) && (bheight == 1)) s_pixel_flag = 1; 93: else s_pixel_flag = 0; 94: 95: if ((mode == 0) && (s_pixel_flag) ) /* solid single pixel */ 96: 97: /* call the solid single pixel draw command */ 98: 99: 100: error = draw_cons_solid_spix_line(srcpix, (short *)pbm.data, 101: pbm.width, pbm.height, func, newvertcnt, 102: newvert, clipcount, clips); 103: 104: 105: else if (mode == 0 ) /* solid mode */ 106: 107: 108: /* s_pixel_flag = 0 ( multiple pixel ) */ 109: /* call the solid multi-pixel draw command */ 110: 111: 112: error = draw_cons_solid_mpix_line(srcpix, bwidth, bheight, 113: (short *)pbm.data, pbm.width, pbm.height, 114: func, newvertcnt, newvert, clipcount, clips); 115: 116: else if ((mode == 1) && ( s_pixel_flag ) ) /* dashed mode */ 117: 118: 119: /* call dashed single pixel draw curve */ 120: 121: error = draw_cons_pat_spix_line(srcpix, (short *)pbm.data, 122: pbm.width, pbm.height, func, 123: newvertcnt, newvert, patlen, pat, 124: patmult, 0, 0, clipcount, clips); 125: 126: else if (mode == 1) /* dashed mode */ 127: 128: /* s_pixel_flag = 0 ( multiple pixel ) */ 129: /* call multiple pixel dashed draw command */ 130: 131: error = draw_cons_pat_mpix_line(srcpix, bwidth, bheight, 132: (short *)pbm.data, pbm.width, pbm.height, 133: func, newvertcnt, newvert, patlen, pat, 134: patmult, 0, 0, clipcount, clips); 135: 136: else if ((mode == 2) && (s_pixel_flag) ) /* patterned mode */ 137: { 138: 139: error = draw_2_src_cons_spix_line(srcpix, altpix, 140: (short *)pbm.data, pbm.width, pbm.height, 141: func, newvertcnt, newvert, patlen, pat, 142: patmult, 0, 0, clipcount, clips); 143: 144: } /* end of patterned single pixel */ 145: 146: 147: else if (mode == 2) /* patterned lines */ 148: { 149: 150: error = draw_2_src_mpix_line(srcpix, altpix, 151: bwidth, bheight, (short *)pbm.data, pbm.width, 152: pbm.height, func, newvertcnt, 153: newvert, patlen, pat, patmult, 154: 0, 0, clipcount, clips); 155: 156: } 157: 158: }