UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ygraph.h
1 #if !defined(__N_YGRAPH_H_)
2 #define __N_YGRAPH_H_
3 
4 #include <X11/Xlib.h>
5 #include <X11/Xutil.h>
6 #include <xg_def.h>
7 /*
8 #ifdef DRAW_IN_PIXMAP
9 #define Y_WIN YDrawInPixmap(yd)
10 #define ZY_WIN YDrawInPixmap(YPoints.yd)
11 #else
12 #define Y_WIN yd->win
13 #define ZY_WIN YPoints.yd->win
14 #endif
15 */
16 #define Y_WIN YDrawInPixmap_(yd)
17 #define ZY_WIN YDrawInPixmap_(YPoints.yd)
18 typedef Drawable (*PixmapAndWindow)();
19 extern PixmapAndWindow YDrawInPixmap_;
20 
21 #define G_MAXPOINTS 192
22 #define G_MAXCOLOR 64
23 #define G_MAXLINE (G_MAXPOINTS*G_MAXCOLOR)
24 #define FILL_MODE 0x0100
25 #define POINT_MODE 0x0200
26 #define H_MODE 0x0400
27 #define V_MODE 0x0800
28 
29 #define TOPO_N 2048
30 extern int TOPO_C[];
31 
32 typedef struct {
33  short *data;
34  short *line_x, *line_y;
35  short *alt, *num;
36  int mc;
37  int sizeX;
38  int x1,y1;
39  int nx,ny;
40  int dx,dy;
41  int view;
42  int swapXY;
43  } TopoMap;
44 
45 typedef struct {
46  YDraw* yd;
47  XPoint xp[G_MAXLINE];
48  int nlines, nlines_;
49  short *alt, *num;
50  int max_pnt,max_seg;
51  int max_ind,ind;
52  int Previous,view;
53  short width,width2;
54  } YQPoints;
55 typedef struct {
56  XPoint* xp;
57  XSegment* sg;
58  int alt;
59  float falt;
60  int num;
61  int Npnt,Npnt_;
62  int Nseg,Nseg_;
63  int Nbar,Nbar_;
65 
66 extern YQPoints YPoints;
67 extern XPoint* Yxp;
68 
69 typedef struct {
70  YType* yd;
71  int type;
72  Cursor cursor;
73  } YDrawCursor;
74 typedef int (*UserPoint)();
75 
76 #define _XSET 0x01
77 #define _X_DRAW 0x2000
78 #define _Y_DRAW 0x4000
79 #define _XY_DRAW 0x6000
80 #define _YX_DRAW 0x6000
81 #define _XBOX 0x02
82 #define _XBAR 0x04
83 #define _XXOR 0x08
84 #define _XPIXMAP 0x10
85 #define _XBOX_JOB 0x1000
86 typedef struct {
87  short draw,width;
88  short x1,y1,x2,y2;
89  short cx1,cy1,cx2,cy2;
90  int colorBox,colorBar;
91  CallB cb;
92  CallB Dr_cb;
93  YDraw* yd;
94  int cyrsor_type;
95  } X_Box;
96 
97 /* --------------------------------------------------------- */
98 
99 typedef int (*DrawFunction)();
100 typedef struct {
101  int draw;
102  Pixmap pixmap;
103  short x,y;
104  int width,height;
105  int fg,bg;
106  DrawFunction df;
107  void* usrd;
108  } YCursor;
109 /************************************************************************/
110 #define LINE_SET 1
111 #define LINE_INS 2
112 #define LINE_DEL 3
113 #define LINE_INI 4
114 #define LINE_TO 5
115 #define LINE_NEW 6
116 #define Xor1Point 1
117 #define Xor2Point 2
118 
119 typedef int (*LineCB)();
120 typedef struct {
121  short *X, *Y;
122  short c_point,xo,yo,x1,y1,x2,y2;
123  short n_points, width, xor_width;
124  char XorFlag,NoBox,NoLine,DrawAny;
125  int color,colorB,xcolor;
126  LineCB cb;
127  void* usrd;
128  } POINTS;
129 
130 #define XF_COUNT 50
131 #define Int_(x) (int)(x+0.5)
132 
133 /***********************************************************************/
134 #define YFlashAllPixmap YFlushAllPixmap
135 #define YFlashPixmap YFlushPixmap
136 #define YAllPixmapToWindow YFlushAllPixmap
137 #define YAllWindowToPixmap YLockAllPixmap
138 /***********************************************************************/
139 #ifdef _NO_PROTO_
140 int XF_Flush();
141 Drawable YDrawToDrawable();
142 Drawable YDrawInPixmap();
143 XGCValues* YmGetGCValues();
144 void YSetDrawInPixmapAndWindow();
145 void YPutImage();
146 int YClearPixmapXY();
147 int YClearDataPixmap();
148 int YClearAllPixmap();
149 void YClearDrawWindow();
150 int YPixmapToWindow();
151 int YWindowToPixmap();
152 void YSetOldClip();
153 int YFlushAllPixmap();
154 int YFlushPixmap();
155 int YLockAllPixmap();
156 int YSetDrawInPixmap();
157 void YClearArea();
158 void YClearWindow();
159 void YCopyArea();
160 void YDrawPoint();
161 int YGetPixel();
162 void YDrawLine();
163 void YDrawLines();
164 void YFillPolygon();
165 void YFillArcs();
166 void YDrawArcs();
167 void YDrawRectangle();
168 void YFillRectangle();
169 void YCopyLines();
170 int YFlushLines();
171 int YBufferLine();
172 int YSetClip();
173 int YSetClipOrigin();
174 int YUnClip();
175 int YSetFunction();
176 void YSetXor();
177 void YDelXor();
178 void YSetLineWidth();
179 void YSetLineWidthStyle();
180 void BoxBar();
181 void YSetForeground();
182 void YSetBackground();
183 int YBufferPoint();
184 int YBufferSegment();
185 int YBufferBar();
186 int YFlushPoints();
187 int YFlushSegments();
188 int YFlushBars();
189 void YCopyPoints();
190 int YInitPoints();
191 int YInitBuffer();
192 int MoveToXYZ();
193 int TopoWidth();
194 int InitView();
195 int AccelerateTopo();
196 int YTopo();
197 int YDrawMap();
198 int SetColorArray();
199 int SetNumColors();
200 int SetAltitude();
201 int LineToXYZ();
202 int LineFromToXYZ();
203 int YDraw4DRectangle();
204 void YDrawText();
205 void YDrawText16();
206 void YDrawString();
207 void YDrawImageString();
208 void YPrintText();
209 void ClearText();
210 
211 void WClearMiddleLine();
212 void WClearLine();
213 void WDeleteLastLine();
214 int WInitLines();
215 int Xor_Draw_line();
216 int WXorDeleteLine();
217 int WLineTo();
218 int WNewLine();
219 int WXorNewLine();
220 int WInsertLine();
221 int WXorInsertLine();
222 int WRefreshLines();
223 int WDeleteLine();
224 int WNearestPoint2();
225 int WNearestPoint1();
226 int WNearestLine();
227 
228 #else /* _NO_PROTO_ */
229 int XF_Flush(int);
230 Drawable YDrawToDrawable(YDraw*);
231 Drawable YDrawInPixmap(YDraw*);
232 XGCValues* YmGetGCValues(GC);
233 void YSetDrawInPixmapAndWindow(int flag);
234 void YPutImage(YDraw*,XImage*,int sx,int sy,int dx,int dy,int w,int h);
235 int YClearPixmapXY(YDraw*,int x,int y,int w,int h);
236 int YClearDataPixmap(YDraw*);
237 int YClearAllPixmap(YDraw*);
238 void YClearDrawWindow(YDraw*);
239 int YPixmapToWindow(YDraw*,int x,int y,int w,int h,int x0,int y0);
240 int YWindowToPixmap(YDraw*,int x,int y,int w,int h,int x0,int y0);
241 void YSetOldClip(YDraw*);
242 int YFlushAllPixmap(YDraw*);
243 int YFlushPixmap(YDraw*);
244 int YLockAllPixmap(YDraw*);
245 int YSetDrawInPixmap(YDraw*,int b);
246 void YClearArea(YDraw*,int x,int y,int w,int h,Bool exposures);
247 void YClearWindow(YDraw*);
248 void YCopyArea(YDraw*,int sx,int sy,int w,int h,int dx, int dy);
249 void YDrawPoint(YDraw*,int x,int y);
250 int YGetPixel(YDraw*,int x,int y);
251 void YDrawLine(YDraw*,int x1,int y1,int x2,int y2);
252 void YDrawLines(YDraw*,XPoint* points,int n,int mode );
253 void YFillPolygon(YDraw*,XPoint* points,int n,int shape,int mode);
254 void YFillArcs(YDraw*,XArc* arcs,int n);
255 void YDrawArcs(YDraw*,XArc* arcs,int n);
256 void YDrawRectangle(YDraw*,int x,int y,int w,int h);
257 void YFillRectangle(YDraw*,int x,int y,int w,int h);
258 void YCopyLines(YDraw*,int dx,int dy);
259 int YFlushLines(YDraw*);
260 int YBufferLine(YDraw*,int x,int y);
261 int YSetClip(YDraw*,int x1,int y1,int x2,int y2);
262 int YSetClipOrigin(YDraw*,int x,int y);
263 int YUnClip(YDraw*);
264 int YSetFunction(YDraw*,int func);
265 void YSetXor(YDraw*);
266 void YDelXor(YDraw*);
267 void YSetLineWidth(YDraw*,int w);
268 void YSetLineWidthStyle(YDraw*,int w,int style);
269 void BoxBar(YDraw*,int x1,int y1,int x2,int y2,int c1,int c2);
270 void YSetForeground(YDraw*,unsigned long foreground);
271 void YSetBackground(YDraw*,unsigned long background);
272 int YBufferPoint(int ind,int x,int y);
273 int YBufferSegment(int ind,int x1,int y1,int x2,int y2);
274 int YBufferBar(int ind,int x,int y,int w,int h);
275 int YFlushPoints(void);
276 int YFlushSegments(void);
277 int YFlushBars(void);
278 void YCopyPoints(YDraw*,int dx,int dy);
279 int YInitPoints(YDraw*,int mc,short* num);
280 int YInitBuffer(YDraw*,int mc,short* num);
281 int MoveToXYZ(int x,int y,int z);
282 int TopoWidth(int width);
283 int InitView(YDraw*,int vw,int mc,short* num,short* alt);
284 int AccelerateTopo(Drawable,int widthH,int heightH,int widthV,int heightV);
285 int YTopo(YDraw*,short* z_b,int mc,short* alt,short* num,int n_y,int n_x,
286  short* line_y, short* line_x,int vw,int d_x,int d_y);
287 int YDrawMap(YDraw* yd,TopoMap* m);
288 int SetColorArray(char* NamePal,int* ind);
289 /*int SetNumColors(int n1,short* num1,int n2,int* num2);*/
290 int SetAltitude(int n1,short* alt1,int n2,short* alt2,int zmin,int zmax);
291 int LineToXYZ(int x2,int y2,int z2);
292 int LineFromToXYZ(int x1,int y1,int z1, int x2,int y2,int z2);
293 void YDrawText(YDraw* yd, int x,int y, XTextItem* items, int nitems);
294 void YDrawText16(YDraw* yd,int x,int y, XTextItem16* items, int nitems);
295 void YDrawString(YDraw *yd,int x,int y,char *string,int length);
296 void YDrawImageString(YDraw *yd,int x,int y,char *string,int length);
297 void ClearText(YDraw* yd, int x1,int y,int x2);
298 /*void YPrintText(yd, x, y, format[,arg]... );*/
299 
300 void WClearMiddleLine(YDraw* dw,POINTS* ps,int i);
301 void WClearLine(YDraw* dw,POINTS* ps,int i);
302 void WDeleteLastLine(YDraw* dw,POINTS* ps);
303 int WInitLines(YDraw* dw,POINTS* ps,int nn);
304 int Xor_Draw_line(YDraw* dw,POINTS* ps);
305 int WXorDeleteLine(YDraw* dw,POINTS* ps);
306 int WLineTo(YDraw* dw,POINTS* ps,int x,int y);
307 int WNewLine(YDraw* dw,POINTS* ps,int x,int y, int i);
308 int WXorNewLine(YDraw* dw,POINTS* ps,int x,int y, int i);
309 int WInsertLine(YDraw* dw,POINTS* ps,int x,int y, int i);
310 int WXorInsertLine(YDraw* dw,POINTS* ps,int x,int y, int i);
311 int WRefreshLines(YDraw* dw,POINTS* ps);
312 int WDeleteLine(YDraw* dw,POINTS* ps,int i);
313 int WNearestPoint2(short *x_,short *y_,int x,int y, int n);
314 int WNearestPoint1(short* x_,int x,int n);
315 int WNearestLine(short *xx,short *yy,int x,int y, int i,int n);
316 #endif /* _NO_PROTO_ */
317 /************************************************************************/
318 
319 #define MapWidth TopoWidth
320 #define AccelerateMap AccelerateTopo
321 
322 
323 #ifdef OLD_FUNCTION
324 
325 #define clrarea(yd,x,y,w,h,exposures) YClearArea(yd,x,y,w,h,exposures)
326 #define clrwin(yd) YClearWindow(yd)
327 #define cpyarea(yd, sx,sy, w,h, dx,dy) YCopyArea(yd, sx,sy, w,h, dx,dy)
328 #define fillpol(yd,points,n,shape,mode) YFillPolygon(yd,points,n,shape,mode)
329 #define set_clip(yd,x1,y1, x2,y2) YSetClip(yd,x1,y1, x2,y2)
330 #define un_clip(yd) YUnClip(yd)
331 #define Set_xor(yd) YSetXor(yd)
332 #define Del_xor(yd) YDelXor(yd)
333 #define Set_line_width(yd, w) YSetLineWidth(yd, w)
334 #define SetLineWidthStyle(yd, w, style) YSetLineWidthStyle(yd, w, style)
335 #define setforeground(yd, foreground) YSetForeground(yd, foreground)
336 #define setbackground(yd, background) YSetBackground(yd, background)
337 #define buffer_line(yd,x,y) YBufferLine(yd,x,y)
338 #define BufferPoint(ind, x,y) YBufferPoint(ind, x,y)
339 #define BufferSegment(ind,x1,y1, x2,y2) YBufferSegment(ind,x1,y1, x2,y2)
340 #define BufferBar(ind,x,y,w,h) YBufferBar(ind,x,y,w,h)
341 #define flush_lines(yd) YFlushLines(yd)
342 #define FlushPoints() YFlushPoints()
343 #define FlushSegments() YFlushSegments()
344 #define FlushBars() YFlushBars()
345 #define YInitSegments(yd, mc, num) YInitBuffer(yd, mc, num)
346 
347 #define init_lines WInitLines
348 /*#define new_line WNewLine */
349 #define clear_line WClearLine
350 #define insert_line WInsertLine
351 /*#define line_to WLineTo */
352 #define delete_line WDeleteLine
353 #define clear_taile WDeleteLastLine
354 #define Xor_new_line WXorNewLine
355 #define Xor_Clear_line WXorDeleteLine
356 #define Xor_insert_line WXorInsertLine
357 #define refresh_lines WRefreshLines
358 #define NearestPoint WNearestPoint2
359 #define NearestLine WNearestLine
360 
361 #define gprintf YPrintf
362 #define ClearText YClearText
363 
364 #endif
365 typedef int (*YCgmF)();
366 
367 #define YcgmSetForeground 1
368 #define YcgmSetBackground 2
369 #define YcgmSetFunction 3
370 #define YcgmSetLineAttributes 4
371 #define YcgmSetLineWidth 5
372 #define YcgmSetLineStyle 6
373 #define YcgmDrawLine 7
374 #define YcgmDrawLines 8
375 #define YcgmDrawSegments 9
376 #define YcgmDrawPoint 10
377 #define YcgmDrawPoints 11
378 #define YcgmCopyArea 12
379 #define YcgmSetTSOrigin 13
380 #define YcgmSetFillStyle 14
381 #define YcgmDrawRectangle 15
382 #define YcgmDrawRectangles 16
383 #define YcgmFillRectangle 17
384 #define YcgmFillPolygon 18
385 #define YcgmDrawCircle 19
386 #define YCgmSetClipRectangles 20
387 #define YcgmUnsetClip 21
388 
389 
390 
391 extern Window Draw_win;
392 #endif
Definition: ygraph.h:45
Definition: ymprog.h:1019
Definition: ygraph.h:86
Definition: ygraph.h:32
Definition: ygraph.h:69
Definition: ygraph.h:100
Definition: ymprog.h:649
Definition: ygraph.h:55
Definition: ygraph.h:120