1 /* 2 * bltGraph.h -- 3 * 4 * Copyright 1991-1998 Lucent Technologies, Inc. 5 * 6 * Permission to use, copy, modify, and distribute this software and 7 * its documentation for any purpose and without fee is hereby 8 * granted, provided that the above copyright notice appear in all 9 * copies and that both that the copyright notice and warranty 10 * disclaimer appear in supporting documentation, and that the names 11 * of Lucent Technologies any of their entities not be used in 12 * advertising or publicity pertaining to distribution of the software 13 * without specific, written prior permission. 14 * 15 * Lucent Technologies disclaims all warranties with regard to this 16 * software, including all implied warranties of merchantability and 17 * fitness. In no event shall Lucent Technologies be liable for any 18 * special, indirect or consequential damages or any damages 19 * whatsoever resulting from loss of use, data or profits, whether in 20 * an action of contract, negligence or other tortuous action, arising 21 * out of or in connection with the use or performance of this 22 * software. 23 */ 24 25 #ifndef _BLT_GRAPH_H 26 #define _BLT_GRAPH_H 27 28 #include "bltInt.h" 29 #include "bltHash.h" 30 #include "bltBind.h" 31 #include "bltChain.h" 32 #include "bltPs.h" 33 #include "bltTile.h" 34 35 typedef struct GraphStruct Graph; 36 typedef struct ElementStruct Element; 37 typedef struct LegendStruct Legend; 38 39 #include "bltGrAxis.h" 40 #include "bltGrLegd.h" 41 42 #define MARKER_UNDER 1 /* Draw markers designated to lie underneath 43 * elements, grids, legend, etc. */ 44 #define MARKER_ABOVE 0 /* Draw markers designated to rest above 45 * elements, grids, legend, etc. */ 46 47 #define PADX 2 /* Padding between labels/titles */ 48 #define PADY 2 /* Padding between labels */ 49 50 #define MINIMUM_MARGIN 20 /* Minimum margin size */ 51 52 53 #define BOUND(x, lo, hi) \ 54 (((x) > (hi)) ? (hi) : ((x) < (lo)) ? (lo) : (x)) 55 56 /* 57 * ------------------------------------------------------------------- 58 * 59 * Graph component structure definitions 60 * 61 * ------------------------------------------------------------------- 62 */ 63 #define PointInGraph(g,x,y) \ 64 (((x) <= (g)->right) && ((x) >= (g)->left) && \ 65 ((y) <= (g)->bottom) && ((y) >= (g)->top)) 66 67 /* 68 * ------------------------------------------------------------------- 69 * 70 * ClassType -- 71 * 72 * Enumerates the different types of graph elements this program 73 * produces. An element can be either a line or a bar. 74 * 75 * ------------------------------------------------------------------- 76 */ 77 typedef enum { 78 CLASS_UNKNOWN, 79 CLASS_LINE_ELEMENT, 80 CLASS_STRIP_ELEMENT, 81 CLASS_BAR_ELEMENT, 82 CLASS_BITMAP_MARKER, 83 CLASS_IMAGE_MARKER, 84 CLASS_LINE_MARKER, 85 CLASS_POLYGON_MARKER, 86 CLASS_TEXT_MARKER, 87 CLASS_WINDOW_MARKER 88 89 } ClassType; 90 91 /* 92 * Mask values used to selectively enable GRAPH or BARCHART entries in 93 * the various configuration specs. 94 */ 95 #define GRAPH (TK_CONFIG_USER_BIT << 1) 96 #define STRIPCHART (TK_CONFIG_USER_BIT << 2) 97 #define BARCHART (TK_CONFIG_USER_BIT << 3) 98 #define LINE_GRAPHS (GRAPH | STRIPCHART) 99 #define ALL_GRAPHS (GRAPH | BARCHART | STRIPCHART) 100 101 #define PEN_DELETE_PENDING (1<<0) 102 #define ACTIVE_PEN (TK_CONFIG_USER_BIT << 6) 103 #define NORMAL_PEN (TK_CONFIG_USER_BIT << 7) 104 #define ALL_PENS (NORMAL_PEN | ACTIVE_PEN) 105 106 /* 107 * ------------------------------------------------------------------- 108 * 109 * FreqInfo -- 110 * 111 * ------------------------------------------------------------------- 112 */ 113 typedef struct { 114 int freq; /* Number of occurrences of x-coordinate */ 115 Axis2D axes; /* Indicates which x and y axis are mapped to 116 * the x-value */ 117 double sum; /* Sum of the ordinates of each duplicate 118 * abscissa */ 119 int count; 120 double lastY; 121 122 } FreqInfo; 123 124 /* 125 * ------------------------------------------------------------------- 126 * 127 * FreqKey -- 128 * 129 * 130 * ------------------------------------------------------------------- 131 */ 132 typedef struct { 133 double value; /* Duplicated abscissa */ 134 Axis2D axes; /* Axis mapping of element */ 135 } FreqKey; 136 137 /* 138 * BarModes -- 139 * 140 * Bar elements are displayed according to their x-y coordinates. 141 * If two bars have the same abscissa (x-coordinate), the bar 142 * segments will be drawn according to one of the following 143 * modes: 144 */ 145 146 typedef enum BarModes { 147 MODE_INFRONT, /* Each successive segment is drawn in 148 * front of the previous. */ 149 MODE_STACKED, /* Each successive segment is drawn 150 * stacked above the previous. */ 151 MODE_ALIGNED, /* Each successive segment is drawn 152 * aligned to the previous from 153 * right-to-left. */ 154 MODE_OVERLAP /* Like "aligned", each successive segment 155 * is drawn from right-to-left. In addition 156 * the segments will overlap each other 157 * by a small amount */ 158 } BarMode; 159 160 typedef struct PenStruct Pen; 161 typedef struct MarkerStruct Marker; 162 163 typedef Pen *(PenCreateProc) _ANSI_ARGS_((void)); 164 typedef int (PenConfigureProc) _ANSI_ARGS_((Graph *graphPtr, Pen *penPtr)); 165 typedef void (PenDestroyProc) _ANSI_ARGS_((Graph *graphPtr, Pen *penPtr)); 166 167 struct PenStruct { 168 char *name; /* Pen style identifier. If NULL pen 169 * was statically allocated. */ 170 Blt_Uid classUid; /* Type of pen */ 171 char *typeId; /* String token identifying the type of pen */ 172 unsigned int flags; /* Indicates if the pen element is active or 173 * normal */ 174 int refCount; /* Reference count for elements using 175 * this pen. */ 176 Blt_HashEntry *hashPtr; 177 178 Tk_ConfigSpec *configSpecs; /* Configuration specifications */ 179 180 PenConfigureProc *configProc; 181 PenDestroyProc *destroyProc; 182 183 }; 184 185 typedef enum { 186 PS_MONO_BACKGROUND, 187 PS_MONO_FOREGROUND 188 } MonoAttribute; 189 190 /* 191 * PostScript -- 192 * 193 * Structure contains information specific to the outputting of 194 * PostScript commands to print the graph. 195 * 196 */ 197 typedef struct { 198 /* User configurable fields */ 199 200 int decorations; /* If non-zero, print graph with 201 * color background and 3D borders */ 202 203 int reqWidth, reqHeight; /* If greater than zero, represents the 204 * requested dimensions of the printed graph */ 205 int reqPaperWidth; 206 int reqPaperHeight; /* Requested dimensions for the PostScript 207 * page. Can constrain the size of the graph 208 * if the graph (plus padding) is larger than 209 * the size of the page. */ 210 Blt_Pad padX, padY; /* Requested padding on the exterior of the 211 * graph. This forms the bounding box for 212 * the page. */ 213 PsColorMode colorMode; /* Selects the color mode for PostScript page 214 * (0=monochrome, 1=greyscale, 2=color) */ 215 char *colorVarName; /* If non-NULL, is the name of a Tcl array 216 * variable containing X to PostScript color 217 * translations */ 218 char *fontVarName; /* If non-NULL, is the name of a Tcl array 219 * variable containing X to PostScript font 220 * translations */ 221 int landscape; /* If non-zero, orient the page 90 degrees */ 222 int center; /* If non-zero, center the graph on the page */ 223 int maxpect; /* If non-zero, indicates to scale the graph 224 * so that it fills the page (maintaining the 225 * aspect ratio of the graph) */ 226 int addPreview; /* If non-zero, generate a preview image and 227 * add it to the PostScript output */ 228 int footer; /* If non-zero, a footer with the title, date 229 * and user will be added to the PostScript 230 * output outside of the bounding box. */ 231 int previewFormat; /* Format of EPS preview: 232 * PS_PREVIEW_WMF, PS_PREVIEW_EPSI, or 233 * PS_PREVIEW_TIFF. */ 234 235 /* Computed fields */ 236 237 int left, bottom; /* Bounding box of PostScript plot. */ 238 int right, top; 239 240 double pageScale; /* Scale of page. Set if "-maxpect" option 241 * is set, otherwise 1.0. */ 242 } PostScript; 243 244 /* 245 * ------------------------------------------------------------------- 246 * 247 * Grid 248 * 249 * Contains attributes of describing how to draw grids (at major 250 * ticks) in the graph. Grids may be mapped to either/both x and 251 * y axis. 252 * 253 * ------------------------------------------------------------------- 254 */ 255 typedef struct { 256 GC gc; /* Graphics context for the grid. */ 257 Axis2D axes; 258 int hidden; /* If non-zero, grid isn't displayed. */ 259 int minorGrid; /* If non-zero, draw grid line for minor 260 * axis ticks too */ 261 Blt_Dashes dashes; /* Dashstyle of the grid. This represents 262 * an array of alternatingly drawn pixel 263 * values. */ 264 int lineWidth; /* Width of the grid lines */ 265 XColor *colorPtr; /* Color of the grid lines */ 266 267 struct GridSegments { 268 Segment2D *segments; /* Array of line segments representing the 269 * x or y grid lines */ 270 int nSegments; /* # of axis segments. */ 271 } x, y; 272 int raised; 273 274 } Grid; 275 276 /* 277 * ------------------------------------------------------------------- 278 * 279 * Crosshairs 280 * 281 * Contains the line segments positions and graphics context used 282 * to simulate crosshairs (by XOR-ing) on the graph. 283 * 284 * ------------------------------------------------------------------- 285 */ 286 typedef struct CrosshairsStruct Crosshairs; 287 288 typedef struct { 289 short int width, height; /* Extents of the margin */ 290 291 short int axesOffset; 292 short int axesTitleLength; /* Width of the widest title to be shown. 293 * Multiple titles are displayed in 294 * another margin. This is the minimum 295 * space requirement. */ 296 unsigned int nAxes; /* Number of axes to be displayed */ 297 Blt_Chain *axes; /* Extra axes associated with this margin */ 298 299 char *varName; /* If non-NULL, name of variable to be 300 * updated when the margin size changes */ 301 302 int reqSize; /* Requested size of margin */ 303 int site; /* Indicates where margin is located: 304 * left/right/top/bottom. */ 305 } Margin; 306 307 #define MARGIN_NONE -1 308 #define MARGIN_BOTTOM 0 309 #define MARGIN_LEFT 1 310 #define MARGIN_TOP 2 311 #define MARGIN_RIGHT 3 312 313 #define rightMargin margins[MARGIN_RIGHT] 314 #define leftMargin margins[MARGIN_LEFT] 315 #define topMargin margins[MARGIN_TOP] 316 #define bottomMargin margins[MARGIN_BOTTOM] 317 318 /* 319 * ------------------------------------------------------------------- 320 * 321 * Graph -- 322 * 323 * Top level structure containing everything pertaining to 324 * the graph. 325 * 326 * ------------------------------------------------------------------- 327 */ 328 struct GraphStruct { 329 unsigned int flags; /* Flags; see below for definitions. */ 330 Tcl_Interp *interp; /* Interpreter associated with graph */ 331 Tk_Window tkwin; /* Window that embodies the graph. NULL 332 * means that the window has been 333 * destroyed but the data structures 334 * haven't yet been cleaned up. */ 335 Display *display; /* Display containing widget; needed, 336 * among other things, to release 337 * resources after tkwin has already gone 338 * away. */ 339 Tcl_Command cmdToken; /* Token for graph's widget command. */ 340 341 char *data; /* This value isn't used in C code. 342 * It may be used in Tcl bindings to 343 * associate extra data. */ 344 345 Tk_Cursor cursor; 346 347 int inset; /* Sum of focus highlight and 3-D 348 * border. Indicates how far to 349 * offset the graph from outside 350 * edge of the window. */ 351 352 int borderWidth; /* Width of the exterior border */ 353 int relief; /* Relief of the exterior border */ 354 Tk_3DBorder border; /* 3-D border used to delineate the plot 355 * surface and outer edge of window */ 356 357 int highlightWidth; /* Width in pixels of highlight to draw 358 * around widget when it has the focus. 359 * <= 0 means don't draw a highlight. */ 360 XColor *highlightBgColor; /* Color for drawing traversal highlight 361 * area when highlight is off. */ 362 XColor *highlightColor; /* Color for drawing traversal highlight. */ 363 364 char *title; 365 short int titleX, titleY; 366 TextStyle titleTextStyle; /* Graph title */ 367 368 char *takeFocus; 369 370 int reqWidth, reqHeight; /* Requested size of graph window */ 371 int width, height; /* Size of graph window or PostScript 372 * page */ 373 374 Blt_HashTable penTable; /* Table of pens */ 375 376 struct Component { 377 Blt_HashTable table; /* Hash table of ids. */ 378 Blt_Chain *displayList; /* Display list. */ 379 Blt_HashTable tagTable; /* Table of bind tags. */ 380 } elements, markers, axes; 381 382 Blt_Uid classUid; /* Default element type */ 383 384 Blt_BindTable bindTable; 385 int nextMarkerId; /* Tracks next marker identifier available */ 386 387 Blt_Chain *axisChain[4]; /* Chain of axes for each of the 388 * margins. They're separate from the 389 * margin structures to make it easier 390 * to invert the X-Y axes by simply 391 * switching chain pointers. 392 */ 393 Margin margins[4]; 394 395 PostScript *postscript; /* PostScript options: see bltGrPS.c */ 396 Legend *legend; /* Legend information: see bltGrLegd.c */ 397 Crosshairs *crosshairs; /* Crosshairs information: see bltGrHairs.c */ 398 Grid *gridPtr; /* Grid attribute information */ 399 400 int halo; /* Maximum distance allowed between points 401 * when searching for a point */ 402 int inverted; /* If non-zero, indicates the x and y axis 403 * positions should be inverted. */ 404 Blt_Tile tile; 405 GC drawGC; /* Used for drawing on the margins. This 406 * includes the axis lines */ 407 GC fillGC; /* Used to fill the background of the 408 * margins. The fill is governed by 409 * the background color or the tiled 410 * pixmap. */ 411 int plotBorderWidth; /* Width of interior 3-D border. */ 412 int plotRelief; /* 3-d effect: TK_RELIEF_RAISED etc. */ 413 XColor *plotBg; /* Color of plotting surface */ 414 415 GC plotFillGC; /* Used to fill the plotting area with a 416 * solid background color. The fill color 417 * is stored in "plotBg". */ 418 419 /* If non-zero, force plot to conform to aspect ratio W/H */ 420 double aspect; 421 422 short int left, right; /* Coordinates of plot bbox */ 423 short int top, bottom; 424 425 Blt_Pad padX; /* Vertical padding for plotarea */ 426 int vRange, vOffset; /* Vertical axis range and offset from the 427 * left side of the graph window. Used to 428 * transform coordinates to vertical 429 * axes. */ 430 Blt_Pad padY; /* Horizontal padding for plotarea */ 431 int hRange, hOffset; /* Horizontal axis range and offset from 432 * the top of the graph window. Used to 433 * transform horizontal axes */ 434 double vScale, hScale; 435 436 int doubleBuffer; /* If non-zero, draw the graph into a pixmap 437 * first to reduce flashing. */ 438 int backingStore; /* If non-zero, cache elements by drawing 439 * them into a pixmap */ 440 Pixmap backPixmap; /* Pixmap used to cache elements 441 * displayed. If *backingStore* is 442 * non-zero, each element is drawn 443 * into this pixmap before it is 444 * copied onto the screen. The pixmap 445 * then acts as a cache (only the 446 * pixmap is redisplayed if the none 447 * of elements have changed). This is 448 * done so that markers can be redrawn 449 * quickly over elements without 450 * redrawing each element. */ 451 int backWidth, backHeight; /* Size of element backing store pixmap. */ 452 453 /* 454 * barchart specific information 455 */ 456 double baseline; /* Baseline from bar chart. */ 457 double barWidth; /* Default width of each bar in graph units. 458 * The default width is 1.0 units. */ 459 BarMode mode; /* Mode describing how to display bars 460 * with the same x-coordinates. Mode can 461 * be "stack", "align", or "normal" */ 462 FreqInfo *freqArr; /* Contains information about duplicate 463 * x-values in bar elements (malloc-ed). 464 * This information can also be accessed 465 * by the frequency hash table */ 466 Blt_HashTable freqTable; /* */ 467 int nStacks; /* Number of entries in frequency array. 468 * If zero, indicates nothing special needs 469 * to be done for "stack" or "align" modes */ 470 char *redrawCmd; /* New redraw callback. This command is 471 executed after the graph is 472 redrawed. You can use it to generate 473 postcript frames, and from 474 them a movie, or to update a 475 tracking label associated to the cursor 476 coordinates. 477 478 Use it for example as 479 480 proc redrawcmd { graph } { 481 $graph postscript output <filename> 482 .... 483 } 484 485 $graph configure -redrawcmd datacmd 486 487 See the movie.tcl example. 488 */ 489 490 }; 491 492 /* 493 * Bit flags definitions: 494 * 495 * All kinds of state information kept here. All these 496 * things happen when the window is available to draw into 497 * (DisplayGraph). Need the window width and height before 498 * we can calculate graph layout (i.e. the screen coordinates 499 * of the axes, elements, titles, etc). But we want to do this 500 * only when we have to, not every time the graph is redrawn. 501 * 502 * Same goes for maintaining a pixmap to double buffer graph 503 * elements. Need to mark when the pixmap needs to updated. 504 * 505 * 506 * MAP_ITEM Indicates that the element/marker/axis 507 * configuration has changed such that 508 * its layout of the item (i.e. its 509 * position in the graph window) needs 510 * to be recalculated. 511 * 512 * MAP_ALL Indicates that the layout of the axes and 513 * all elements and markers and the graph need 514 * to be recalculated. Otherwise, the layout 515 * of only those markers and elements that 516 * have changed will be reset. 517 * 518 * GET_AXIS_GEOMETRY Indicates that the size of the axes needs 519 * to be recalculated. 520 * 521 * RESET_AXES Flag to call to Blt_ResetAxes routine. 522 * This routine recalculates the scale offset 523 * (used for mapping coordinates) of each axis. 524 * If an axis limit has changed, then it sets 525 * flags to re-layout and redraw the entire 526 * graph. This needs to happend before the axis 527 * can compute transformations between graph and 528 * screen coordinates. 529 * 530 * LAYOUT_NEEDED 531 * 532 * REDRAW_BACKING_STORE If set, redraw all elements into the pixmap 533 * used for buffering elements. 534 * 535 * REDRAW_PENDING Non-zero means a DoWhenIdle handler has 536 * already been queued to redraw this window. 537 * 538 * DRAW_LEGEND Non-zero means redraw the legend. If this is 539 * the only DRAW_* flag, the legend display 540 * routine is called instead of the graph 541 * display routine. 542 * 543 * DRAW_MARGINS Indicates that the margins bordering 544 * the plotting area need to be redrawn. 545 * The possible reasons are: 546 * 547 * 1) an axis configuration changed 548 * 2) an axis limit changed 549 * 3) titles have changed 550 * 4) window was resized. 551 * 552 * GRAPH_FOCUS 553 * 554 * EXEC_REDRAWCMD Mark when the redrawing command is 555 * been executed, avoiding inifinite 556 * redraw loops. 557 */ 558 559 #define MAP_ITEM (1<<0) /* 0x0001 */ 560 #define MAP_ALL (1<<1) /* 0x0002 */ 561 #define GET_AXIS_GEOMETRY (1<<2) /* 0x0004 */ 562 #define RESET_AXES (1<<3) /* 0x0008 */ 563 #define LAYOUT_NEEDED (1<<4) /* 0x0010 */ 564 565 #define REDRAW_PENDING (1<<8) /* 0x0100 */ 566 #define DRAW_LEGEND (1<<9) /* 0x0200 */ 567 #define DRAW_MARGINS (1<<10)/* 0x0400 */ 568 #define REDRAW_BACKING_STORE (1<<11)/* 0x0800 */ 569 570 #define GRAPH_FOCUS (1<<12)/* 0x1000 */ 571 #define EXEC_REDRAWCMD (1<<13)/* 0x1000 */ 572 573 #define MAP_WORLD (MAP_ALL|RESET_AXES|GET_AXIS_GEOMETRY) 574 #define REDRAW_WORLD (DRAW_MARGINS | DRAW_LEGEND) 575 #define RESET_WORLD (REDRAW_WORLD | MAP_WORLD) 576 577 /* 578 * ---------------------- Forward declarations ------------------------ 579 */ 580 581 extern int Blt_CreatePostScript _ANSI_ARGS_((Graph *graphPtr)); 582 extern int Blt_CreateCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 583 extern int Blt_CreateGrid _ANSI_ARGS_((Graph *graphPtr)); 584 extern double Blt_InvHMap _ANSI_ARGS_((Graph *graphPtr, Axis *axisPtr, 585 double x)); 586 extern double Blt_InvVMap _ANSI_ARGS_((Graph *graphPtr, Axis *axisPtr, 587 double x)); 588 extern double Blt_HMap _ANSI_ARGS_((Graph *graphPtr, Axis *axisPtr, double x)); 589 extern double Blt_VMap _ANSI_ARGS_((Graph *graphPtr, Axis *axisPtr, double y)); 590 extern Point2D Blt_InvMap2D _ANSI_ARGS_((Graph *graphPtr, double x, 591 double y, Axis2D *pairPtr)); 592 extern Point2D Blt_Map2D _ANSI_ARGS_((Graph *graphPtr, double x, 593 double y, Axis2D *pairPtr)); 594 extern Graph *Blt_GetGraphFromWindowData _ANSI_ARGS_((Tk_Window tkwin)); 595 extern void Blt_AdjustAxisPointers _ANSI_ARGS_((Graph *graphPtr)); 596 extern int Blt_LineRectClip _ANSI_ARGS_((Extents2D *extsPtr, Point2D *p, 597 Point2D *q)); 598 extern int Blt_PolyRectClip _ANSI_ARGS_((Extents2D *extsPtr, Point2D *inputPts, 599 int nInputPts, Point2D *outputPts)); 600 601 extern void Blt_ComputeStacks _ANSI_ARGS_((Graph *graphPtr)); 602 extern void Blt_ConfigureCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 603 extern void Blt_DestroyAxes _ANSI_ARGS_((Graph *graphPtr)); 604 extern void Blt_DestroyCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 605 extern void Blt_DestroyGrid _ANSI_ARGS_((Graph *graphPtr)); 606 extern void Blt_DestroyElements _ANSI_ARGS_((Graph *graphPtr)); 607 extern void Blt_DestroyMarkers _ANSI_ARGS_((Graph *graphPtr)); 608 extern void Blt_DestroyPostScript _ANSI_ARGS_((Graph *graphPtr)); 609 extern void Blt_DrawAxes _ANSI_ARGS_((Graph *graphPtr, Drawable drawable)); 610 extern void Blt_DrawAxisLimits _ANSI_ARGS_((Graph *graphPtr, 611 Drawable drawable)); 612 extern void Blt_DrawElements _ANSI_ARGS_((Graph *graphPtr, Drawable drawable)); 613 extern void Blt_DrawActiveElements _ANSI_ARGS_((Graph *graphPtr, 614 Drawable drawable)); 615 extern void Blt_DrawGraph _ANSI_ARGS_((Graph *graphPtr, Drawable drawable, 616 int backingStore)); 617 extern void Blt_DrawGrid _ANSI_ARGS_((Graph *graphPtr, Drawable drawable)); 618 extern void Blt_DrawMarkers _ANSI_ARGS_((Graph *graphPtr, Drawable drawable, 619 int under)); 620 extern void Blt_Draw2DSegments _ANSI_ARGS_((Display *display, 621 Drawable drawable, GC gc, Segment2D *segments, int nSegments)); 622 extern int Blt_GetCoordinate _ANSI_ARGS_((Tcl_Interp *interp, 623 char *expr, double *valuePtr)); 624 extern void Blt_InitFreqTable _ANSI_ARGS_((Graph *graphPtr)); 625 extern void Blt_LayoutGraph _ANSI_ARGS_((Graph *graphPtr)); 626 extern void Blt_LayoutMargins _ANSI_ARGS_((Graph *graphPtr)); 627 extern void Blt_EventuallyRedrawGraph _ANSI_ARGS_((Graph *graphPtr)); 628 extern void Blt_ResetAxes _ANSI_ARGS_((Graph *graphPtr)); 629 extern void Blt_ResetStacks _ANSI_ARGS_((Graph *graphPtr)); 630 extern void Blt_GraphExtents _ANSI_ARGS_((Graph *graphPtr, Extents2D *extsPtr)); 631 extern void Blt_DisableCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 632 extern void Blt_EnableCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 633 extern void Blt_MapAxes _ANSI_ARGS_((Graph *graphPtr)); 634 extern void Blt_MapElements _ANSI_ARGS_((Graph *graphPtr)); 635 extern void Blt_MapGraph _ANSI_ARGS_((Graph *graphPtr)); 636 extern void Blt_MapMarkers _ANSI_ARGS_((Graph *graphPtr)); 637 extern void Blt_MapGrid _ANSI_ARGS_((Graph *graphPtr)); 638 extern void Blt_UpdateCrosshairs _ANSI_ARGS_((Graph *graphPtr)); 639 extern void Blt_DestroyPens _ANSI_ARGS_((Graph *graphPtr)); 640 extern int Blt_GetPen _ANSI_ARGS_((Graph *graphPtr, char *name, 641 Blt_Uid classUid, Pen **penPtrPtr)); 642 extern Pen *Blt_BarPen _ANSI_ARGS_((char *penName)); 643 extern Pen *Blt_LinePen _ANSI_ARGS_((char *penName)); 644 extern Pen *Blt_CreatePen _ANSI_ARGS_((Graph *graphPtr, char *penName, 645 Blt_Uid classUid, int nOpts, char **options)); 646 extern int Blt_InitLinePens _ANSI_ARGS_((Graph *graphPtr)); 647 extern int Blt_InitBarPens _ANSI_ARGS_((Graph *graphPtr)); 648 extern void Blt_FreePen _ANSI_ARGS_((Graph *graphPtr, Pen *penPtr)); 649 650 extern int Blt_VirtualAxisOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 651 int argc, char **argv)); 652 extern int Blt_AxisOp _ANSI_ARGS_((Graph *graphPtr, int margin, int argc, 653 char **argv)); 654 extern int Blt_ElementOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 655 int argc, char **argv, Blt_Uid classUid)); 656 extern int Blt_GridOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 657 int argc, char **argv)); 658 extern int Blt_CrosshairsOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 659 int argc, char **argv)); 660 extern int Blt_MarkerOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 661 int argc, char **argv)); 662 extern int Blt_PenOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 663 int argc, char **argv)); 664 extern int Blt_PointInPolygon _ANSI_ARGS_((Point2D *samplePtr, 665 Point2D *screenPts, int nScreenPts)); 666 extern int Blt_RegionInPolygon _ANSI_ARGS_((Extents2D *extsPtr, Point2D *points, 667 int nPoints, int enclosed)); 668 extern int Blt_PointInSegments _ANSI_ARGS_((Point2D *samplePtr, 669 Segment2D *segments, int nSegments, double halo)); 670 extern int Blt_PostScriptOp _ANSI_ARGS_((Graph *graphPtr, Tcl_Interp *interp, 671 int argc, char **argv)); 672 extern int Blt_GraphUpdateNeeded _ANSI_ARGS_((Graph *graphPtr)); 673 extern int Blt_DefaultAxes _ANSI_ARGS_((Graph *graphPtr)); 674 extern Axis *Blt_GetFirstAxis _ANSI_ARGS_((Blt_Chain *chainPtr)); 675 extern void Blt_UpdateAxisBackgrounds _ANSI_ARGS_((Graph *graphPtr)); 676 extern void Blt_GetAxisSegments _ANSI_ARGS_((Graph *graphPtr, Axis *axisPtr, 677 Segment2D **segPtrPtr, int *nSegmentsPtr)); 678 extern Marker *Blt_NearestMarker _ANSI_ARGS_((Graph *graphPtr, int x, int y, 679 int under)); 680 extern Axis *Blt_NearestAxis _ANSI_ARGS_((Graph *graphPtr, int x, int y)); 681 extern int Blt_ConfigureAxes(Graph* graphPtr); 682 683 typedef ClientData (MakeTagProc) _ANSI_ARGS_((Graph *graphPtr, char *tagName)); 684 extern MakeTagProc Blt_MakeElementTag; 685 extern MakeTagProc Blt_MakeMarkerTag; 686 extern MakeTagProc Blt_MakeAxisTag; 687 688 extern Blt_BindTagProc Blt_GraphTags; 689 extern Blt_BindTagProc Blt_AxisTags; 690 691 extern int Blt_GraphType _ANSI_ARGS_((Graph *graphPtr)); 692 693 /* ---------------------- Global declarations ------------------------ */ 694 695 extern Blt_Uid bltBarElementUid; 696 extern Blt_Uid bltLineElementUid; 697 extern Blt_Uid bltStripElementUid; 698 extern Blt_Uid bltLineMarkerUid; 699 extern Blt_Uid bltBitmapMarkerUid; 700 extern Blt_Uid bltImageMarkerUid; 701 extern Blt_Uid bltTextMarkerUid; 702 extern Blt_Uid bltPolygonMarkerUid; 703 extern Blt_Uid bltWindowMarkerUid; 704 extern Blt_Uid bltXAxisUid; 705 extern Blt_Uid bltYAxisUid; 706 707 #endif /* _BLT_GRAPH_H */ 708