1 /* -*- tab-width: 4 -*-
2  *
3  * Electric(tm) VLSI Design System
4  *
5  * File: egraphics.h
6  * Graphical definitions
7  * Written by: Steven M. Rubin, Static Free Software
8  *
9  * Copyright (c) 2000 Static Free Software.
10  *
11  * Electric(tm) is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * Electric(tm) is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with Electric(tm); see the file COPYING.  If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
24  * Boston, Mass 02111-1307, USA.
25  *
26  * Static Free Software
27  * 4119 Alpine Road
28  * Portola Valley, California 94028
29  * info@staticfreesoft.com
30  */
31 
32 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
33 extern "C"
34 {
35 #endif
36 
37 /******************************* GRAPHICS ********************************/
38 
39 /* bit map colors (in GRAPHICS->bits) */
40 #define LAYERN   0000			/* nothing                               */
41 #define LAYERH   0001			/* highlight color and bit plane         */
42 #define LAYEROE  0002			/* opaque layer escape bit               */
43 #define LAYERO   0176			/* opaque layers                         */
44 #define LAYERT1  0004			/* transparent layer 1                   */
45 #define LAYERT2  0010			/* transparent layer 2                   */
46 #define LAYERT3  0020			/* transparent layer 3                   */
47 #define LAYERT4  0040			/* transparent layer 4                   */
48 #define LAYERT5  0100			/* transparent layer 5                   */
49 #define LAYERG   0200			/* grid line color and bit plane         */
50 #define LAYERA   0777			/* everything                            */
51 
52 /* color map colors (in GRAPHICS->col) */
53 #define ALLOFF   0000			/* no color                              */
54 #define HIGHLIT  0001			/* highlight color and bit plane         */
55 #define COLORT1  0004			/* transparent color 1                   */
56 #define COLORT2  0010			/* transparent color 2                   */
57 #define COLORT3  0020			/* transparent color 3                   */
58 #define COLORT4  0040			/* transparent color 4                   */
59 #define COLORT5  0100			/* transparent color 5                   */
60 #define GRID     0200			/* grid line color and bit plane         */
61 
62 #define WHITE    0002			/* white                                 */
63 #define BLACK    0006			/* black                                 */
64 #define RED      0012			/* red                                   */
65 #define BLUE     0016			/* blue                                  */
66 #define GREEN    0022			/* green                                 */
67 #define CYAN     0026			/* cyan                                  */
68 #define MAGENTA  0032			/* magenta                               */
69 #define YELLOW   0036			/* yellow                                */
70 #define CELLTXT  0042			/* cell and port names                   */
71 #define CELLOUT  0046			/* cell outline                          */
72 #define WINBOR   0052			/* window border color                   */
73 #define HWINBOR  0056			/* highlighted window border color       */
74 #define MENBOR   0062			/* menu border color                     */
75 #define HMENBOR  0066			/* highlighted menu border color         */
76 #define MENTXT   0072			/* menu text color                       */
77 #define MENGLY   0076			/* menu glyph color                      */
78 #define CURSOR   0102			/* cursor color                          */
79 #define GRAY     0106			/* gray                                  */
80 #define ORANGE   0112			/* orange                                */
81 #define PURPLE   0116			/* purple                                */
82 #define BROWN    0122			/* brown                                 */
83 #define LGRAY    0126			/* light gray                            */
84 #define DGRAY    0132			/* dark gray                             */
85 #define LRED     0136			/* light red                             */
86 #define DRED     0142			/* dark red                              */
87 #define LGREEN   0146			/* light green                           */
88 #define DGREEN   0152			/* dark green                            */
89 #define LBLUE    0156			/* light blue                            */
90 #define DBLUE    0162			/* dark blue                             */
91 /*               0166 */		/* unassigned                            */
92 /*               0172 */		/* unassigned                            */
93 /*               0176 */		/* unassigned (and should stay that way) */
94 
95 /* drawing styles (in GRAPHICS->style) */
96 #define NATURE       1			/* choice between solid and patterned */
97 #define SOLIDC       0			/*   solid colors */
98 #define PATTERNED    1			/*   stippled with "raster" */
99 #define INVISIBLE    2			/* don't draw this layer */
100 #define INVTEMP      4			/* temporary for INVISIBLE bit */
101 #define OUTLINEPAT 010			/* if NATURE is PATTERNED, outline it */
102 
103 /* variables with the acutal colors to use for special graphics */
104 extern INTBIG el_maplength;		/* number of entries in color map */
105 extern INTBIG el_colcelltxt;	/* color to use for cell text and port names */
106 extern INTBIG el_colcell;		/* color to use for cell outline */
107 extern INTBIG el_colwinbor;		/* color to use for window border */
108 extern INTBIG el_colhwinbor;	/* color to use for highlighted window border */
109 extern INTBIG el_colmenbor;		/* color to use for menu border */
110 extern INTBIG el_colhmenbor;	/* color to use for highlighted menu border */
111 extern INTBIG el_colmentxt;		/* color to use for menu text */
112 extern INTBIG el_colmengly;		/* color to use for menu glyphs */
113 extern INTBIG el_colcursor;		/* color to use for cursor */
114 
115 /******************************* POLYGONS ********************************/
116 
117 /* drawing styles (in POLYGON->style) */
118 		/* polygons */
119 #define FILLED          0			/* closed polygon, filled in                 */
120 #define CLOSED          1			/* closed polygon, outline                   */
121 		/* rectangles */
122 #define FILLEDRECT      2			/* closed rectangle, filled in               */
123 #define CLOSEDRECT      3			/* closed rectangle, outline                 */
124 #define CROSSED         4			/* closed rectangle, outline crossed         */
125 		/* lines */
126 #define OPENED          5			/* open outline, solid                       */
127 #define OPENEDT1        6			/* open outline, dotted                      */
128 #define OPENEDT2        7			/* open outline, dashed                      */
129 #define OPENEDT3        8			/* open outline, thicker                     */
130 #define OPENEDO1        9			/* open outline pushed by 1                  */
131 #define VECTORS        10			/* vector endpoint pairs, solid              */
132 		/* curves */
133 #define CIRCLE         11			/* circle at [0] radius to [1]               */
134 #define THICKCIRCLE    12			/* thick circle at [0] radius to [1]         */
135 #define DISC           13			/* filled circle                             */
136 #define CIRCLEARC      14			/* arc of circle at [0] ends [1] and [2]     */
137 #define THICKCIRCLEARC 15			/* thick arc of circle at [0] ends [1] and [2] */
138 		/* text */
139 #define TEXTCENT       16			/* text at center                            */
140 #define TEXTTOP        17			/* text below top edge                       */
141 #define TEXTBOT        18			/* text above bottom edge                    */
142 #define TEXTLEFT       19			/* text to right of left edge                */
143 #define TEXTRIGHT      20			/* text to left of right edge                */
144 #define TEXTTOPLEFT    21			/* text to lower-right of top-left corner    */
145 #define TEXTBOTLEFT    22			/* text to upper-right of bottom-left corner */
146 #define TEXTTOPRIGHT   23			/* text to lower-left of top-right corner    */
147 #define TEXTBOTRIGHT   24			/* text to upper-left of bottom-right corner */
148 #define TEXTBOX        25			/* text that fits in box (may shrink)        */
149 		/* miscellaneous */
150 #define GRIDDOTS       26			/* grid dots in the window                   */
151 #define CROSS          27			/* cross                                     */
152 #define BIGCROSS       28			/* big cross                                 */
153 
154 /* text font sizes (in VARIABLE, NODEINST, PORTPROTO, and POLYGON->textdescription) */
155 #define TXTPOINTS        077		/* points from 1 to TXTMAXPOINTS */
156 #define TXTPOINTSSH        0		/* right-shift of TXTPOINTS */
157 #define TXTMAXPOINTS      63
158 #define TXTSETPOINTS(p)   ((p)<<TXTPOINTSSH)
159 #define TXTGETPOINTS(p)   (((p)&TXTPOINTS)>>TXTPOINTSSH)
160 
161 #define TXTQLAMBDA    077700		/* quarter-lambda from 0.25 to TXTMAXQLAMBDA/4 */
162 #define TXTQLAMBDASH       6		/* right-shift of TXTLAMBDA */
163 #define TXTMAXQLAMBDA    511
164 #define TXTSETQLAMBDA(ql) ((ql)<<TXTQLAMBDASH)
165 #define TXTGETQLAMBDA(ql) (((ql)&TXTQLAMBDA)>>TXTQLAMBDASH)
166 
167 #define TXTEDITOR     077770		/* fixed-width text for text editing */
168 #define TXTMENU       077771		/* text for menu selection */
169 
170 /******************** PROTOTYPES ********************/
171 
172 void    gra_drawline(WINDOWPART *win, INTBIG x1, INTBIG y1, INTBIG x2, INTBIG y2,
173 			GRAPHICS *desc, INTBIG texture);
174 void    gra_invertline(WINDOWPART *win, INTBIG x1, INTBIG y1, INTBIG x2, INTBIG y2);
175 void    gra_drawpolygon(WINDOWPART *win, INTBIG *x, INTBIG *y, INTBIG count, GRAPHICS *desc);
176 void    gra_drawbox(WINDOWPART *win, INTBIG lowx, INTBIG highx, INTBIG lowy, INTBIG highy,
177 			GRAPHICS *desc);
178 void    gra_invertbox(WINDOWPART *win, INTBIG lowx, INTBIG highx, INTBIG lowy, INTBIG highy);
179 void    gra_movebox(WINDOWPART *win, INTBIG sx, INTBIG sy, INTBIG wid, INTBIG hei,
180 			INTBIG dx, INTBIG dy);
181 INTBIG  gra_savebox(WINDOWPART *win, INTBIG lx, INTBIG hx, INTBIG ly, INTBIG hy);
182 void    gra_movesavedbox(INTBIG code, INTBIG dx, INTBIG dy);
183 BOOLEAN gra_restorebox(INTBIG code, INTBIG destroy);
184 void    gra_drawtext(WINDOWPART *win, INTBIG atx, INTBIG aty, INTBIG rotation,
185 			CHAR *s, GRAPHICS *desc);
186 void    gra_drawcircle(WINDOWPART *win, INTBIG atx, INTBIG aty, INTBIG radius, GRAPHICS *desc);
187 void    gra_drawthickcircle(WINDOWPART *win, INTBIG atx, INTBIG aty, INTBIG radius,
188 			GRAPHICS *desc);
189 void    gra_drawdisc(WINDOWPART *win, INTBIG atx, INTBIG aty, INTBIG radius, GRAPHICS *desc);
190 void    gra_drawcirclearc(WINDOWPART *win, INTBIG centerx, INTBIG centery, INTBIG p1_x, INTBIG p1_y,
191 			INTBIG p2_x, INTBIG p2_y, BOOLEAN thick, GRAPHICS *desc);
192 void    gra_drawgrid(WINDOWPART *win, POLYGON *obj);
193 void    gra_setrect(WINDOWFRAME *wf, INTBIG lx, INTBIG hx, INTBIG ly, INTBIG hy);
194 void    gra_termgraph(void);
195 
196 #if defined(__cplusplus) && !defined(ALLCPLUSPLUS)
197 }
198 #endif
199