// // graph.h - functons for graphing data // // Copyright (C) 2006 Nathan (Acorn) Pooley // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // version 2 as published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License (gpl.txt) for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // // You can contact the author, Nathan (Acorn) Pooley, by writing // to Nathan (Acorn) Pooley, 949 Buckeye Drive, Sunnyvale, CA 94086, USA // or through the form at http://www.rawbw.com/~acorn/wand/feedback.html // #ifndef GRAPH_H #define GRAPH_H //#@DOC@ generic graphing utility functions //########################################################################### //############################### NOTES ##################################### //########################################################################### // // H H OOO W W TTTTT OOO U U SSSS EEEE // H H O O W W W T O O U U S E // HHHHH O O W W W T O O U U SSS EEE // H H O O WWWWW T O O U U S E // H H OOO W W T OOO UUU SSSS EEEEE // // See 'main' function in graph.c - a complete example program. // //########################################################################### //############################### TYPEDEFS ################################## //########################################################################### typedef enum GWLineFlagsEnum { GW_LFLG_STEPY = 0x00000001, GW_LFLG_END } GWLineFlags; typedef struct GWindowRec GWindow; typedef struct GWinPickInfoRec { GWindow *gw; int line; int vert; float win_dist_squared; float win_x; float win_y; float old_pos; } GWinPickInfo; typedef struct GWinLineFuncInfoRec GWinLineFuncInfo; typedef void (*GWinLineFunc)(GWinLineFuncInfo *info); typedef void (*GWinCBFunc)(GWindow *gw, void *data); typedef enum GWinArgTypeEnum { GW_ARGTYPE_LAST, GW_ARGTYPE_VAR, GW_ARGTYPE_LINE, GW_ARGTYPE_END } GWinArgType; typedef struct GWinArgDescRec { GWinArgType type; char *name; float init; float min; float max; } GWinArgDesc; typedef struct GWinArgVarRec { GWinArgType type; float val; } GWinArgVar; typedef struct GWinArgLineRec { GWinArgType type; int line; int vertCnt; float *verts; } GWinArgLine; typedef union GWinArgRec { GWinArgType type; GWinArgVar v; GWinArgLine l; } GWinArg; struct GWinLineFuncInfoRec { GWindow *gw; int line; GWinLineFunc func; int argCnt; int vertCntMin; // smallest vertCnt in any line arg int vertCntMax; // largest vertCnt in any line arg GWinArg **args; }; //########################################################################### //############################### PROTOTYPES ################################ //########################################################################### GWindow *gwinCreate(void); void gwinDestroy(GWindow *gw); void gwinOpen(GWindow *gw); void gwinSetArgs(GWindow *gw, int argc,char *argv[]); void gwinSetName(GWindow *gw, const char *name); void gwinSetRange(GWindow *gw, float min, float max); void gwinSetDomain(GWindow *gw, float min, float max); void gwinDraw(GWindow *gw); int gwinLineCreate(GWindow *gw); void gwinLineHide(GWindow *gw, int line, int hidden); void gwinLineName(GWindow *gw, int line, const char *name); void gwinSetISize(GWindow *gw, int w, int h); void gwinLineStep(GWindow *gw, int line, int step); void gwinLineColor(GWindow *gw, int line, int color); void gwinLineScaleOffset( GWindow *gw, int line, float xscale, float yscale, float xoffset, float yoffset); void gwinLinePointFlags(GWindow *gw, int line, float x, float y, GWLineFlags flags); void gwinLinePoint(GWindow *gw, int line, float x, float y); int gwinFindLine(GWindow *gw, const char *name); void gwinLineFunc( GWindow *gw, int line, GWinLineFunc func, GWinArgDesc *args); float *gwinLineFuncVerts(GWinLineFuncInfo *info, int cnt); void gwinSetCallback(GWindow *gw, GWinCBFunc func, void *data); void gwinHandleEvents(GWindow *gw); void gwinEventLoop(GWindow *gw); #endif // GRAPH_H |
This file Copyright (C) 2006 by Nathan (Acorn) Pooley
Go to TOP Wand page
Go to Acorn's personal webpage
Go to Hogwarts website: www.gotohogwarts.com
Snout: www.snout.org/game
Gadgets of Justice Unlimited
Snout GC (Wiki)
Snout Wiki
File created by do_doc at Wed May 30 03:30:13 PDT 2007