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
bar3d(int left,int top,int right,int bottom,int depth,int topflag)27 void bar3d(int left,int top,int right,int bottom,int depth, int topflag)
28 {
29 int yofs, l_d, r_d, t_y, fast, col;
30
31 _DO_INIT_CHECK;
32
33 if (left > right) SWAP(int,left,right);
34 if (bottom < top) SWAP(int,bottom,top);
35
36 __gr_bar(left,top,right,bottom);
37
38 left += VL;
39 top += VT+PY;
40 right += VL;
41 bottom += VT+PY;
42 if (left > right) SWAP(int,left,right);
43 if (bottom < top) SWAP(int,bottom,top);
44
45 fast = (__gr_lstyle == SOLID_LINE) && (LNE.lno_width == 1);
46 LNE.lno_color = col = COL|WR;
47 if (fast) GrBox( left, top, right, bottom, col);
48 else GrCustomBox( left, top, right, bottom, &LNE);
49
50 if (depth == 0) return;
51
52 yofs = -depth * getmaxy() / getmaxx();
53 r_d = right+depth;
54 t_y = top + yofs;
55 if (fast) {
56 GrLine( right, bottom, r_d, bottom+yofs, col);
57 GrVLine(r_d, bottom+yofs, t_y, col);
58 } else {
59 GrCustomLine( right, bottom, r_d, bottom+yofs, &LNE);
60 GrCustomLine( r_d, bottom+yofs, r_d, t_y, &LNE);
61 }
62 if (topflag) {
63 l_d = left+depth;
64 if (fast) {
65 GrHLine( r_d, l_d, t_y, col);
66 GrLine( l_d, t_y, left, top, col);
67 GrLine( r_d, t_y, right, top, col);
68 } else {
69 GrCustomLine( r_d, t_y, l_d, t_y, &LNE);
70 GrCustomLine( l_d, t_y, left, top, &LNE);
71 GrCustomLine( r_d, t_y, right, top, &LNE);
72 }
73 }
74 }
75