home *** CD-ROM | disk | FTP | other *** search
- #ifndef GIMMELIB_GRAPH_H
- #define GIMMELIB_GRAPH_H
-
- #include "gimmelib/postext.h"
-
-
- typedef struct _gim_nax {
- SHORT origin, size; /* offset of origin and axis size in pixels */
- SHORT low; /* coord corresponding to origin */
- SHORT amt; /* modified by newgraph flags */
- SHORT initpt; /* coord of initial point (see newgraph flags) */
- SHORT step; /* step size for even labelling, 0 for fancy */
- SHORT labnum, labdenom; /* fraction for label scaling */
- } NEWAXIS;
-
- typedef struct _gim_axis {
- SHORT origin, size; /* offset of origin and axis size in pixels */
- SHORT low; /* coord corresponding to origin */
- SHORT high; /* coord corresponding to high end of axis */
- SHORT scale; /* scale of axis: -ve means coords per pixel */
- SHORT usesize; /* actual size of axis used in pixels */
- SHORT lastdata; /* last coord added to graph */
- SHORT lastoff; /* offset of last coord in pixels */
- SHORT step; /* step size for even labelling, 0 for fancy */
- SHORT labnum, labdenom; /* fraction for label scaling */
- SHORT flow, fhigh; /* first low and high - for graph reinit */
- SHORT fdata, foff; /* first coord and offset - for graph reinit */
- } AXIS;
-
- typedef struct _gim_newgr {
- UBYTE *title, *xtitle, *ytitle; /* graph and axes titles */
- struct TextAttr *titleta, *xta, *yta; /* text attributes for titles */
- BYTE FPen, BPen, AxesPen, TitlePen; /* colours for primary parts */
- ULONG flags, ctlflags; /* all-important flags */
- NEWAXIS X, Y; /* actual new-axis structs */
- struct RastPort *rp; /* RastPort to be copied, or NULL */
- } NEWGRAPH;
-
-
- /* flags for NEWGRAPH.flags (and GRAPH.flags) */
- #define GGR_DELTAX (1L << 0)
- #define GGR_LINETOX (1L << 1)
- #define GGR_FILLTOX (1L << 2)
- #define GGR_BLACKTOX (1L << 3)
- #define GGR_X_MAX (1L << 8) /* default */
- #define GGR_X_INTERVALS (1L << 9)
- #define GGR_X_SPACING (1L << 10) /* auto-spacing based on size */
- #define GGR_X_INTEGRAL (1L << 11)
- #define GGR_X_FLAGS 0x0000FFFFL
-
- #define GGR_DELTAY (1L << 16)
- #define GGR_LINETOY (1L << 17)
- #define GGR_FILLTOY (1L << 18)
- #define GGR_BLACKTOY (1L << 19)
- #define GGR_Y_MAX (1L << 24) /* default */
- #define GGR_Y_INTERVALS (1L << 25)
- #define GGR_Y_SPACING (1L << 26)
- #define GGR_Y_INTEGRAL (1L << 27)
- #define GGR_Y_FLAGS 0xFFFF0000L
-
- #define GGR_DEFAULT 0L
-
- /* control flags for NEWGRAPH.ctlflags (and GRAPH.ctlflags) */
- #define GGR_INITORIGIN (1L << 0)
- #define GGR_INITPOINT (1L << 1)
- #define GGR_NOCLEARSTART (1L << 8)
- #define GGR_NOCONNECTLINE (1L << 9)
- #define GGR_NOLABELS (1L << 10)
- #define GGR_CLEARONEND (1L << 15)
- #define GGR_HIRES (1L << 24)
- #define GGR_INTERLACE (1L << 25)
-
- #define GGR_CTL_DEFAULT 0L
-
- /* explanation of drawing flags:
- * DELTA: coord of new point is relative to coord of previous point
- * LINETO: draw a line from the point to the respective axis
- * FILLTO: area fill the trapezoid from previous point to resp. axis
- * BLACKTO: like LINETO but using background colour (useful with FILLTO)
-
- /* explanation of newaxis-specific flags:
- * MAX: newaxis.amt specifies max coord on initial graph
- * INTERVALS: newaxis.amt specifies difference between low and high coords
- * SPACING: newaxis.amt specifies the scale to be applied (+ve or -ve)
- * INTEGRAL: force integer number of pixels/coord or coords/pixel
-
- /* explanation of control flags:
- * INITORIGIN: use origin as initial point
- * INITPOINT: use point specified in nexaxes as initial point
- * (otherwise newaxis.initpt is ignored)
- * NOCLEARSTART: don't clear the rastport when initializing graph
- * (useful if several graphs on same "rastport")
- * NOLABELS: don't draw titles, axes and labels for me ever (I'll do it)
- * NOCONNECTLINE: don't connect points in graph by a line
- * CLEARONEND: clear the graph when doing getRidOfGraph
- * HIRES: graph to be displayed on HIRES screen
- * INTERLACE: graph to be displayed on INTERLACE screen
- * (these two are useful for determining aspect ratios)
-
-
- typedef struct _gim_graph {
- struct RastPort rp; /* actual RastPort struct */
- ULONG flags; /* flags, as in newgraph */
- ULONG ctlflags; /* control flags, as in newgraph */
- UBYTE *title, *xtitle, *ytitle; /* graph and axes titles */
- struct TextFont *titletf, *xtf, *ytf; /* fonts for titles */
- struct TextFont *xlabtf, *ylabtf; /* fonts for axes' labels */
- BYTE FPen, BPen, AxesPen, TitlePen; /* colours for primary parts */
- BYTE XlabPen, YlabPen, XtitlePen, YtitlePen; /* secondary colours */
- SHORT points; /* number of points added so far */
- AXIS X, Y; /* actual axis structs */
- void *memhead; /* memory-chain for this graph */
- struct _gim_graph *next; /* link to next graph (future use) */
- } GRAPH;
-
-
- /* INTERNAL scaling factor used by graph routines for intermediate results */
- #define SCALE 6
-
-
- /* flags for graphWriteLabel() */
- #define GWL_XAXIS (1L << 20) /* label the x-axis (don't set yaxis) */
- #define GWL_YAXIS (1L << 21) /* label the y-axis (don't set xaxis) */
- #define GWL_CLEAR_ONLY (1L << 22) /* clear the previous labels only! */
- #define GWL_CLEAR_OLD (1L << 23) /* clear previous then draw labels */
- #define GWL_RESERVED (0x000fffffL) /* reserved for internal use only!! */
- #define GWL_DEFAULT (AWL_YAXIS)
-
-
- #endif !GIMMELIB_GRAPH_H
-