1 /**
2 ** BCC2GRX - Interfacing Borland based graphics programs to LIBGRX
3 ** Copyright (C) 1993-97 by Hartmut Schirmer
4 **
5 **
6 ** Contact : Hartmut Schirmer
7 ** Feldstrasse 118
8 ** D-24105 Kiel
9 ** Germany
10 **
11 ** e-mail : hsc@techfak.uni-kiel.de
12 **
13 ** This file is part of the GRX graphics library.
14 **
15 ** The GRX graphics library is free software; you can redistribute it
16 ** and/or modify it under some conditions; see the "copying.grx" file
17 ** for details.
18 **
19 ** This library is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 **
23 **/
24
25 #include "bccgrx00.h"
26
27 /*
28 - Take care : Borland C defines polypoints as int * but
29 - assumes struct pointtype * .
30 - GRX requires int points[][2] !
31 - The good news are : Both definitions are compatible !
32 */
33
__gr_drawpol(int numpoints,void * polypoints,int close)34 void __gr_drawpol(int numpoints, void *polypoints, int close)
35 {
36 int *pp, x, y, sx, sy, nx, ny, fast;
37
38 _DO_INIT_CHECK;
39 LNE.lno_color = COL|WR;
40 fast = (__gr_lstyle == SOLID_LINE) && (LNE.lno_width == 1);
41 pp = (int *)polypoints;
42 while (numpoints > 0) {
43 x = sx = *(pp++)+VL;
44 y = sy = *(pp++)+VT+PY;
45 --numpoints;
46 while (numpoints > 0) {
47 nx = *(pp++) + VL;
48 ny = *(pp++) + VT + PY;
49 if (fast) GrLine( x, y, nx, ny, LNE.lno_color);
50 else GrCustomLine( x, y, nx, ny, &LNE);
51 x = nx; y = ny;
52 --numpoints;
53 if ( x==sx && y==sy)
54 break;
55 }
56 if ( close && (x != sx || y != sy))
57 {
58 if (fast) GrLine( x, y, sx, sy, LNE.lno_color);
59 else GrCustomLine( x, y, sx, sy, &LNE);
60 }
61 }
62 }
63
__gr_drawpoly(int numpoints,void * polypoints)64 void __gr_drawpoly(int numpoints, void *polypoints) {
65 drawpoly(numpoints, polypoints);
66 }
67
68