diff --git a/books/bookvol8.pamphlet b/books/bookvol8.pamphlet index c42ff93..2b2d0ee 100644 --- a/books/bookvol8.pamphlet +++ b/books/bookvol8.pamphlet @@ -194,7 +194,36 @@ November 10, 2003 ((iHy)) \pagenumbering{arabic} \setcounter{chapter}{0} % Chapter 1 \chapter{Overview} -This book contains the hyperdoc routines for Axiom. +\label{Overview} +This book contains 5 programs, all related to the graphics subsystem. + +The primary 2D graphics routines live in the program ``view2d'' +(See Section \ref{view2d} on page~\pageref{view2d}). +The primary 3d graphics routines live in the program ``view3d'' +(See Section \ref{view3d} on page~\pageref{view3d}). +These two programs can be run under the control of sman using the +program ``viewman'' +(See Section \ref{viewman} on page~\pageref{viewman}). +They can also be run standalone using the program ``viewalone'' +(See Section \ref{viewalone} on page~\pageref{viewalone}). + + +\begin{itemize} +\item viewman/viewman.c.pamphlet -- int main (void) +\item viewalone/viewalone.c.pamphlet -- int main (int argc,char *argv[]) +\item view2d/main2d.c.pamphlet -- int main(void) +\item view3d/main3d.c.pamphlet -- int main(void) +\item view3d/testcol.c.pamphlet -- void main(void) +\end{itemize} + +The section ``gdraws'' +(see \ref{gdraws} on page~\pageref{gdraws}) +contains a set of functions for handling +postscript generation. This is handled by defining a set of cover +functions for the X routines, as in GDrawArc versus XDrawArc. +When the Xoption is set the X routine is called. When the PSoption +is set the postscript routines are generated. + \section{Environment Settings} \subsection{X11 .Xdefaults} \begin{itemize} @@ -804,229 +833,8 @@ x*x 0.479167 0.418403 0 2 0.5 0.5 0 2 @ -\chapter{The APIs} -\section{Graphics API} -\begin{itemize} -\item viewman/viewman.c.pamphlet -- int main (void) -\item viewalone/viewalone.c.pamphlet -- int main (int argc,char *argv[]) -\item view2d/main2d.c.pamphlet -- int main(void) -\item view3d/main3d.c.pamphlet -- int main(void) -\item view3d/testcol.c.pamphlet -- void main(void) -\item gdraws/main.c.pamphlet -- main(int argc, char **argv) -\end{itemize} -\section{X11 API calls} -\begin{itemize} -\item XSolidColor -\begin{itemize} -\item moColor to define the foreground color -\item moColor\_BG to define the background color -\end{itemize} -\item HashTable *XCreateAssocTable(int); -\item void XMakeAssoc(Display *,HashTable *,Window,int *); -\item int *XLookUpAssoc(Display *, HashTable *, Window); -\item void XDeleteAssoc(Display * , HashTable * , Window ); -\item XID x\_id; -- The X Window System id -\item XPoint * -\item XLoadQueryFont(dsply,xDefault) -\item XEvent -\item XClearArea(dsply,control->controlWindow,0,0,controlWidth,potA,False); -\item XWindowAttributes cwInfo; -\item XGetWindowAttributes(dsply,cp->controlWindow,\&cwInfo); -\item XFlush(dsply); -\item XQueryTree(dsply,tmpW,\&rootW,\&parentW,\&childrenWs,\&nChildren); -\item XFree(childrenWs); -\item XSetWindowAttributes cwAttrib, controlAttrib; -\item XSizeHints sizehints; -\item XColor foreColor, backColor; -\item XCreateBitmapFromData(dsply,rtWindow,mouseBitmap\_bits, - mouseBitmap\_width,mouseBitmap\_height); -\item XQueryColor(dsply,colorMap,\&foreColor); -\item XCreatePixmapCursor(dsply,mousebits,mousemask, - \&foreColor,\&backColor, - mouseBitmap\_x\_hot,mouseBitmap\_y\_hot); -\item XCreateWindow(dsply,rtWindow, - cXY.putX,cXY.putY,controlWidth,controlHeight,3, - CopyFromParent,InputOutput,CopyFromParent, - controlCreateMASK,\&cwAttrib); -\item XSetNormalHints(dsply,cw,\&sizehints); -\item XSetStandardProperties(dsply,cw,"2D Control Panel","2D Control Panel", - None,NULL,0,\&sizehints); -\item XMakeAssoc(dsply,table,(control->buttonQueue[i]).self, - \&((control->buttonQueue[i]).buttonKey)); -\item XMapWindow(dsply,(control->buttonQueue[i]).self); -\item XRaiseWindow(dsply,control->controlWindow); -\item XMoveWindow(dsply,control->controlWindow,whereControl.putX, - whereControl.putY); -\item XClearArea(dsply,viewport->controlPanel->controlWindow, - 0,controlMessageY-2,controlWidth,controlMessageHeight,False); -\item XFontStruct *globalFont,*buttonFont,*headerFont,*titleFont, -\item XrmDatabase rDB; -- X resource database -\item XrmValue value; -\item XGCValues gcVals; -\item (XArc *)malloc(xPointsNeeded * sizeof(XArc)) -\item XSetFont(dsply,gc,font->fid) -\item XOpenDisplay(getenv("DISPLAY")) -\item XCreateAssocTable(nbuckets); -\item XInitSpadFill(dsply,scrn,\&colorMap, - \&totalHues,\&totalSolidShades, - \&totalDitheredAndSolids,\&totalShades); -\item XQueryFont(dsply,XGContextFromGC(DefaultGC(dsply,scrn))); -\item XrmGetResource(rDB, - "Axiom.2D.messageFont", - "Axiom.2D.Font", - str\_type, \&value) == True) -\item XLoadQueryFont(dsply, prop) -\item XCreateGC(dsply,rtWindow,GCForeground | GCBackground , - \&controlGCVals); -\item XrmInitialize(); -\item XrmGetFileDatabase(name); -\item XrmMergeDatabases(applicationDB, \&rDB); -\item XResourceManagerString(dsply) -\item XrmGetStringDatabase(XResourceManagerString(dsply)); -\item XResourceManagerString(dsply) -\item XSync(dsply,False); -\item XUnmapWindow(dsply,control->controlWindow); -\item XWindowAttributes graphWindowAttrib; -\item Xcon = ConnectionNumber(dsply); -\item XEventsQueued(dsply, QueuedAlready) -\item XPending(dsply) -\item XNextEvent(dsply,event); -\item (XButtonEvent *)event -\item (XEvent *)event) -\item XCheckWindowEvent(dsply, - viewport->titleWindow, - ExposureMask, - \&tempEvent); -\item XGetWindowAttributes(dsply, - whichWindow, - \&graphWindowAttrib); -\item XResizeWindow(dsply, - viewport->viewWindow, - graphWindowAttrib.width, - graphWindowAttrib.height-titleHeight); -\item XMapWindow(dsply,whichWindow); -\item XCheckMaskEvent(dsply, - ButtonMotionMask, - event)); -\item (XButtonEvent *)event) -\item XFlush(dsply); -\item XUnmapWindow(dsply,control->controlWindow); -\item XLookUpAssoc(dsply,table,whichWindow)); -\item XMoveWindow(dsply,viewport->titleWindow,i1,i2); -\item XResizeWindow(dsply,viewport->titleWindow,i1,i2+titleHeight); -\item XFreeGC(dsply,globalGC1); -\item XFreeFont(dsply,globalFont); -\item XFreeColormap(dsply,colorMap); -\item XCloseDisplay(dsply); -\item XWindowAttributes attribInfo; -\item XClearWindow(dsply,viewport->titleWindow); -\item XCharStruct overall; -\item XTextExtents(unitFont,"o",1,\&dummyInt,\&ascent,\&descent,\&overall); -\item XSolidColor((int)(aPoint->hue),(int)(aPoint->shade)), -\item XTextWidth(unitFont,aunit,strlength)/2; -\item Xoption -\item XSizeHints titleSizeHints,viewSizeHints; -\item XSetWindowAttributes viewAttrib; -\item XColor foreColor, backColor; -\item XQueryColor(dsply,colorMap,\&foreColor); -\item XInternAtom(dsply, "WM\_DELETE\_WINDOW", False); -\item XSetWMProtocols(dsply, viewTitleWindow, \&wm\_delete\_window, 1); -\item XSetNormalHints(dsply,viewTitleWindow,\&titleSizeHints); -\item XSetStandardProperties(dsply,viewTitleWindow,"Axiom 2D",viewport->title, - None,NULL,0,\&titleSizeHints); -\item XWriteBitmapFile(dsply,viewBitmapFilename, - viewport->titleWindow,vwInfo.width, - vwInfo.height+vwInfo.border\_width+20,-1,-1); -\item XResizeWindow(dsply,viewport->titleWindow,300,300+titleHeight); -\item XDeleteAssoc(dsply,table,(control->buttonQueue[i]).self); -\item XDestroyWindow(dsply,control->controlWindow); -\item XCreateImage(/* display */ dsply, - /* visual */ DefaultVisual(dsply,scrn), - /* depth */ DefaultDepth(dsply,scrn), - /* format */ ZPixmap, - /* offset */ 0, - /* data */ NULL, - /* width */ vwInfo.width, - /* height */ 1, - /* bitmap\_pad */ 32, - /* bytes\_per\_line */ 0); -\item XImage slicer\_image\_stuff -\item XSizeHints sizehint; -\item XGetImage(dsply, slicer\_pixmap, 0, 0, slicer\_width, slicer\_height, - AllPlanes, ZPixmap); -\item XSetFunction(dsply, contourGC, GXcopy); -\item XDrawRectangle(dsply,contourWindow, contourGC /* ZZZ */, - (control->buttonQueue[i]).buttonX, - (control->buttonQueue[i]).buttonY, - (control->buttonQueue[i]).buttonWidth, - (control->buttonQueue[i]).buttonHeight); -\item XClearArea(dsply, contourWindow, long\_str\_X, long\_str\_Y - 12, - long\_W + 50, 18, False); -\item XDrawString(dsply, contourWindow, anotherGC, - long\_str\_X, long\_str\_Y, - stringo, strlen(stringo)); -\item XDrawArc(dsply, contourWindow, contourGC /* ZZZ */, - long\_corner\_X, long\_corner\_Y, - long\_W, long\_H, - 0, 360*64); -\item XDrawLine(dsply, contourWindow, -\item XFillArc(dsply, contourWindow, contourGC /* ZZZ */, - tip\_x - (dotSize>>1), tip\_y - (dotSize>>1), - dotSize, dotSize, - 0, 360*64); -\item XPutImage(dsply, contourWindow, contourGC, - slicer\_image, - 0, 0, - slicer\_image\_X, - slicer\_image\_Y, - slicer\_width, slicer\_height); -\item XSetLineAttributes(dsply, trashGC, 1, LineSolid, CapButt, JoinMiter); -\item XChangeShade(dsply, i); -\item XShadeRectangle(dsply,cp->controlWindow, - colormapX + colorOffsetX + i*shadeWidth, - colormapY + colorOffsetY - 10, shadeWidth, 40); -\item XFree(childrenWs); -\item XPoint *quadMesh; -\item XGetErrorText(display,event->error\_code,buffer,511); -\item XSetErrorHandler(the\_handler); -\item XCreateAssocTable(nbuckets); -\item XInitSpadFill(dsply,scrn,\&colorMap, - \&totalHues,\&totalSolidShades, - \&totalDitheredAndSolids,\&totalShades); -\item XInitShades(dsply,scrn) ; -\item XGContextFromGC(DefaultGC(dsply,scrn)) -\item XCreatePixmap(dsply,viewport->viewWindow, - vwInfo.width,vwInfo.height, - DisplayPlanes(dsply,scrn)); -\item .Xdefaults -\item XQueryPointer(dsply,rtWindow,\&dummy,\&dummy,\&px,\&py,\&lx,\&ly,\&lbuttons); -\item XPixelColor((int)colorindx-1) -\item XCreatePixmap(/* display */ dsply, - /* drawable */ viewport->viewWindow, - /* width */ vwInfo.width, - /* height */ vwInfo.height, - /* depth */ DefaultDepth(dsply,scrn)); -\item XFillRectangle(dsply,viewmap,trashGC,0,0,vwInfo.width,vwInfo.height); -\item XPutPixel(imageX,i,0,foregroundColor); -\item XPutImage(dsply,viewport->viewWindow,trashGC,imageX,0,0,0, - scanline,vwInfo.width,1); -\item XDestroyImage(imageX); -\item XCopyArea(dsply,viewmap,viewport->viewWindow,trashGC,0,0, - vwInfo.width,vwInfo.height,0,0); -\item XCopyArea(dsply,viewmap,viewport->viewWindow,trashGC,0,0, - vwInfo.width,vwInfo.height,0,0); -\item XFillPolygon(dsply, viewport->viewWindow, aGC, quadMesh, p->numpts, - Convex,CoordModeOrigin); -\item XPeekEvent(dsply,\&peekEvent); -\item XDrawLines(dsply, wid, gc, points, numberOfPoints, mode); -\item XGContextFromGC(viewGCx); -\item (impl) XCreateAssocTable(int size) -\item (impl) XMakeAssoc(Display * dsp, HashTable *table, Window w, int * p) -\item (impl) XLookUpAssoc(Display * dsp, HashTable *table,Window w) -\item (impl) XDeleteAssoc(Display * dsp,HashTable * table, Window w) -\item XSelectInput(dsply, menu, KeyPressMask|ButtonPressMask|ExposureMask); -\end{itemize} \chapter{include} +\label{include} \section{actions.h} <>= #define makeAViewport -1 @@ -1149,77 +957,6 @@ x*x #define modifyPOINT 114 /* for 3D */ #define hitherPlaneData 116 /* for 3D */ - - - -@ -\section{all-2d.h1} -<>= -/* declarations in view2d */ -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -@ -\section{all-3d.h1} -<>= -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -<> -@ -\section{all-alone.h1} -<>= -<> -<> -<> -@ -\section{buttons2d.h1} -<>= -extern int initButtons(buttonStruct * ); -@ -\section{buttons3d.h1} -<>= -extern int initButtons(buttonStruct * ); -@ -\section{cleanup.h1} -<>= -extern void brokenPipe(int sig); -extern void endChild(int sig); -extern void rmViewMgr(viewManager * slotPtr); -extern void closeChildViewport(viewManager * slotPtr); -extern void goodbye(int sig); -@ -\section{closeview3d.h1} -<>= -extern void closeViewport(void); @ \section{colors.h} This include file appears not to be used. @@ -1276,16 +1013,6 @@ However, the moColor macro IS used but not included. #define moColor(h,s) ((mono)?foregroundColor:XSolidColor(h,s)) #define moColor_BG(h,s) ((mono)?backgroundColor:XSolidColor(h,s)) @ -\section{component3d.h1} -<>= -extern void scaleComponents(void); -extern void makeTriangle(int , int , int ); -extern void triangulate(void); -extern void readComponentsFromViewman(void); -extern void calcNormData(void); -extern viewPoints * make3DComponents(void); -extern void draw3DComponents(int ); -@ \section{component.h} <>= /* @@ -1339,90 +1066,11 @@ typedef struct _LLLPoint { /* meaning list of list of list of points */ @ -\section{control2d.h1} -<>= -extern void writeControlTitle(void ); -extern void makeMessageFromData(int ); -extern void writeControlMessage(void ); -extern void drawControlPanel(void ); -extern controlXY getControlXY(int ); -extern controlPanelStruct * makeControlPanel(void ); -extern void putControlPanelSomewhere(int ); -extern void clearControlMessage(void ); -@ -\section{control3d.h1} -<>= -extern void drawColorMap(void); -extern void writeControlTitle(Window ); -extern void clearControlMessage(void); -extern void writeControlMessage(void); -extern void drawControlPanel(void); -extern controlXY getControlXY(int ); -extern controlPanelStruct * makeControlPanel(void); -extern void putControlPanelSomewhere(int ); -@ -\section{fun2d.h1} -<>= -extern void funView2D(int viewCommand); -extern void sendGraphToView2D(int i ,int there,viewManager * viewType, - graphStateStruct * doGraphStateArray); -extern void forkView2D(void); - -@ -\section{fun3d.h1} -<>= -extern void funView3D(int viewCommand); -extern void forkView3D(int typeOfViewport); -@ -\section{gfun.h1} -<>= -extern int PSCreateFile(int , Window , Window , char * ); -extern int Gdraws_drawFrame(int , Window , Window , char * ); -extern int Gdraws_setDimension(Window , Window ); -extern int GDrawImageString(GC , Window , int , int , char * , int , int ); -extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); -extern int GDrawLine(GC , Window , int , int , int , int , int ); -extern int GDrawLines(GC , Window , XPoint * , int , int , int ); -extern int GDrawPoint(Window , GC , int , int , int ); -extern int GDrawString(GC , Window , int , int , char * , int , int ); -extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); -extern int PSGlobalInit(void ); -extern int PSInit(Window , Window ); -extern int PSCreateContext(GC , char * , int , int , int , float , float ); -extern char * PSfindGC(GC ); -extern int GSetForeground(GC , float , int ); -extern int GSetBackground(GC , float , int ); -extern int GSetLineAttributes(GC , int , int , int , int , int ); -extern int PSClose(void ); -extern int centerX(GC , char * , int , int ); -extern int centerY(GC , int ); -extern int PSColorPolygon(float , float , float , XPoint * , int ); -extern int PSColorwOutline(float , float , float , XPoint * , int ); -extern int PSDrawColor(float , float , float , XPoint * , int ); -extern int PSFillPolygon(GC , XPoint * , int ); -extern int PSFillwOutline(GC , XPoint * , int ); -extern HashTable * XCreateAssocTable(int ); -extern void XMakeAssoc(Display * , HashTable * , Window , int * ); -extern int * XLookUpAssoc(Display * , HashTable * , Window ); -extern void XDeleteAssoc(Display * , HashTable * , Window ); -extern int GDrawRectangle(GC , Window , short , short , short , short , int ); -extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); -extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); -extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); -#ifdef _GFUN_C -static void filecopy(FILE * , FILE * ); -static int TrivEqual(Window , Window ); -static int TrivHash_code(Window , int ); -#endif -@ \section{g.h} <>= #ifndef _G_H_ #define _G_H_ 1 - - - #define Xoption 0 /* Gdraw routine option */ #define PSoption 1 /* Gdraw routine option */ @@ -1457,8 +1105,6 @@ static int TrivHash_code(Window , int ); #define psRoundCap 1 #define psPSqCap 2 - - /* * Structures */ @@ -1487,120 +1133,6 @@ extern GCptr GChead; /* Points to the head of GCstruct linked list. */ #endif @ -\section{graph2d.h1} -<>= -extern void getGraphFromViewman(int ); -extern void freeGraph(int ); -@ -\section{illuminate3d.h1} -<>= -extern float phong(triple , float [3]); -extern int hueValue(float ); -extern int getHue(float ); -extern float Value(float , float , float ); -extern RGB hlsTOrgb(float , float , float ); -@ -\section{light11.bitmap} -<>= -#define lightBitmap_width 16 -#define lightBitmap_height 16 -#define lightBitmap_x_hot 8 -#define lightBitmap_y_hot 0 -static char lightBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x10, 0x16, 0x10, 0x10, 0xd0, 0x10, 0x10, 0x24, 0x08, 0x42, 0x44, - 0x40, 0x84, 0x80, 0x02, 0x80, 0x02, 0x00, 0x01}; -@ -\section{light11.mask} -<>= -#define lightMask_width 16 -#define lightMask_height 16 -#define lightMask_x_hot 8 -#define lightMask_y_hot 0 -static char lightMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x11, 0x96, 0x12, 0x90, 0xd2, 0x90, 0x10, 0x24, 0x09, 0x42, 0x45, - 0x40, 0x85, 0x80, 0x03, 0x80, 0x02, 0x00, 0x01}; -@ -\section{lightbut3d.h1} -<>= -extern int initLightButtons(buttonStruct * ); -@ -\section{lighting3d.h1} -<>= -extern int makeLightingPanel(void); -extern void drawLightingAxes(void); -extern void drawLightTransArrow(void); -extern void drawLightingPanel(void); - -@ -\section{main2d.h1} -<>= -extern int main(void); -extern void mergeDatabases(void); - -@ -\section{main3d.h1} -<>= -extern int main(void); -extern void mergeDatabases(void); -@ -\section{make2d.h1} -<>= -extern void makeView2DFromSpadData(view2DStruct * viewdata , - graphStateStruct graphState[]); - -@ -\section{make3d.h1} -<>= -extern void makeView3DFromSpadData(view3DStruct * viewdata, - int typeOfViewport); - -@ -\section{makegraph.h1} -<>= -extern graphStruct * makeGraphFromSpadData(void); -extern void discardGraph(graphStruct * theGraph); -@ -\section{mesh3d.h1} -<>= -extern void getMeshNormal(float, float, float, float, float, float, - float, float, float, float, float, float [3]); -extern void normalizeVector(float * ); -extern float dotProduct(float * , float * , int ); - -@ -\section{mode.h} -<>= -#define spadActionMode -/* define spadEventMode */ -#define components -@ -\section{mouse11.bitmap} -<>= -#define mouseBitmap_width 16 -#define mouseBitmap_height 16 -#define mouseBitmap_x_hot 8 -#define mouseBitmap_y_hot 0 -static char mouseBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, - 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\section{mouse11.mask} -<>= -#define mouseMask_width 16 -#define mouseMask_height 16 -static char mouseMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, - 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\section{msort3d.h1} -<>= -extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); -extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); -@ \section{nox10.h} <>= #ifndef _X10_H_ @@ -1671,55 +1203,6 @@ typedef struct _XAssocTable { title bars. */ @ -\section{pot2d.h1} -<>= -extern mouseCoord getPotValue(short , short , short , short ); -@ -\section{pot3d.h1} -<>= -extern mouseCoord getPotValue(short , short , short , short ); -extern mouseCoord getLinearPotValue(short , short , short , short ); -@ -\section{process2d.h1} -<>= -extern void doPick(int , int ); -extern void doDrop(int , int ); -extern void clickedOnGraph(int , int ); -extern void buttonAction(int ); -extern void processEvents(void); -extern void clickedOnGraphSelect(int , int ); -#ifdef _PROCESS2D_C -static void drawControlPushButton(int , int ); -#endif -@ -\section{process3d.h1} -<>= -extern void buttonAction(int ); -extern void processEvents(void); -@ -\section{project3d.h1} -<>= -extern void project(viewTriple * , XPoint * , int ); -extern void projectAPoint(viewTriple * ); -extern void projectAllPoints(void); -extern void projectAllPolys(poly * ); -extern void projectAPoly(poly * ); -extern void projectStuff(float, float, float, int *, int *, float *); - -@ -\section{quit3d.h1} -<>= -extern int makeQuitPanel(void); -extern void drawQuitPanel(void); -@ -\section{quitbut3d.h1} -<>= -extern int initQuitButtons(buttonStruct * ); -@ -\section{readview.h1} -<>= -extern int readViewport(viewManager * viewPort , void * info , int size); -@ \section{rgb.h} <>= typedef struct _RGB { @@ -1735,81 +1218,8 @@ typedef struct _HLS { } HLS ; @ -\section{save3d.h1} -<>= -extern int makeSavePanel(void); -extern void drawSavePanel(void); -@ -\section{savebut3d.h1} -<>= -extern int initSaveButtons(buttonStruct * ); -@ -\section{smoothshade3d.h1} -<>= -extern char get_cBuffer_axes(int ); -extern void put_cBuffer_axes(int , char ); -extern int get_cBuffer_indx(int ); -extern void put_cBuffer_indx(int , int ); -extern void put_zBuffer(int , float ); -extern float get_zBuffer(int ); -extern void put_imageX(int , char ); -extern void drawPhongSpan(triple , float [3] , int ); -extern void scanPhong(int ); -extern void boxTObuffer(void ); -extern void clipboxTObuffer(void ); -extern void axesTObuffer(void ); -extern void scanLines(int ); -extern void freePolyList(void ); -extern void showAxesLabels(int ); -extern void changeColorMap(void ); -extern void drawPhong(int ); -@ -\section{spadaction2d.h1} -<>= -extern int readViewman(void * , int ); -extern int spadAction(void); -@ -\section{spadaction3d.h1} -<>= -extern int readViewman(void * , int ); -extern void scalePoint(viewTriple * ); -extern int spadAction(void); -@ -\section{spadbitmap.bitmap} -<>= -#define spadBitmap_width 34 -#define spadBitmap_height 20 -#define spadBitmap_x_hot 15 -#define spadBitmap_y_hot 10 -static char spadBitmap_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0xe6, 0xf8, 0x76, 0x00, 0x84, 0x98, 0x44, 0x49, 0x00, 0xc0, 0x98, 0x42, - 0x49, 0x00, 0xb8, 0x98, 0x42, 0x49, 0x00, 0x84, 0x95, 0x42, 0x49, 0x00, - 0x44, 0xa5, 0x22, 0x49, 0x00, 0x78, 0x63, 0x1d, 0xdb, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, - 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; -@ -\section{spadmask.mask} -<>= -#define spadMask_width 34 -#define spadMask_height 20 -#define spadMask_x_hot 15 -#define spadMask_y_hot 10 -static char spadMask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x01, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x01, 0xfe, - 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, - 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0x01, - 0xfe, 0xff, 0xff, 0xff, 0x01, 0xfe, 0xff, 0xff, 0xff, 0x01, 0xfc, 0xff, - 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; -@ \section{spadcolors.h} +This seems unused. <>= #include #define numOfColors 240 @@ -1843,63 +1253,6 @@ extern int scrn; <> @ -\section{spoon2d.h1} -<>= -extern void spoonView2D(void); -extern void makeView2DFromFileData(view2DStruct * ); -extern void sendGraphToView2D(int , int , viewManager * ); -@ -\section{spooncomp.h1} -<>= -extern void spoonView3D(int ); -extern void makeView3DFromFileData(int ); -@ -\section{sselect.h1} -<>= -extern int -superSelect(int n , int * rd , int * wr , int * ex , char * timeout); - -@ -\section{stuff2d.h1} -<>= -extern float absolute(float); -extern void goodbye(int); -@ -\section{stuff3d.h1} -<>= -extern viewTriple * traverse(int ); -extern float absolute(float ); -extern float get_random(void ); -extern triple norm_dist(void ); -extern void goodbye(int); -@ -\section{surface3d.h1} -<>= -extern void drawLineComponent(poly * , int ); -extern void drawOpaquePolygon(poly * , GC , GC , int ); -extern poly * copyPolygons(poly * ); -extern void minMaxPolygons(poly * ); -extern int polyCompare(poly * , poly * ); -extern void calcEyePoint(void ); -extern void drawRenderedPolygon(poly * , int ); -extern void freePointResevoir(void); -extern void freeListOfPolygons(poly * ); -extern void drawPolygons(int ); -extern int lessThan(float , float ); -extern int greaterThan(float , float ); -extern int isNaN(float ); -extern int isNaNPoint(float , float , float ); -extern int equal(float , float ); -@ -\section{transform3d.h1} -<>= -extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); -extern void vectorMatrix4(float [4] , float [4][4] , float [4]); -extern void ROTATE(float [4][4]); -extern void ROTATE1(float [4][4]); -extern void SCALE(float , float , float , float [4][4]); -extern void TRANSLATE(float , float , float , float [4][4]); -@ \section{tube.h} <>= #define openTube 1 @@ -2121,10 +1474,6 @@ typedef struct _boxSideStruct { } boxSideStruct; @ -\section{viewalone.h1} -<>= -extern int main(int , char * []); -@ \section{viewcommand.h} <>= /* Commands that the viewports could send to the viewport manager */ @@ -2191,43 +1540,6 @@ exitWithAck(RootWindow(dsply,scrn),Window,-1); \ } @ -\section{viewport2d.h1} -<>= -extern void writeTitle(void); -extern void drawTheViewport(int ); -extern viewPoints * makeViewport(char * , int , int , int , int , int ); -extern viewPoints * makeView2D(view2DStruct * ); -@ -\section{viewport3d.h1} -<>= -extern void writeTitle(void); -extern void drawPreViewport(int ); -extern void drawTheViewport(int ); -extern int keepDrawingViewport(void); -extern viewPoints * makeViewport(void); -extern void postMakeViewport(void); -@ -\section{volume3d.h1} -<>= -extern int initVolumeButtons(buttonStruct * ); -extern void makeVolumePanel(void ); -extern void drawClipXBut(void ); -extern void drawClipYBut(void ); -extern void drawClipZBut(void ); -extern void drawClipVolume(void ); -extern void drawHitherControl(void ); -extern void drawEyeControl(void ); -extern void drawFrustrum(void ); -extern void drawVolumePanel(void ); -@ -\section{write2d.h1} -<>= -extern int writeViewport(int ); -@ -\section{write3d.h1} -<>= -extern int writeViewport(int ); -@ \section{write.h} <>= /* These are types of files that the viewports would @@ -2308,273 +1620,7 @@ extern int writeViewport(int ); #endif @ -\section{include/bitmaps} -\subsection{include/bitmaps/hand.bitmap} -<>= -#define hand_width 16 -#define hand_height 16 -#define hand_x_hot 5 -#define hand_y_hot 1 -static char hand_bits[] = { - 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x10, 0x01, 0x10, 0x07, 0x10, 0x09, - 0x0c, 0x39, 0x1a, 0x51, 0x32, 0x50, 0x22, 0x40, 0x22, 0x40, 0x04, 0x60, - 0x04, 0x30, 0xf8, 0x1f, 0x04, 0x20, 0xf8, 0x1f}; -@ -\subsection{include/bitmaps/light11.bitmap} -<>= -#define lightBitmap_width 16 -#define lightBitmap_height 16 -#define lightBitmap_x_hot 8 -#define lightBitmap_y_hot 0 -static char lightBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x10, 0x16, 0x10, 0x10, 0xd0, 0x10, 0x10, 0x24, 0x08, 0x42, 0x44, - 0x40, 0x84, 0x80, 0x02, 0x80, 0x02, 0x00, 0x01}; -@ -\subsection{include/bitmaps/light11.mask} -<>= -#define lightMask_width 16 -#define lightMask_height 16 -#define lightMask_x_hot 8 -#define lightMask_y_hot 0 -static char lightMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x11, 0x96, 0x12, 0x90, 0xd2, 0x90, 0x10, 0x24, 0x09, 0x42, 0x45, - 0x40, 0x85, 0x80, 0x03, 0x80, 0x02, 0x00, 0x01}; -@ -\subsection{include/bitmaps/mouse11.bitmap} -<>= -#define mouseBitmap_width 16 -#define mouseBitmap_height 16 -#define mouseBitmap_x_hot 8 -#define mouseBitmap_y_hot 0 -static char mouseBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, - 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\subsection{include/bitmaps/mouse11.mask} -<>= -#define mouseMask_width 16 -#define mouseMask_height 16 -static char mouseMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, - 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\subsection{include/bitmaps/spad11.bitmap} -<>= -#define spadBitmap_width 30 -#define spadBitmap_height 16 -static char spadBitmap_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x00, 0x00, - 0x12, 0x70, 0x00, 0x00, 0x12, 0x20, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0xa8, 0x39, 0xb7, 0x1d, 0x24, 0xa6, 0x59, 0x12, - 0x34, 0xa6, 0x4e, 0x12, 0x2c, 0xa6, 0x48, 0x12, 0x46, 0xa5, 0x48, 0x12, - 0x42, 0xa9, 0x48, 0x12, 0xc1, 0x58, 0x67, 0x36, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; -@ -\subsection{include/bitmaps/spad11.mask} -<>= -#define spad11_width 30 -#define spad11_height 16 -#define spad11_x_hot -1 -#define spad11_y_hot -1 -static char spad11_bits[] = { - 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x39, 0xb6, 0x1d, - 0x32, 0x26, 0x49, 0x12, 0x21, 0xa6, 0x50, 0x12, 0x21, 0xa6, 0x50, 0x12, - 0x61, 0xa5, 0x50, 0x12, 0x51, 0x29, 0x49, 0x12, 0xde, 0x58, 0x6e, 0x36, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, - 0x00, 0x20, 0x00, 0x00}; -@ -\subsection{include/bitmaps/volume2.bitmap} -<>= -#define volumeBitmap_width 16 -#define volumeBitmap_height 16 -#define volumeBitmap_x_hot 8 -#define volumeBitmap_y_hot 0 -static char volumeBitmap_bits[] = { - 0x00, 0x01, 0xc0, 0x03, 0x30, 0x0e, 0x0c, 0x18, 0x64, 0x36, 0x44, 0x62, - 0x14, 0x48, 0x74, 0x4e, 0xcc, 0x43, 0x18, 0x70, 0x30, 0x1c, 0xe0, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -@ -\subsection{include/bitmaps/volume2.mask} -<>= -#define volumeMask_width 16 -#define volumeMask_height 16 -#define volumeMask_x_hot 8 -#define volumeMask_y_hot 0 -static char volumeMask_bits[] = { - 0x00, 0x01, 0xc0, 0x03, 0x30, 0x0e, 0x0c, 0x18, 0x64, 0x36, 0x44, 0x62, - 0x14, 0x48, 0x74, 0x4e, 0xcc, 0x43, 0x18, 0x70, 0x30, 0x1c, 0xe0, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -@ -\subsection{include/bitmaps/volume.bitmap} -<>= -#define volumeBitmap_width 16 -#define volumeBitmap_height 16 -#define volumeBitmap_x_hot 5 -#define volumeBitmap_y_hot 1 -static char volumeBitmap_bits[] = { - 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x10, 0x01, 0x10, 0x07, 0x10, 0x09, - 0x0c, 0x39, 0x1a, 0x51, 0x32, 0x50, 0x22, 0x40, 0x22, 0x40, 0x04, 0x60, - 0x04, 0x30, 0xf8, 0x1f, 0x04, 0x20, 0xf8, 0x1f}; -@ -\subsection{bitmaps/volume.mask} -<>= -#define volumeMask_width 16 -#define volumeMask_height 16 -#define volumeMask_x_hot 5 -#define volumeMask_y_hot 1 -static char volumeMask_bits[] = { - 0x00, 0x00, 0x60, 0x00, 0xf0, 0x00, 0xf0, 0x01, 0xf0, 0x07, 0xf0, 0x0f, - 0xfc, 0x3f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, - 0xfc, 0x3f, 0xf8, 0x1f, 0x04, 0x20, 0xf8, 0x1f}; -@ \section{include/purty} -\subsection{include/purty/hand.bitmap} -<>= -#define hand_width 16 -#define hand_height 16 -#define hand_x_hot 5 -#define hand_y_hot 1 -static char hand_bits[] = { - 0x00, 0x00, 0x60, 0x00, 0x90, 0x00, 0x10, 0x01, 0x10, 0x07, 0x10, 0x09, - 0x0c, 0x39, 0x1a, 0x51, 0x32, 0x50, 0x22, 0x40, 0x22, 0x40, 0x04, 0x60, - 0x04, 0x30, 0xf8, 0x1f, 0x04, 0x20, 0xf8, 0x1f}; -@ -\subsection{include/purty/light11.bitmap} -<>= -#define lightBitmap_width 16 -#define lightBitmap_height 16 -#define lightBitmap_x_hot 8 -#define lightBitmap_y_hot 0 -static char lightBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x10, 0x16, 0x10, 0x10, 0xd0, 0x10, 0x10, 0x24, 0x08, 0x42, 0x44, - 0x40, 0x84, 0x80, 0x02, 0x80, 0x02, 0x00, 0x01}; -@ -\subsection{include/purty/light11.mask} -<>= -#define lightMask_width 16 -#define lightMask_height 16 -#define lightMask_x_hot 8 -#define lightMask_y_hot 0 -static char lightMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, - 0x10, 0x11, 0x96, 0x12, 0x90, 0xd2, 0x90, 0x10, 0x24, 0x09, 0x42, 0x45, - 0x40, 0x85, 0x80, 0x03, 0x80, 0x02, 0x00, 0x01}; -@ -\subsection{include/purty/mouse11.bitmap} -<>= -#define mouseBitmap_width 16 -#define mouseBitmap_height 16 -#define mouseBitmap_x_hot 8 -#define mouseBitmap_y_hot 0 -static char mouseBitmap_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, - 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\subsection{include/purty/mouse11.mask} -<>= -#define mouseMask_width 16 -#define mouseMask_height 16 -static char mouseMask_bits[] = { - 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, - 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, - 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; -@ -\subsection{include/purty/slicer.bitmap} -<>= -#define slicer_width 50 -#define haha_X -#ifdef haha -#define slicer_height 120 -#else -#define slicer_height 100 -#endif -static char slicer_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0x3f, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - -#ifdef haha - , - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -#endif -}; -@ \subsection{include/purty/spadbitmap.bitmap} <>= #define spadBitmap_width 34 @@ -2609,28 +1655,6 @@ static char spadMask_bits[] = { 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; @ -\subsection{include/purty/volume2.bitmap} -<>= -#define volumeBitmap_width 16 -#define volumeBitmap_height 16 -#define volumeBitmap_x_hot 8 -#define volumeBitmap_y_hot 0 -static char volumeBitmap_bits[] = { - 0x00, 0x01, 0xc0, 0x03, 0x30, 0x0e, 0x0c, 0x18, 0x64, 0x36, 0x44, 0x62, - 0x14, 0x48, 0x74, 0x4e, 0xcc, 0x43, 0x18, 0x70, 0x30, 0x1c, 0xe0, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -@ -\subsection{include/purty/volume2.mask} -<>= -#define volumeMask_width 16 -#define volumeMask_height 16 -#define volumeMask_x_hot 8 -#define volumeMask_y_hot 0 -static char volumeMask_bits[] = { - 0x00, 0x01, 0xc0, 0x03, 0x30, 0x0e, 0x0c, 0x18, 0x64, 0x36, 0x44, 0x62, - 0x14, 0x48, 0x74, 0x4e, 0xcc, 0x43, 0x18, 0x70, 0x30, 0x1c, 0xe0, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -@ \subsection{include/purty/volume.bitmap} <>= #define volumeBitmap_width 16 @@ -2655,6 +1679,7 @@ static char volumeMask_bits[] = { @ \chapter{viewman} +\label{viewman} \subsection{cleanup.c} <>= #define _CLEANUP_C @@ -2673,9 +1698,15 @@ static char volumeMask_bits[] = { <> #include "util.h1" -<> -<> -<> +extern void brokenPipe(int sig); +extern void endChild(int sig); +extern void rmViewMgr(viewManager * slotPtr); +extern void closeChildViewport(viewManager * slotPtr); +extern void goodbye(int sig); + +extern graphStruct * makeGraphFromSpadData(void); +extern void discardGraph(graphStruct * theGraph); +extern int readViewport(viewManager * viewPort , void * info , int size); void brokenPipe(int sig) @@ -2847,9 +1878,13 @@ goodbye(int sig) #include "util.h1" #include "sockio-c.h1" -<> -<> -<> +extern void funView2D(int viewCommand); +extern void sendGraphToView2D(int i ,int there,viewManager * viewType, + graphStateStruct * doGraphStateArray); +extern void forkView2D(void); +extern int readViewport(viewManager * viewPort , void * info , int size); +extern void makeView2DFromSpadData(view2DStruct * viewdata , + graphStateStruct graphState[]); #define writeEach @@ -3185,14 +2220,18 @@ sendGraphToView2D(int i,int there,viewManager *viewport, #include <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components <> #include "util.h1" #include "sockio-c.h1" -<> -<> -<> +extern void funView3D(int viewCommand); +extern void forkView3D(int typeOfViewport); +extern void makeView3DFromSpadData(view3DStruct * viewdata, + int typeOfViewport); +extern int readViewport(viewManager * viewPort , void * info , int size); void funView3D(int viewCommand) @@ -3537,7 +2576,8 @@ extern char propertyBuffer[]; <> #include "sockio-c.h1" -<> +extern void makeView2DFromSpadData(view2DStruct * viewdata , + graphStateStruct graphState[]); void makeView2DFromSpadData(view2DStruct *viewdata,graphStateStruct graphState[]) @@ -3583,10 +2623,13 @@ makeView2DFromSpadData(view2DStruct *viewdata,graphStateStruct graphState[]) #include <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "sockio-c.h1" -<> +extern void makeView3DFromSpadData(view3DStruct * viewdata, + int typeOfViewport); void makeView3DFromSpadData(view3DStruct *viewdata,int typeOfViewport) @@ -3819,7 +2862,8 @@ ${MIDOBJ}/readview.o: ${SRC}/include/com.h ${MIDINT}/readview.c <> #include "sockio-c.h1" -<> +extern graphStruct * makeGraphFromSpadData(void); +extern void discardGraph(graphStruct * theGraph); graphStruct * makeGraphFromSpadData(void) @@ -3922,7 +2966,12 @@ discardGraph (graphStruct *theGraph) <> -<> +extern void brokenPipe(int sig); +extern void endChild(int sig); +extern void rmViewMgr(viewManager * slotPtr); +extern void closeChildViewport(viewManager * slotPtr); +extern void goodbye(int sig); + int readViewport (viewManager *viewPort,void *info,int size) @@ -3952,8 +3001,14 @@ again: #include "sockio-c.h1" #include "bsdsignal.h1" -<> -<> +extern void brokenPipe(int sig); +extern void endChild(int sig); +extern void rmViewMgr(viewManager * slotPtr); +extern void closeChildViewport(viewManager * slotPtr); +extern void goodbye(int sig); + +extern int +superSelect(int n , int * rd , int * wr , int * ex , char * timeout); /******************************************* * int superSelect(n, rd, wr, ex, timeout) * @@ -4016,7 +3071,9 @@ superSelect(int n, int *rd, int *wr, int *ex, char *timeout) #endif <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components <> <> #include "bsdsignal.h" @@ -4025,12 +3082,23 @@ superSelect(int n, int *rd, int *wr, int *ex, char *timeout) #include "bsdsignal.h1" #include "util.h1" #include "sockio-c.h1" -<> -<> -<> -<> -<> -<> +extern void funView2D(int viewCommand); +extern void sendGraphToView2D(int i ,int there,viewManager * viewType, + graphStateStruct * doGraphStateArray); +extern void forkView2D(void); +extern void funView3D(int viewCommand); +extern void forkView3D(int typeOfViewport); +extern graphStruct * makeGraphFromSpadData(void); +extern void discardGraph(graphStruct * theGraph); +extern int readViewport(viewManager * viewPort , void * info , int size); +extern void brokenPipe(int sig); +extern void endChild(int sig); +extern void rmViewMgr(viewManager * slotPtr); +extern void closeChildViewport(viewManager * slotPtr); +extern void goodbye(int sig); + +extern int +superSelect(int n , int * rd , int * wr , int * ex , char * timeout); /************* global variables **************/ @@ -4239,6 +3307,7 @@ main (void) <> @ \chapter{viewalone} +\label{viewalone} The TESTFILE is created in the mnt directory to provide an example file to use for viewalone. The parabola example is detailed in the chapter on Graphics File Formats. The directory parabola.view will @@ -4303,7 +3372,13 @@ ${TESTFILE}: ${BOOK} #include "util.h1" -<> +extern void spoonView2D(void); +extern void makeView2DFromFileData(view2DStruct * ); +extern void sendGraphToView2D(int , int , viewManager * ); +extern void spoonView3D(int ); +extern void makeView3DFromFileData(int ); +extern int main(int , char * []); + /* #define huhDEBUG */ @@ -4628,10 +3703,18 @@ makeView2DFromFileData(view2DStruct *doView2D) #include <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "util.h1" -<> +extern void spoonView2D(void); +extern void makeView2DFromFileData(view2DStruct * ); +extern void sendGraphToView2D(int , int , viewManager * ); +extern void spoonView3D(int ); +extern void makeView3DFromFileData(int ); +extern int main(int , char * []); + @@ -4865,7 +3948,13 @@ makeView3DFromFileData(int type) #include <> -<> +extern void spoonView2D(void); +extern void makeView2DFromFileData(view2DStruct * ); +extern void sendGraphToView2D(int , int , viewManager * ); +extern void spoonView3D(int ); +extern void makeView3DFromFileData(int ); +extern int main(int , char * []); + /************* global variables **************/ @@ -4976,6 +4065,326 @@ extern char pathname[256]; @ \chapter{view2d} +\label{view2d} +\section{main function} +The main function performs the following steps +\begin{enumerate} +\item calls XOpenDisplay +(See \ref{XOpenDisplay} on page~\pageref{XOpenDisplay}), +using the DISPLAY variable from the environment, to choose the display. +\item uses the DefaultScreen macro +(See \ref{DefaultScreen} on page~\pageref{DefaultScreen}), to get the +user's default screen. +\item uses the RootWindow macro +(See \ref{RootWindow} on page~\pageref{RootWindow}), to get the +root window on the user's display and screen. +\item calls XCreateAssocTable to create an association table with +{\tt nbuckets} which is elsewhere defined to be 128. Note that we +do not actually use the X10 definition of this function but use our +own version. See \ref{XCreateAssocTable} on page~\pageref{XCreateAssocTable}. +This table is used to hold an association between the control panel buttons +and the window they control. +\end{enumerate} +<>= +int main(void) +{ + XGCValues controlGCVals; + int i,code; + view2DStruct viewData; + char property[256]; + char *prop = &property[0]; + char *str_type[20]; + XrmValue value; + if ((dsply = XOpenDisplay(getenv("DISPLAY"))) == NULL) + fprintf(stderr,"Could not open the display.\n"); + scrn = DefaultScreen(dsply); + rtWindow = RootWindow(dsply,scrn); + + /**** link Xwindows to viewports - X10 feature ****/ + table = XCreateAssocTable(nbuckets); + + /**** Create Axiom color map ****/ + totalColors = XInitSpadFill(dsply,scrn,&colorMap, + &totalHues,&totalSolidShades, + &totalDitheredAndSolids,&totalShades); + + if (totalColors < 0) { + fprintf(stderr,">>Error: Could not allocate all the necessary colors.\n"); + exitWithAck(RootWindow(dsply,scrn),Window,-1); + } + + mergeDatabases(); + + + /*** Determine whether monochrome or color is used ***/ + if (XrmGetResource(rDB,"Axiom.2D.monochrome","",str_type,&value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop, "off"); + + mono = ((totalSolid == 2) || (strcmp(prop,"on") == 0)); + + if (XrmGetResource(rDB,"Axiom.2D.inverse","",str_type,&value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop, "off"); + + if (mono) + if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ + foregroundColor = WhitePixel(dsply,scrn); + backgroundColor = BlackPixel(dsply,scrn); + } else { /* off (no inverse video) */ + foregroundColor = BlackPixel(dsply,scrn); + backgroundColor = WhitePixel(dsply,scrn); + } + else /* inverse of inverse in color (for some strange reason) */ + if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ + foregroundColor = WhitePixel(dsply,scrn); + backgroundColor = BlackPixel(dsply,scrn); + } else { /* off (no inverse video) */ + foregroundColor = BlackPixel(dsply,scrn); + backgroundColor = WhitePixel(dsply,scrn); + } + + + /* read default file name for postScript output */ + if (XrmGetResource(rDB, + "Axiom.2D.postscriptFile", + "", + str_type, &value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop, "axiom2d.ps"); + + PSfilename = (char *)malloc(strlen(prop)+1); + strcpy(PSfilename,prop); + + + + /**** Open global fonts ****/ + serverFont = XQueryFont(dsply,XGContextFromGC(DefaultGC(dsply,scrn))); + + if (XrmGetResource(rDB, + "Axiom.2D.messageFont", + "Axiom.2D.Font", + str_type, &value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,messageFontDefault); + if ((globalFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for messageFont\n",prop); + globalFont = serverFont; + } + + if (XrmGetResource(rDB, + "Axiom.2D.buttonFont", + "Axiom.2D.Font", + str_type, &value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,buttonFontDefault); + if ((buttonFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for buttonFont\n",prop); + buttonFont = serverFont; + } + + if (XrmGetResource(rDB, + "Axiom.2D.headerFont", + "Axiom.2D.Font", + str_type, &value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,headerFontDefault); + + if ((headerFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for headerFont\n",prop); + headerFont = serverFont; + } + + if (XrmGetResource(rDB, + "Axiom.2D.titleFont", + "Axiom.2D.Font", + str_type,&value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,titleFontDefault); + + if ((titleFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for titleFont\n",prop); + titleFont = serverFont; + } + + if (XrmGetResource(rDB, + "Axiom.2D.graphFont", + "Axiom.2D.Font", + str_type,&value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,graphFontDefault); + + if ((graphFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for graphFont\n",prop); + graphFont = serverFont; + } + + if (XrmGetResource(rDB, + "Axiom.2D.unitFont", + "Axiom.2D.Font", + str_type,&value) == True) + (void) strncpy(prop,value.addr,(int)value.size); + else + (void) strcpy(prop,unitFontDefault); + + if ((unitFont = XLoadQueryFont(dsply, prop)) == NULL) { + fprintf(stderr, + "Warning: could not get the %s font for unitFont\n",prop); + unitFont = serverFont; + } + + + /**** Create widely used Graphic Contexts ****/ + PSGlobalInit(); + /* must initiate before using any G/PS functions + need character name: used as postscript GC variable + need to create ps GCs for all GCs used by drawings in viewWindow */ + + /* globalGC1 */ + + controlGCVals.foreground = monoColor(axesColorDefault); + controlGCVals.background = backgroundColor; + globalGC1 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground , + &controlGCVals); + carefullySetFont(globalGC1,globalFont); + + + /* create the equivalent GCs for ps */ + PSCreateContext(globalGC1, "globalGC1", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* controlMessageGC */ + + controlGCVals.foreground = controlMessageColor; + controlMessageGC = XCreateGC(dsply,rtWindow,GCForeground | GCBackground + ,&controlGCVals); + carefullySetFont(controlMessageGC,globalFont); + + /* globalGC2 */ + + controlGCVals.foreground = monoColor(labelColor); + controlGCVals.background = backgroundColor; + globalGC2 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground, + &controlGCVals); + carefullySetFont(globalGC2,buttonFont); + PSCreateContext(globalGC2, "globalGC2", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* trashGC */ + + trashGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); + carefullySetFont(trashGC,buttonFont); + PSCreateContext(trashGC, "trashGC", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* globGC */ + + globGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); + carefullySetFont(globGC,headerFont); + PSCreateContext(globGC, "globGC", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* anotherGC */ + + controlGCVals.line_width = colorWidth; + anotherGC = XCreateGC(dsply,rtWindow,GCBackground,&controlGCVals); + carefullySetFont(anotherGC,titleFont); + PSCreateContext(anotherGC, "anotherGC", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* processGC */ + + gcVals.background = backgroundColor; + processGC = XCreateGC(dsply,rtWindow,GCBackground ,&gcVals); + carefullySetFont(processGC,buttonFont); + + /* graphGC */ + + graphGC = XCreateGC(dsply,rtWindow,GCBackground,&gcVals); + carefullySetFont(graphGC,graphFont); + PSCreateContext(graphGC, "graphGC", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /* unitGC */ + + unitGC = XCreateGC(dsply,rtWindow,GCBackground ,&gcVals); + carefullySetFont(unitGC,unitFont); + PSCreateContext(unitGC, "unitGC", psNormalWidth, psButtCap, + psMiterJoin, psWhite, psBlack); + + /**** Initialize Graph States ****/ + + for (i=0; icontrolPanel; + + bsdSignal(SIGTERM,goodbye,DontRestartSystemCalls); + + /* send acknowledgement to viewport manager */ + i = 345; + check(write(Socket,&(viewport->viewWindow),sizeof(Window))); + + processEvents(); + + goodbye(-1); + return(0); /* control never reaches here but compiler complains */ +} /* main() */ + +@ + \section{buttons2d.c} <>= #define _BUTTONS2D_C @@ -4983,7 +4392,39 @@ extern char pathname[256]; #include <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + @@ -5668,14 +5109,95 @@ initButtons (buttonStruct *buttons) #include <> -<> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" #include "util.h1" -<> -<> +#define mouseBitmap_width 16 +#define mouseBitmap_height 16 +#define mouseBitmap_x_hot 8 +#define mouseBitmap_y_hot 0 +static char mouseBitmap_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, + 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, + 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; +#define mouseMask_width 16 +#define mouseMask_height 16 +static char mouseMask_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, + 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, + 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; /* Defines the pixmap for the arrow displayed in the scale window */ @@ -6276,7 +5798,39 @@ extern Atom wm_delete_window; <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + #include "util.h1" @@ -6656,8 +6210,77 @@ typedef struct _xPointStruct { #include "bsdsignal.h" <> #include "bsdsignal.h1" -<> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "util.h1" #include "xspadfill.h1" @@ -6759,308 +6382,7 @@ GCptr GChead=NULL; /* ptr to head of ps GC linked list */ char *PSfilename, /* output file name used in user directory */ *envAXIOM; /* used as ps file pathnames */ -int -main(void) -{ - - XGCValues controlGCVals; - int i,code; - view2DStruct viewData; - - char property[256]; - char *prop = &property[0]; - char *str_type[20]; - XrmValue value; - - - /**** Set up display ****/ - if ((dsply = XOpenDisplay(getenv("DISPLAY"))) == NULL) - fprintf(stderr,"Could not open the display.\n"); - scrn = DefaultScreen(dsply); - rtWindow = RootWindow(dsply,scrn); - - /**** link Xwindows to viewports - X10 feature ****/ - table = XCreateAssocTable(nbuckets); - - /**** Create Axiom color map ****/ - totalColors = XInitSpadFill(dsply,scrn,&colorMap, - &totalHues,&totalSolidShades, - &totalDitheredAndSolids,&totalShades); - - if (totalColors < 0) { - fprintf(stderr,">>Error: Could not allocate all the necessary colors.\n"); - exitWithAck(RootWindow(dsply,scrn),Window,-1); - } - - mergeDatabases(); - - - /*** Determine whether monochrome or color is used ***/ - if (XrmGetResource(rDB,"Axiom.2D.monochrome","",str_type,&value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop, "off"); - - mono = ((totalSolid == 2) || (strcmp(prop,"on") == 0)); - - if (XrmGetResource(rDB,"Axiom.2D.inverse","",str_type,&value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop, "off"); - - if (mono) - if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ - foregroundColor = WhitePixel(dsply,scrn); - backgroundColor = BlackPixel(dsply,scrn); - } else { /* off (no inverse video) */ - foregroundColor = BlackPixel(dsply,scrn); - backgroundColor = WhitePixel(dsply,scrn); - } - else /* inverse of inverse in color (for some strange reason) */ - if (strcmp(prop,"on") == 0) { /* 0 if equal (inverse video) */ - foregroundColor = WhitePixel(dsply,scrn); - backgroundColor = BlackPixel(dsply,scrn); - } else { /* off (no inverse video) */ - foregroundColor = BlackPixel(dsply,scrn); - backgroundColor = WhitePixel(dsply,scrn); - } - - - /* read default file name for postScript output */ - if (XrmGetResource(rDB, - "Axiom.2D.postscriptFile", - "", - str_type, &value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop, "axiom2d.ps"); - - PSfilename = (char *)malloc(strlen(prop)+1); - strcpy(PSfilename,prop); - - - - /**** Open global fonts ****/ - serverFont = XQueryFont(dsply,XGContextFromGC(DefaultGC(dsply,scrn))); - - if (XrmGetResource(rDB, - "Axiom.2D.messageFont", - "Axiom.2D.Font", - str_type, &value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,messageFontDefault); - if ((globalFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for messageFont\n",prop); - globalFont = serverFont; - } - - if (XrmGetResource(rDB, - "Axiom.2D.buttonFont", - "Axiom.2D.Font", - str_type, &value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,buttonFontDefault); - if ((buttonFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for buttonFont\n",prop); - buttonFont = serverFont; - } - - if (XrmGetResource(rDB, - "Axiom.2D.headerFont", - "Axiom.2D.Font", - str_type, &value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,headerFontDefault); - - if ((headerFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for headerFont\n",prop); - headerFont = serverFont; - } - - if (XrmGetResource(rDB, - "Axiom.2D.titleFont", - "Axiom.2D.Font", - str_type,&value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,titleFontDefault); - - if ((titleFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for titleFont\n",prop); - titleFont = serverFont; - } - - if (XrmGetResource(rDB, - "Axiom.2D.graphFont", - "Axiom.2D.Font", - str_type,&value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,graphFontDefault); - - if ((graphFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for graphFont\n",prop); - graphFont = serverFont; - } - - if (XrmGetResource(rDB, - "Axiom.2D.unitFont", - "Axiom.2D.Font", - str_type,&value) == True) - (void) strncpy(prop,value.addr,(int)value.size); - else - (void) strcpy(prop,unitFontDefault); - - if ((unitFont = XLoadQueryFont(dsply, prop)) == NULL) { - fprintf(stderr, - "Warning: could not get the %s font for unitFont\n",prop); - unitFont = serverFont; - } - - - /**** Create widely used Graphic Contexts ****/ - PSGlobalInit(); - /* must initiate before using any G/PS functions - need character name: used as postscript GC variable - need to create ps GCs for all GCs used by drawings in viewWindow */ - - /* globalGC1 */ - - controlGCVals.foreground = monoColor(axesColorDefault); - controlGCVals.background = backgroundColor; - globalGC1 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground , - &controlGCVals); - carefullySetFont(globalGC1,globalFont); - - - /* create the equivalent GCs for ps */ - PSCreateContext(globalGC1, "globalGC1", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* controlMessageGC */ - - controlGCVals.foreground = controlMessageColor; - controlMessageGC = XCreateGC(dsply,rtWindow,GCForeground | GCBackground - ,&controlGCVals); - carefullySetFont(controlMessageGC,globalFont); - - /* globalGC2 */ - - controlGCVals.foreground = monoColor(labelColor); - controlGCVals.background = backgroundColor; - globalGC2 = XCreateGC(dsply,rtWindow,GCForeground | GCBackground, - &controlGCVals); - carefullySetFont(globalGC2,buttonFont); - PSCreateContext(globalGC2, "globalGC2", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* trashGC */ - - trashGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); - carefullySetFont(trashGC,buttonFont); - PSCreateContext(trashGC, "trashGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* globGC */ - - globGC = XCreateGC(dsply,rtWindow,0,&controlGCVals); - carefullySetFont(globGC,headerFont); - PSCreateContext(globGC, "globGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* anotherGC */ - - controlGCVals.line_width = colorWidth; - anotherGC = XCreateGC(dsply,rtWindow,GCBackground,&controlGCVals); - carefullySetFont(anotherGC,titleFont); - PSCreateContext(anotherGC, "anotherGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* processGC */ - - gcVals.background = backgroundColor; - processGC = XCreateGC(dsply,rtWindow,GCBackground ,&gcVals); - carefullySetFont(processGC,buttonFont); - - /* graphGC */ - - graphGC = XCreateGC(dsply,rtWindow,GCBackground,&gcVals); - carefullySetFont(graphGC,graphFont); - PSCreateContext(graphGC, "graphGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /* unitGC */ - - unitGC = XCreateGC(dsply,rtWindow,GCBackground ,&gcVals); - carefullySetFont(unitGC,unitFont); - PSCreateContext(unitGC, "unitGC", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - - /**** Initialize Graph States ****/ - - for (i=0; icontrolPanel; - - bsdSignal(SIGTERM,goodbye,DontRestartSystemCalls); - - /* send acknowledgement to viewport manager */ - i = 345; - check(write(Socket,&(viewport->viewWindow),sizeof(Window))); - - processEvents(); - - goodbye(-1); - return(0); /* control never reaches here but compiler complains */ -} /* main() */ +<> void mergeDatabases(void) @@ -7200,7 +6522,39 @@ ${MIDOBJ}/write2d.o: ${BOOK} <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + mouseCoord getPotValue(short eX,short eY,short xH,short yH) @@ -7235,9 +6589,78 @@ getPotValue(short eX,short eY,short xH,short yH) <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" @@ -8099,7 +7522,39 @@ clickedOnGraph (int i,int bKey) <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + #include "util.h1" @@ -8354,8 +7809,77 @@ spadAction(void) <> -<> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "util.h1" @@ -8446,8 +7970,77 @@ goodbye(int sig) <> -<> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "util.h1" #include "xspadfill.h1" @@ -9097,9 +8690,78 @@ makeView2D(view2DStruct *viewdata) <> <> -<> +extern int initButtons(buttonStruct * ); +extern void writeControlTitle(void ); +extern void makeMessageFromData(int ); +extern void writeControlMessage(void ); +extern void drawControlPanel(void ); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void ); +extern void putControlPanelSomewhere(int ); +extern void clearControlMessage(void ); +extern void getGraphFromViewman(int ); +extern void freeGraph(int ); +extern int main(void); +extern void mergeDatabases(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern void doPick(int , int ); +extern void doDrop(int , int ); +extern void clickedOnGraph(int , int ); +extern void buttonAction(int ); +extern void processEvents(void); +extern void clickedOnGraphSelect(int , int ); +#ifdef _PROCESS2D_C +static void drawControlPushButton(int , int ); +#endif +extern int readViewman(void * , int ); +extern int spadAction(void); +extern float absolute(float); +extern void goodbye(int); +extern void writeTitle(void); +extern void drawTheViewport(int ); +extern viewPoints * makeViewport(char * , int , int , int , int , int ); +extern viewPoints * makeView2D(view2DStruct * ); +extern int writeViewport(int ); + #include "pixmap.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #define numBits (8*sizeof(int)) @@ -9255,6 +8917,7 @@ writeViewport(int thingsToWrite) } @ \chapter{view3d} +\label{view3d} \section{buttons3d.c} <>= #define _BUTTONS3D_C @@ -9262,7 +8925,122 @@ writeViewport(int thingsToWrite) <> <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define BH 31 /* button window height */ #define PH 80 /* potentiometer window height */ #define XEDGE 5 /* leftmost button starts here */ @@ -9654,8 +9432,160 @@ initButtons (buttonStruct *buttons) <> #include "util.h1" -<> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + @@ -9711,11 +9641,163 @@ closeViewport (void) <> <> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "util.h1" #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define axisLength 1.0 /* use 100.0, if data is not to be normalized */ @@ -11385,7 +11467,92 @@ typedef struct _segment_list_struct { <> <> <> -<> +#define slicer_width 50 +#define haha_X +#ifdef haha +#define slicer_height 120 +#else +#define slicer_height 100 +#endif +static char slicer_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, + 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xff, 0xff, 0x3f, 0x00, 0x00 ,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + +#ifdef haha + , + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +#endif +}; #define use_fat @@ -12149,8 +12316,20 @@ update_contour_latitude(void) #include #include -<> -<> +#define mouseBitmap_width 16 +#define mouseBitmap_height 16 +#define mouseBitmap_x_hot 8 +#define mouseBitmap_y_hot 0 +static char mouseBitmap_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x80, 0x02, 0x40, 0x04, 0xc0, 0x06, 0x20, 0x08, + 0x20, 0x08, 0x30, 0x18, 0x50, 0x14, 0x58, 0x34, 0x90, 0x12, 0x20, 0x08, + 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; +#define mouseMask_width 16 +#define mouseMask_height 16 +static char mouseMask_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x80, 0x03, 0xc0, 0x07, 0xc0, 0x07, 0xe0, 0x0f, + 0xe0, 0x0f, 0xf0, 0x1f, 0xf0, 0x1f, 0xf8, 0x3f, 0xf0, 0x1f, 0xe0, 0x0f, + 0xc0, 0x47, 0x00, 0x21, 0x80, 0x10, 0x00, 0x0f}; <> <> @@ -12158,8 +12337,160 @@ update_contour_latitude(void) #include "util.h1" #include "xshade.h1" #include "xspadfill.h1" -<> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /* Defines the pixmap for the arrow displayed in the scale window */ #define zoomArrowN 11 @@ -13419,18 +13750,12 @@ extern Atom wm_delete_window; \section{header.h} <>= #define view3D - - #include #include #include #include - #include "hash.h" - <> - - <> <> <> @@ -13769,7 +14094,122 @@ typedef struct _controlXY { <> <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /*********************** * void phong(pt,N) * @@ -13923,7 +14363,122 @@ hlsTOrgb(float h,float l,float s) <> <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /***************************************************** * int initLightButtons (lightButtons) * * * @@ -14037,8 +14592,22 @@ initLightButtons (buttonStruct *lightButtons) #include #include -<> -<> +#define lightBitmap_width 16 +#define lightBitmap_height 16 +#define lightBitmap_x_hot 8 +#define lightBitmap_y_hot 0 +static char lightBitmap_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, + 0x10, 0x10, 0x16, 0x10, 0x10, 0xd0, 0x10, 0x10, 0x24, 0x08, 0x42, 0x44, + 0x40, 0x84, 0x80, 0x02, 0x80, 0x02, 0x00, 0x01}; +#define lightMask_width 16 +#define lightMask_height 16 +#define lightMask_x_hot 8 +#define lightMask_y_hot 0 +static char lightMask_bits[] = { + 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x04, 0x40, 0xc8, 0x27, 0x20, 0x08, + 0x10, 0x11, 0x96, 0x12, 0x90, 0xd2, 0x90, 0x10, 0x24, 0x09, 0x42, 0x45, + 0x40, 0x85, 0x80, 0x03, 0x80, 0x02, 0x00, 0x01}; <> @@ -14047,9 +14616,161 @@ initLightButtons (buttonStruct *lightButtons) <> <> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define lightMASK ExposureMask #define lightCursorForeground lightingTitleColor @@ -14144,20 +14865,6 @@ makeLightingPanel(void) /*** draw lighting buttons ***/ initLightButtons(control->buttonQueue); -/* - controlAttrib.event_mask = (control->buttonQueue[lightingButtonsStart]).mask; - (control->buttonQueue[lightingButtonsStart]).self = - XCreateWindow(dsply, lightingWindow, - (control->buttonQueue[lightingButtonsStart]).buttonX, - (control->buttonQueue[lightingButtonsStart]).buttonY, - (control->buttonQueue[lightingButtonsStart]).buttonWidth, - (control->buttonQueue[lightingButtonsStart]).buttonHeight, - 0,0,InputOnly,CopyFromParent, - buttonCreateMASK,&controlAttrib); - XMakeAssoc(dsply,table,(control->buttonQueue[lightingButtonsStart]).self, - &((control->buttonQueue[lightingButtonsStart]).buttonKey)); - XMapWindow(dsply,(control->buttonQueue[lightingButtonsStart]).self); -*/ for (i=(lightingButtonsStart + 1); i<(lightingButtonsEnd); i++) { controlAttrib.event_mask = (control->buttonQueue[i]).mask; (control->buttonQueue[i]).self = @@ -14604,10 +15311,162 @@ drawLightingPanel(void) #include "bsdsignal.h1" #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" #include "xshade.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /**********************/ /** global variables **/ @@ -15385,7 +16244,122 @@ ${MIDOBJ}/write3d.o: ${BOOK} #include <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /*************************************************************************** *** void getMeshNormal(x0,y0,z0,x1,y1,z1,x2,y2,z2,zMin,zRange,Normal); *** @@ -15515,7 +16489,122 @@ dotProduct(float * a,float *b,int size) <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define linkThing poly @@ -15602,7 +16691,122 @@ msort(linkThing *p,int min,int max,int (*compare)(linkThing *, linkThing *)) #define _POT3D_C <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /****************************/ /*** void getPotValue() ***/ @@ -15666,18 +16870,172 @@ getLinearPotValue(short eX,short eY,short xH,short yH) <> <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components <> <> #include "com.h" #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "pixmap.h1" #include "xshade.h1" #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define inside(A,B) (((XButtonEvent *)event)->x >= A && \ ((XButtonEvent *)event)->x <= B) @@ -17230,9 +18588,126 @@ processEvents(void) <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components + +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); -<> /******************************************* * void project(aViewTriple,someXpoints,i) * @@ -17594,9 +19069,161 @@ projectStuff(float x,float y,float z,int *px,int *py,float *Pz) <> #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define quitMASK ExposureMask #define quitCursorForeground monoColor(55) @@ -17720,7 +19347,122 @@ drawQuitPanel(void) <> <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + @@ -17775,9 +19517,161 @@ initQuitButtons (buttonStruct *quitButtons) <> <> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define saveMASK ExposureMask #define saveCursorForeground monoColor(55) @@ -17896,7 +19790,122 @@ drawSavePanel(void) <> <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + int initSaveButtons (buttonStruct *saveButtons) { @@ -17960,13 +19969,167 @@ initSaveButtons (buttonStruct *saveButtons) <> <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "spadcolors.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "util.h1" #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define SAFE_VALUE 892347 @@ -18951,7 +21114,122 @@ drawPhong(int dFlag) <> #include "util.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + int readViewman (void *info,int size) @@ -19343,11 +21621,163 @@ static float labels[basicScreen][7] = { -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif /*#include "spadcolors.h"*/ #include "util.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); + +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /***************************** *** traverse(n) *** *** returns the nth point *** @@ -19465,14 +21895,167 @@ goodbye(int sig) <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "com.h" #include "xspadfill.h1" #include "xshade.h1" #include "util.h1" -<> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + /**** useful defines ****/ @@ -20211,10 +22794,161 @@ equal (float x,float y) #include "bsdsignal.h1" #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" #include "xshade.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + <> <> @@ -20765,7 +23499,121 @@ main(void) <> -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + void matrixMultiply4x4(float xxA[4][4],float xxB[4][4],float array[4][4]) @@ -20877,12 +23725,165 @@ TRANSLATE(float x,float y,float z,float xxT[4][4]) <> <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "util.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif #include "xspadfill.h1" -<> +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define axesOffset 5 @@ -21731,8 +24732,159 @@ keepDrawingViewport(void) #include "xspadfill.h1" -<> -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); + #define eyeDistMessX (frusX(eyeWinX+27)) #define eyeDistMessY (frusY(eyeWinY-5)) @@ -22667,14 +25819,167 @@ drawVolumePanel (void) <> <> -<> +#define spadActionMode +/* define spadEventMode */ +#define components #include "pixmap.h1" #include "xshade.h1" -<> +extern int PSCreateFile(int , Window , Window , char * ); +extern int GdrawsDrawFrame(int , Window , Window , char * ); +extern int GdrawsSetDimension(Window , Window ); +extern int GDrawImageString(GC , Window , int , int , char * , int , int ); +extern int GDrawArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int GDrawLine(GC , Window , int , int , int , int , int ); +extern int GDrawLines(GC , Window , XPoint * , int , int , int ); +extern int GDrawPoint(Window , GC , int , int , int ); +extern int GDrawString(GC , Window , int , int , char * , int , int ); +extern int GFillArc(GC , Window , int , int , unsigned int , unsigned int , int , int , int ); +extern int PSGlobalInit(void ); +extern int PSInit(Window , Window ); +extern int PSCreateContext(GC , char * , int , int , int , float , float ); +extern char * PSfindGC(GC ); +extern int GSetForeground(GC , float , int ); +extern int GSetBackground(GC , float , int ); +extern int GSetLineAttributes(GC , int , int , int , int , int ); +extern int PSClose(void ); +extern int centerX(GC , char * , int , int ); +extern int centerY(GC , int ); +extern int PSColorPolygon(float , float , float , XPoint * , int ); +extern int PSColorwOutline(float , float , float , XPoint * , int ); +extern int PSDrawColor(float , float , float , XPoint * , int ); +extern int PSFillPolygon(GC , XPoint * , int ); +extern int PSFillwOutline(GC , XPoint * , int ); +extern HashTable * XCreateAssocTable(int ); +extern void XMakeAssoc(Display * , HashTable * , Window , int * ); +extern int * XLookUpAssoc(Display * , HashTable * , Window ); +extern void XDeleteAssoc(Display * , HashTable * , Window ); +extern int GDrawRectangle(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonOut(GC , Window , short , short , short , short , int ); +extern int GDraw3DButtonIn(GC , Window , short , short , short , short , int ); +extern int GDrawPushButton(Display * , GC , GC , GC , Window , short , short , short , short , int , char * , unsigned long , unsigned long , int ); +#ifdef _GFUN_C +static void filecopy(FILE * , FILE * ); +static int TrivEqual(Window , Window ); +static int TrivHashCode(Window , int ); +#endif + +extern viewTriple * traverse(int ); +extern float absolute(float ); +extern float get_random(void ); +extern triple norm_dist(void ); +extern void goodbye(int); +extern int initButtons(buttonStruct * ); +extern int writeViewport(int ); +extern int initVolumeButtons(buttonStruct * ); +extern void makeVolumePanel(void ); +extern void drawClipXBut(void ); +extern void drawClipYBut(void ); +extern void drawClipZBut(void ); +extern void drawClipVolume(void ); +extern void drawHitherControl(void ); +extern void drawEyeControl(void ); +extern void drawFrustrum(void ); +extern void drawVolumePanel(void ); +extern void drawColorMap(void); +extern void writeControlTitle(Window ); +extern void clearControlMessage(void); +extern void writeControlMessage(void); +extern void drawControlPanel(void); +extern controlXY getControlXY(int ); +extern controlPanelStruct * makeControlPanel(void); +extern void putControlPanelSomewhere(int ); +extern void matrixMultiply4x4(float [4][4] , float [4][4] , float [4][4]); +extern void vectorMatrix4(float [4] , float [4][4] , float [4]); +extern void ROTATE(float [4][4]); +extern void ROTATE1(float [4][4]); +extern void SCALE(float , float , float , float [4][4]); +extern void TRANSLATE(float , float , float , float [4][4]); +extern void closeViewport(void); +extern float phong(triple , float [3]); +extern int hueValue(float ); +extern int getHue(float ); +extern float Value(float , float , float ); +extern RGB hlsTOrgb(float , float , float ); +extern poly * merge(poly * , poly * , int (*)(poly * , poly * )); +extern poly * msort(poly * , int , int , int (*)(poly * , poly * )); +extern void drawLineComponent(poly * , int ); +extern void drawOpaquePolygon(poly * , GC , GC , int ); +extern poly * copyPolygons(poly * ); +extern void minMaxPolygons(poly * ); +extern int polyCompare(poly * , poly * ); +extern void calcEyePoint(void ); +extern void drawRenderedPolygon(poly * , int ); +extern void freePointResevoir(void); +extern void freeListOfPolygons(poly * ); +extern void drawPolygons(int ); +extern int lessThan(float , float ); +extern int greaterThan(float , float ); +extern int isNaN(float ); +extern int isNaNPoint(float , float , float ); +extern int equal(float , float ); +extern void getMeshNormal(float, float, float, float, float, float, + float, float, float, float, float, float [3]); +extern void normalizeVector(float * ); +extern float dotProduct(float * , float * , int ); +extern void project(viewTriple * , XPoint * , int ); +extern void projectAPoint(viewTriple * ); +extern void projectAllPoints(void); +extern void projectAllPolys(poly * ); +extern void projectAPoly(poly * ); +extern void projectStuff(float, float, float, int *, int *, float *); +extern int makeLightingPanel(void); +extern void drawLightingAxes(void); +extern void drawLightTransArrow(void); +extern void drawLightingPanel(void); +extern int initLightButtons(buttonStruct * ); +extern int readViewman(void * , int ); +extern void scalePoint(viewTriple * ); +extern int spadAction(void); +extern void writeTitle(void); +extern void drawPreViewport(int ); +extern void drawTheViewport(int ); +extern int keepDrawingViewport(void); +extern viewPoints * makeViewport(void); +extern void postMakeViewport(void); +extern mouseCoord getPotValue(short , short , short , short ); +extern mouseCoord getLinearPotValue(short , short , short , short ); +extern void buttonAction(int ); +extern void processEvents(void); +extern int initQuitButtons(buttonStruct * ); +extern int makeQuitPanel(void); +extern void drawQuitPanel(void); +extern void scaleComponents(void); +extern void makeTriangle(int , int , int ); +extern void triangulate(void); +extern void readComponentsFromViewman(void); +extern void calcNormData(void); +extern viewPoints * make3DComponents(void); +extern void draw3DComponents(int ); +extern char get_cBuffer_axes(int ); +extern void put_cBuffer_axes(int , char ); +extern int get_cBuffer_indx(int ); +extern void put_cBuffer_indx(int , int ); +extern void put_zBuffer(int , float ); +extern float get_zBuffer(int ); +extern void put_imageX(int , char ); +extern void drawPhongSpan(triple , float [3] , int ); +extern void scanPhong(int ); +extern void boxTObuffer(void ); +extern void clipboxTObuffer(void ); +extern void axesTObuffer(void ); +extern void scanLines(int ); +extern void freePolyList(void ); +extern void showAxesLabels(int ); +extern void changeColorMap(void ); +extern void drawPhong(int ); +extern int initSaveButtons(buttonStruct * ); +extern int makeSavePanel(void); +extern void drawSavePanel(void); +extern int main(void); +extern void mergeDatabases(void); -<> /* upper limit as to how many kinds of files could be written (numBits-1) */ #define numBits (8*sizeof(int)) @@ -22836,8 +26141,15 @@ writeViewport (int thingsToWrite) } @ \chapter{gdraws} -This directory consists of all the Gdraw functions along with a local -testing protocol to test out these functions. +\label{gdraws} + +Thi section contains a set of functions for handling +postscript generation. This is handled by defining a set of cover +functions for the X routines, as in GDrawArc versus XDrawArc. +When the Xoption is set the X routine is called. When the PSoption +is set the postscript routines are generated. + +This directory consists of all the Gdraw functions. The subdirectory PS contains all the ps drawing functions in support of the Gdraw functions. @@ -22948,229 +26260,29 @@ font can be set in user program. Right now, it uses only 1 font. units on the axes. \end{itemize} -\section{data.c} -<>= -/* Data file to test out Gdraw functions */ - -<> -<> -<> - -extern GC gc, gc1; - -int -Gdraws_data(int dFlag) -{ - static Vertex vlist[5]; - static int vcount = 5; - static int x0, y0, x1, y1; - static char *str = "This is a text string."; - static int x, y; - static int FirstTime = yes; - static int Rx, Ry, Rwidth, Rheight; - static int Ix, Iy; - static char *Istr = "Image text string."; - static XPoint points[7]; - static XPoint p1[7]; - static int np1 = 7; - static int npoints, mode; - static int ax, ay, angle1, angle2; - static unsigned int awidth, aheight; - static Vertex dfvlist[7]; - static int dfvcount = 7; - static XPoint dfvl1[7]; - static int dfvc = 7; - - if (FirstTime) { - - vlist[0].x = 10; - vlist[0].y = 10; - vlist[0].flags = 0; - - vlist[1].x = 250; - vlist[1].y = 10; - vlist[1].flags = 0; - - vlist[2].x = 250; - vlist[2].y = 140; - vlist[2].flags = 0; - - vlist[3].x = 10; - vlist[3].y = 140; - vlist[3].flags = 0; - - vlist[4].x = 10; - vlist[4].y = 10; - vlist[4].flags = 0; - - x0 = y0 = 12; - x1 = 248; - y1 = 138; - - x = 25; - y = 50; - - Ix = 20; - Iy = 180; - - Rx = 160; - Ry = 40; - Rwidth = 30; - Rheight = 80; - - points[0].x = 80; - points[0].y = 95; - points[1].x = 30; - points[1].y = 15; - points[2].x = 120; - points[2].y = 70; - points[3].x = 25; - points[3].y = 180; - points[4].x = 43; - points[4].y = 56; - points[5].x = 270; - points[6].y = 0; - points[6].x = 0; - points[5].y = 160; - - p1[0].x = 2; - p1[0].y = 155; - p1[1].x = 99; - p1[1].y = 39; - p1[2].x = 260; - p1[2].y = 75; - p1[3].x = 33; - p1[3].y = 170; - p1[4].x = 4; - p1[4].y = 111; - p1[5].x = 203; - p1[6].y = 33; - p1[6].x = 170; - p1[5].y = 200; - - npoints = 7; - mode = CoordModeOrigin; /* there's also CoordModePrevious */ - - ax = 130; - ay = 100; - awidth = 165; - aheight = 95; - angle1 = 165; - angle2 = -330; - - dfvlist[0].x = 300; - dfvlist[0].y = 0; - dfvlist[0].flags = 0; - - dfvlist[1].x = 200; - dfvlist[1].y = 0; - dfvlist[1].flags = 0; - - dfvlist[2].x = 200; - dfvlist[2].y = 100; - dfvlist[2].flags = 0; - - dfvlist[3].x = 100; - dfvlist[3].y = 100; - dfvlist[3].flags = 0; - - dfvlist[4].x = 100; - dfvlist[4].y = 200; - dfvlist[4].flags = 0; - - dfvlist[5].x = 0; - dfvlist[5].y = 200; - dfvlist[5].flags = 0; - - dfvlist[6].x = 300; - dfvlist[6].y = 0; - dfvlist[6].flags = 0; - - dfvl1[0].x = 0; - dfvl1[0].y = 300; - dfvl1[1].x = 0; - dfvl1[1].y = 200; - dfvl1[2].x = 100; - dfvl1[2].y = 200; - dfvl1[3].x = 100; - dfvl1[3].y = 100; - dfvl1[4].x = 200; - dfvl1[4].y = 100; - dfvl1[5].x = 200; - dfvl1[5].y = 0; - dfvl1[6].x = 0; - dfvl1[6].y = 300; - - FirstTime = no; - } - - if (dFlag == PS) { - GSetForeground(gc1, 0.3125, PS); - if (PSFillwOutline(gc1, dfvl1, dfvc) == psError) - return (psError); - } - - if (GDrawString(gc, viewport->viewWindow, x, y, str, strlen(str), dFlag) - == psError) - return (psError); - - - if (GDrawLine(gc, viewport->viewWindow, x0, y0, x1, y1, dFlag) == psError) - return (psError); - - if (GDrawRectangle(gc, viewport->viewWindow, Rx, Ry, Rwidth, Rheight, dFlag) - == psError) - return (psError); - - if (GDrawLines(gc, viewport->viewWindow, points, npoints, mode, dFlag) - == psError) - return (psError); - - if (GDrawArc(gc, viewport->viewWindow, ax, ay, awidth, aheight, angle1 * 64, - angle2 * 64, dFlag) == psError) - return (psError); - - GSetForeground(gc1, (float) psBlack, dFlag); - GSetBackground(gc1, (float) psWhite, dFlag); - if (GFillArc(gc1, viewport->viewWindow, 20, ay - 20, awidth / 2, aheight / 2, - angle1 * 64, angle2 * 64, dFlag) == psError) - return (psError); - - - GSetForeground(gc1, (float) psWhite, dFlag); - GSetBackground(gc1, (float) psBlack, dFlag); - if (GDrawImageString(gc1, viewport->viewWindow, Ix, Iy, - Istr, strlen(Istr), dFlag) == psError) - return (psError); - - if (dFlag == PS) { - GSetForeground(gc1, 0.8, dFlag); - PSFillPolygon(gc1, p1, np1); - PSColorPolygon(0.2, 0.4, 0.8, p1, np1); - } - - return (1); -} @ -\section{gdraws0.h} -<>= -#ifndef _GDRAWS0_H_ -#define _GDRAWS0_H_ 1 +\section{gfun.c} +<>= +#define _GFUN_C -#include +#include +#include +#include +#include +#include #define yes 1 #define no 0 -/* - * Indices for PostScript draw procedures. - * - * The order of these defined variables are very important; they are used - * to create the OUTPUT file. Essentially, PSCreateFile() loops through the - * index of 0 to psDrawNo and checks if the file/procedure is used. If so, - * the file is copied to the output file. - */ +@ +Indices for PostScript draw procedures. + +The order of these defined variables are very important; they are used +to create the OUTPUT file. Essentially, PSCreateFile() loops through the +index of 0 to psDrawNo and checks if the file/procedure is used. If so, +the file is copied to the output file. +<>= #define output 0 /* output file */ #define headerps 1 /* postscript header file */ @@ -23193,14 +26305,11 @@ Gdraws_data(int dFlag) #define GCdictps 18 /* grahphics context definition file */ #define scriptps 19 /* script file */ #define endps 20 /* wrap up, close down, procedure */ - #define psDrawNo 21 /* for use in createPSfile() */ - -/* - * PostScript structures - */ - +@ +PostScript structures +<>= typedef struct _psStruct { /* data structure for ps routines info */ int flag; char filename[200]; @@ -23209,83 +26318,91 @@ typedef struct _psStruct { /* data structure for ps routines info */ psStruct psData[psDrawNo]; /* need psDrawNo of them */ -/* - * These variables are expected to be declared in within client programs, eg, - * main.c in view2d and view3d. - */ - +@ +These variables are expected to be declared in within client programs, eg, +main.c in view2d and view3d. +<>= extern int scrn; /* screen */ extern Display *dsply; /* display */ extern char *envAXIOM; /* environment variable AXIOM or DEVE */ - -#endif - - -@ -\section{gfun.c} -<>= -#define _GFUN_C - -#include -#include -#include -#include - -<> <> #include "hash.h" - #include "hash.h1" -<> - - -/* - * Given 2 file pointers, this function copies file ifp to file ofp - */ - -static void -filecopy(FILE * ifp, FILE * ofp) -{ +extern int PSCreateFile(int,Window,Window,char *); +extern int GdrawsDrawFrame(int,Window,Window,char *); +extern int GdrawsSetDimension(Window,Window); +extern int GDrawImageString(GC,Window,int,int,char *,int,int); +extern int GDrawArc(GC,Window,int,int,unsigned int,unsigned int,int,int,int); +extern int GDrawLine(GC,Window,int,int,int,int,int); +extern int GDrawLines(GC,Window,XPoint *,int,int,int); +extern int GDrawPoint(Window,GC,int,int,int); +extern int GDrawString(GC,Window,int,int,char *,int,int); +extern int GFillArc(GC,Window,int,int,unsigned int,unsigned int,int,int,int); +extern int PSGlobalInit(void); +extern int PSInit(Window,Window); +extern int PSCreateContext(GC,char *,int,int,int,float,float); +extern char *PSfindGC(GC); +extern int GSetForeground(GC,float,int); +extern int GSetBackground(GC,float,int); +extern int GSetLineAttributes(GC,int,int,int,int,int); +extern int PSClose(void); +extern int centerX(GC,char *,int,int); +extern int centerY(GC,int); +extern int PSColorPolygon(float,float,float,XPoint *,int); +extern int PSColorwOutline(float,float,float,XPoint *,int); +extern int PSDrawColor(float,float,float,XPoint *,int); +extern int PSFillPolygon(GC,XPoint *,int); +extern int PSFillwOutline(GC,XPoint *,int); +extern HashTable * XCreateAssocTable(int); +extern void XMakeAssoc(Display *,HashTable *,Window,int *); +extern int *XLookUpAssoc(Display *,HashTable *,Window); +extern void XDeleteAssoc(Display *,HashTable *,Window); +extern int GDrawRectangle(GC,Window,short,short,short,short,int); +extern int GDraw3DButtonOut(GC,Window,short,short,short,short,int); +extern int GDraw3DButtonIn(GC,Window,short,short,short,short,int); +extern int GDrawPushButton(Display *,GC,GC,GC,Window,short,short,short, + short,int,char *,unsigned long,unsigned long,int); +#ifdef _GFUN_C +static void filecopy(FILE *,FILE *); +static int TrivEqual(Window,Window); +static int TrivHashCode(Window,int); +#endif - int c; +@ +\subsection{filecopy} +\label{filecopy} +\index{gdraws!filecopy} +Given 2 file pointers, this function copies file ifp to file ofp +<>= +static void filecopy(FILE * ifp, FILE * ofp) +{ int c; while ((c = getc(ifp)) != EOF) putc(c, ofp); } +@ +\subsection{PSCreateFile} +\label{PSCreateFile} +\index{gdraws!PSCreateFile} +PSCreateFile generates the output file by using the order of defined +variables; they are used to create the OUTPUT file. Essentially, +PSCreateFile() loop through the index of 0 to psDrawNo and checks if the +file/procedure is used. If so, the file is included into the output file. +<>= -/* - * PSCreateFile generates the output file by using the order of defined - * variables; they are used to create the OUTPUT file. Essentially, - * PSCreateFile() loop through the index of 0 to psDrawNo and checks if the - * file/procedure is used. If so, the file is included into the output - * file. - */ - -int -PSCreateFile( +int PSCreateFile( int bWidth, /* border width of picture frame */ Window vw, Window tw, /* viewWindow, and titleWindow */ char *title) /* title of picture to be drawn in title bar */ -{ - FILE *ifp, *ofp, *fp; /* input, output and temp file pointer */ +{ FILE *ifp, *ofp, *fp; /* input, output and temp file pointer */ int i; /* index */ - /* last things to add to the script file */ - fp = fopen(psData[scriptps].filename, "a"); fprintf(fp, "\n grestore\t%% restore graphics state\n\n"); fclose(fp); - -#if 0 - /* Make frame drawing optional. */ - - Gdraws_drawFrame(bWidth, vw, tw, title); -#endif - /* put procedures and script together into OUTPUT.ps */ - if ((ofp = fopen(psData[output].filename, "w")) == NULL) { fprintf(stderr, "Cannot open %s to write.\n", psData[output].filename); return (psError); @@ -23294,111 +26411,79 @@ PSCreateFile( i = 1; while (i < psDrawNo) { /* loops through each file/procedure */ if (psData[i].flag) { /* if set, procedure/file is used */ - if ((ifp = fopen(psData[i].filename, "r")) == NULL) { - if (i == GCdictps) { /* GC dictionaries */ - fprintf(stderr, "Warning: missing GCdictionary.\n"); + if ((ifp = fopen(psData[i].filename, "r")) == NULL) { + if (i == GCdictps) { /* GC dictionaries */ + fprintf(stderr, "Warning: missing GCdictionary.\n"); } - else { - fprintf(stderr, "Cannot open %s to read.\n", - psData[i].filename); - fclose(ofp); - return (psError); - } - } + else { + fprintf(stderr, "Cannot open %s to read.\n",psData[i].filename); + fclose(ofp); + return(psError); + } + } else { - filecopy(ifp, ofp); - fclose(ifp); - } + filecopy(ifp, ofp); + fclose(ifp); + } } i++; } } - /* remove script file in tmp */ - unlink(psData[scriptps].filename); - -#if 0 - /* remove GCdict file in tmp */ - unlink(psData[GCdictps].filename); -#endif - return (fclose(ofp)); } +@ +\subsection{GdrawsDrawFrame} +\label{GdrawsDrawFrame} +\index{gdraws!GdrawsDrawFrame} +This function draws the frame of the picture, which corresponds to the +picture frame on the X display. In addition, it draws the title window as +well as the title of the picture. +<>= - -/* - * This function draws the frame of the picture, which corresponds to the - * picture frame on the X display. In addition, it draws the title window as - * well as the title of the picture. - */ - -int -Gdraws_drawFrame( +int GdrawsDrawFrame( int borderW, /* border width */ Window viewWindow, Window titleWindow, char *title) /* title of picture */ -{ - FILE *fp; +{ FILE *fp; XWindowAttributes vwInfo, twInfo; - /* choose 2 and "frameDict" for frame dictionary: can be anything else */ - PSCreateContext((GC)2, "frameDict", borderW, psButtCap, psMiterJoin, psWhite, psBlack); - fp = fopen(psData[scriptps].filename, "a"); - XGetWindowAttributes(dsply, viewWindow, &vwInfo); - /* draw title window */ - XGetWindowAttributes(dsply, titleWindow, &twInfo); fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\ttitle\n", "frameDict", twInfo.height - vwInfo.height, twInfo.width, 0, vwInfo.height); - /* draw viewport window */ - - fprintf(fp, "\t%s\tdrawFrame\n", "frameDict"); /* using Gdraws_setDimension() */ - + fprintf(fp, "\t%s\tdrawFrame\n", "frameDict"); /* using GdrawsSetDimension() */ /* draw title text */ - psData[drawIstrps].flag = yes; fprintf(fp, "\t%s\tloadFont\n\t%d\t(%s) stringwidth pop sub 2 div\n", "frameDict", twInfo.width, title); fprintf(fp, "\t%d\t(%s)\t(%s)\tpsDrawIStr\n", 15, title, "title"); - return (fclose(fp)); } +@ +\subsection{GdrawsSetDimension} +\label{GdrawsSetDimension} +\index{gdraws!GdrawsSetDimension} +GdrawsSetDimension sets the dimension of the picture. +<>= -/* setDimension sets the dimension of the picture */ - -int -Gdraws_setDimension( - Window viewWindow, - Window titleWindow) -{ +int GdrawsSetDimension(Window viewWindow, Window titleWindow) { FILE *fp; XWindowAttributes vwInfo, twInfo; float pageWidth, pageHeight, width; - fp = fopen(psData[scriptps].filename, "w"); - XGetWindowAttributes(dsply, titleWindow, &twInfo); XGetWindowAttributes(dsply, viewWindow, &vwInfo); pageWidth = 575.0; pageHeight = 750.0; - -#if 0 - pageWidth = (float) (DisplayWidth(dsply, scrn) / DisplayWidthMM(dsply, scrn)); - pageWidth *= 160.0; - pageHeight = (float) (DisplayHeight(dsply, scrn) / DisplayHeightMM(dsply, scrn)); - pageHeight *= 210.0; - fprintf(stderr, "%f, %f\n", pageWidth, pageHeight); -#endif - fprintf(fp, "\n gsave\t%% save graphics state for clipping path\n\n"); if ((vwInfo.height > pageWidth) || (vwInfo.height > pageHeight)) { width = (float) vwInfo.width; @@ -23408,177 +26493,163 @@ Gdraws_setDimension( } else { if (vwInfo.height > pageHeight) - fprintf(fp, "\t%f\t%f", width, pageHeight / width); + fprintf(fp, "\t%f\t%f", width, pageHeight / width); } } else { fprintf(fp, "\t%f\t%f", 1.0, 1.0); } fprintf(fp, "\tscale\n\n"); - fprintf(fp, "\t%d\t%d\t%d\tsetDim\n", twInfo.height - vwInfo.height, vwInfo.height, vwInfo.width); - /* Write a Bounding Box for psfig etc. */ - fprintf(fp, "%%%%BoundingBox: 0 0 %d %d\n", vwInfo.height, vwInfo.width); - fprintf(fp, "\tmaxX maxY\t0 0\trectangle\tclip\t%% set clip path\n\n"); return (fclose(fp)); } -/* - * GDrawImageString draws an image text string - */ -int -GDrawImageString( +@ +\subsection{GDrawImageString} +\label{GDrawImageString} +\index{gdraws!GDrawImageString} +GDrawImageString draws an image text string +See \ref{XDrawImageString} on page~\pageref{XDrawImageString} +<>= + +int GDrawImageString( GC gc, /* graphics context */ Window wid, /* window id */ int x, int y, char *string, int length, int dFlag) -{ - int s; - +{ int s; switch (dFlag) { - case Xoption: - s = XDrawImageString(dsply, wid, gc, x, y, string, length); - break; - case PSoption: - { + case Xoption: + s = XDrawImageString(dsply, wid, gc, x, y, string, length); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawImageString cannot open %s\n", - psData[scriptps].filename); + fprintf(stderr, "GDrawImageString cannot open %s\n", + psData[scriptps].filename); return (psError); } - psData[drawIstrps].flag = yes; /* set procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t(%s)\t(%s)\tpsDrawIStr\n", PSfindGC(gc), x, y, string, "window"); s = fclose(fp); } - break; - default: - fprintf(stderr, "GdrawImagestring request (%d) not implemented yet.\n", dFlag); + break; + default: + fprintf(stderr, + "GdrawImagestring request (%d) not implemented yet.\n", dFlag); return (psError); } return (s); } -/* Draws an arc; see XDrawArc */ +@ +\subsection{GDrawArc} +\label{GDrawArc} +\index{gdraws!GDrawArc} +GDrawArc draws an arc. +See \ref{XDrawArc} on page~\pageref{XDrawArc} +<>= -int -GDrawArc( +int GDrawArc( GC gc, /* graphics context */ Window wid, /* window id */ int x, int y, unsigned int wdth, unsigned int hght, int ang1, int ang2, int dFlag) -{ - int s = 0; - +{ int s = 0; switch (dFlag) { - case Xoption: - XDrawArc(dsply, wid, gc, x, y, wdth, hght, ang1, ang2); - break; - case PSoption: - { + case Xoption: + XDrawArc(dsply, wid, gc, x, y, wdth, hght, ang1, ang2); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawArc cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawArc cannot open %s\n", + psData[scriptps].filename); + return (psError); } - psData[drawarcps].flag = yes; fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\t%d\t%d\tpsDrawArc\n", PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawarc request (%d) not implemented yet.\n", - dFlag); + break; + default: + fprintf(stderr, "Gdrawarc request (%d) not implemented yet.\n",dFlag); return (psError); } return (s); } -/* - * GDrawLine draws a line, see XDrawLine - */ -int -GDrawLine( +@ +\subsection{GDrawLine} +\label{GDrawLine} +\index{gdraws!GDrawLine} +GDrawLine draws a line. +See \ref{XDrawLine} on page~\pageref{XDrawLine} +<>= + +int GDrawLine( GC gc, /* graphics context */ Window wid, /* window id */ int x0, int y0, int x1, int y1, int dFlag) -{ - int s = 0; - +{ int s = 0; switch (dFlag) { - case Xoption: - XDrawLine(dsply, wid, gc, x0, y0, x1, y1); - break; - case PSoption: - { + case Xoption: + XDrawLine(dsply, wid, gc, x0, y0, x1, y1); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawLine cannot open %s\n", - psData[scriptps].filename); + fprintf(stderr, "GDrawLine cannot open %s\n", + psData[scriptps].filename); return (psError); } - psData[drawlineps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawLine\n", PSfindGC(gc), x1, y1, x0, y0); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawline request (%d) not implemented yet.\n", - dFlag); - return (psError); + break; + default: + fprintf(stderr, "Gdrawline request (%d) not implemented yet.\n",dFlag); + return (psError); } return (s); } +@ +\subsection{GDrawLines} +\label{GDrawLines} +\index{gdraws!GDrawLines} +GDrawLines draws lines. +<>= - - - -/* - * GDrawLines draws lines; see XDrawLines - */ - -int -GDrawLines( +int GDrawLines( GC gc, /* graphics context */ Window wid, /* window id */ XPoint * points, /* points */ int numberOfPoints, int mode, int dFlag) /* number of points, mode and display flag */ -{ - int s = 0; - +{ int s = 0; switch (dFlag) { - case Xoption: - XDrawLines(dsply, wid, gc, points, numberOfPoints, mode); - break; - case PSoption: - { + case Xoption: + XDrawLines(dsply, wid, gc, points, numberOfPoints, mode); + break; + case PSoption: { FILE *fp; /* not dealing with modes yet */ int i = 0; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawLines cannot open %s\n", - psData[scriptps].filename); + fprintf(stderr, "GDrawLines cannot open %s\n", + psData[scriptps].filename); return (psError); } - psData[drawlinesps].flag = yes; /* set procedure flag */ fprintf(fp, "\t%s\n", PSfindGC(gc)); i = numberOfPoints - 1; @@ -23586,167 +26657,143 @@ GDrawLines( { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i = i-1; } - fprintf(fp, "\t%d\t%d\t%d\tpsDrawLines\n", numberOfPoints, points[i].x, points[i].y); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawlines request (%d) not implemented yet\n", - dFlag); - return (psError); + break; + default: + fprintf(stderr, "Gdrawlines request (%d) not implemented yet\n",dFlag); + return (psError); } return (s); } -/* - * GDrawPoint draws a point, see XDrawPoint - */ +@ +\subsection{GDrawPoint} +\label{GDrawPoint} +\index{gdraws!GDrawPoint} +GDrawPoint draws a point. +(See Section \ref{XDrawPoint} on page~\pageref{XDrawPoint}), +<>= -int -GDrawPoint( +int GDrawPoint( Window wid, /* window id */ GC gc, /* graphics context */ int x0, int y0, int dFlag) -{ - int s = 0; - +{ int s = 0; switch (dFlag) { - case Xoption: - XDrawPoint(dsply, wid, gc, x0, y0); - break; - case PSoption: - { + case Xoption: + XDrawPoint(dsply, wid, gc, x0, y0); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GDrawPoint cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[drawpointps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawPoint\n", PSfindGC(gc), x0, y0, x0 + 1, y0 + 1); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawpoint request (%d) not implemented yet\n", - dFlag); - return (psError); + break; + default: + fprintf(stderr, "Gdrawpoint request (%d) not implemented yet\n",dFlag); + return (psError); } return (s); } -/* - * GDrawRectangle draws a rectangle; see XDrawRectangle - */ +@ +\subsection{GDrawRectangle} +\label{GDrawRectangle} +\index{gdraws!GDrawRectangle} +GDrawRectangle draws a rectangle. +<>= -int -GDrawRectangle( +int GDrawRectangle( GC gc, Window windowId, short int x,short int y,short int width,short int height, int dFlag) -{ - int s = 0; - +{ int s = 0; switch (dFlag) { - case Xoption: - XDrawRectangle(dsply, windowId, gc, x, y, width, height); - break; - case PSoption: - { + case Xoption: + XDrawRectangle(dsply, windowId, gc, x, y, width, height); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawRect cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawRect cannot open %s\n", + psData[scriptps].filename); + return (psError); } - psData[drawrectps].flag = yes; fprintf(fp, "\t%s\t%d\t%d\t%d\t%d\tpsDrawRect\n", - PSfindGC(gc), width, height, x, y); + PSfindGC(gc), width, height, x, y); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawrect request (%d) not implemented yet\n", - dFlag); + break; + default: + fprintf(stderr, "Gdrawrect request (%d) not implemented yet\n",dFlag); return (psError); } return (s); } -/* - * GDraw3DButtonOut draws a rectangle with 3D shading on rhs and bottom - */ +@ +\subsection{GDraw3DButtonIn} +\label{GDraw3DButtonIn} +\index{gdraws!GDraw3DButtonIn} +GDraw3DButtonOut draws a rectangle with 3D shading on rhs and bottom +<>= -int -GDraw3DButtonOut( +int GDraw3DButtonOut( GC gc, Window windowId, short int x,short int y,short int width,short int height, int dFlag) -{ - /* draw regular rectangle */ - +{ /* draw regular rectangle */ int s = GDrawRectangle(gc, windowId, x, y, width - 1, height - 1, dFlag); - /* add extra line down rhs */ - - GDrawLine(gc, windowId, - x + width, y + 1, x + width, y + height, - dFlag); - + GDrawLine(gc, windowId, x + width, y + 1, x + width, y + height, dFlag); /* add extra line across bottom */ - - GDrawLine(gc, windowId, - x + 1, y + height, x + width, y + height, - dFlag); - + GDrawLine(gc, windowId, x + 1, y + height, x + width, y + height, dFlag); return (s); } -/* - * GDraw3DButtonIn draws a rectangle with 3D shading on lhs and top - */ +@ +\subsection{GDraw3DButtonIn} +\label{GDraw3DButtonIn} +\index{gdraws!GDraw3DButtonIn} +GDraw3DButtonIn draws a rectangle with 3D shading on lhs and top +<>= -int -GDraw3DButtonIn( +int GDraw3DButtonIn( GC gc, Window windowId, short int x,short int y,short int width,short int height, int dFlag) -{ - /* draw regular rectangle */ - - int s = GDrawRectangle(gc, windowId, x + 1, y + 1, width - 1, height - 1, dFlag); - +{ /* draw regular rectangle */ + int s = + GDrawRectangle(gc, windowId, x + 1, y + 1, width - 1, height - 1, dFlag); /* add extra line down lhs */ - - GDrawLine(gc, windowId, - x, y, x, y + height - 1, - dFlag); - + GDrawLine(gc, windowId, x, y, x, y + height - 1, dFlag); /* add extra line across top */ - - GDrawLine(gc, windowId, - x, y, x + width - 1, y, - dFlag); - + GDrawLine(gc, windowId, x, y, x + width - 1, y, dFlag); return (s); } -/* - * GDrawPushButton draws a push button whose appearance depends on "isOn." - */ +@ +\subsection{GDrawPushButton} +\label{GDrawPushButton} +\index{gdraws!GDrawPushButton} +GDrawPushButton draws a push button whose appearance depends on ``isOn.'' +<>= -int -GDrawPushButton( +int GDrawPushButton( Display * display, GC gc1, GC gc2, GC gc3, Window windowId, @@ -23756,123 +26803,109 @@ GDrawPushButton( int dFlag) { int len = strlen(text); - if (dFlag == Xoption) XClearArea(display, windowId, x, y, width + 1, height + 1, False); - GSetForeground(gc1, (float) buttonColor, dFlag); - if (isOn) GDraw3DButtonIn(gc1, windowId, x, y, width, height, dFlag); else GDraw3DButtonOut(gc1, windowId, x, y, width, height, dFlag); - GSetForeground(gc2, (float) color, dFlag); - return GDrawString(gc2, windowId, x + (isOn ? 2 : 0) + centerX(gc3, text, len, width), y + (isOn ? 2 : 0) + centerY(gc3, height), text, len, dFlag); } +@ +\subsection{GDrawString} +\label{GDrawString} +\index{gdraws!GDrawString} +Draws a string. +See \ref{XDrawString} on page~\pageref{XDrawString}. +<>= - -/* - * Draws a string; see XDrawString - */ - -int -GDrawString( +int GDrawString( GC gc, /* graphics context */ Window wid, /* window id */ int x, int y, char *string, /* string to be drawn */ int length, int dFlag) -{ - int s; - +{ int s; switch (dFlag) { - case Xoption: - s = XDrawString(dsply, wid, gc, x, y, string, length); - break; - case PSoption: - { + case Xoption: + s = XDrawString(dsply, wid, gc, x, y, string, length); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GDrawString cannot open %s\n", - psData[scriptps].filename); - return (psError); + fprintf(stderr, "GDrawString cannot open %s\n", + psData[scriptps].filename); + return (psError); } - psData[drawstrps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\t(%s)\t%d\t%d\tpsDrawStr\n", - PSfindGC(gc), string, x, y); - + PSfindGC(gc), string, x, y); s = fclose(fp); } - break; - default: - fprintf(stderr, "Gdrawstring request (%d) not implemented yet\n", - dFlag); - return (psError); + break; + default: + fprintf(stderr, "Gdrawstring request (%d) not implemented yet\n",dFlag); + return (psError); } return (s); } -/* - * Draws and fills an arc with foreground color; see XFillArc - */ +@ +\subsection{GFillArc} +\label{GFillArc} +\index{gdraws!GFillArc} +Draws and fills an arc with foreground color. +See \ref{XFillArc} on page~\pageref{XFillArc}. +<>= -int -GFillArc( +int GFillArc( GC gc, /* graphics context */ Window wid, /* window id */ int x, int y, unsigned int wdth, unsigned int hght, int ang1, int ang2, int dFlag) -{ - int s = 0; - +{ int s = 0; switch (dFlag) { case Xoption: /* angle: times 64 already */ XFillArc(dsply, wid, gc, x, y, wdth, hght, ang1, ang2); break; - case PSoption: - { - FILE *fp; - - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { - fprintf(stderr, "GFillArc cannot open %s\n", - psData[scriptps].filename); - return (psError); - } - - psData[fillarcps].flag = yes; /* sets procedure flag */ - fprintf(fp, "\t%s\t%d %d\t%d %d\t%d %d\t%d %d\tpsFillArc\n", - PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64, - x + wdth / 2, y + hght / 2); - s = fclose(fp); + case PSoption: { + FILE *fp; + if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { + fprintf(stderr, "GFillArc cannot open %s\n", + psData[scriptps].filename); + return (psError); } + psData[fillarcps].flag = yes; /* sets procedure flag */ + fprintf(fp, "\t%s\t%d %d\t%d %d\t%d %d\t%d %d\tpsFillArc\n", + PSfindGC(gc), x, y, hght, wdth, ang1 / 64, ang2 / 64, + x + wdth / 2, y + hght / 2); + s = fclose(fp); + } break; default: - fprintf(stderr, "GFillArc request (%d) not implemented yet\n", - dFlag); + fprintf(stderr, "GFillArc request (%d) not implemented yet\n", dFlag); return (psError); } return (s); } -/* - * Initializes the path and files to be used. - */ +@ +\subsection{PSGlobalInit} +\label{PSGlobalInit} +\index{gdraws!PSGlobalInit} +Initializes the path and files to be used. +This needs to be called only once each session. +<>= -int -PSGlobalInit(void) -{ /* This needs to be called only once each - * session. */ +int PSGlobalInit(void) { char *tmp; - /* path-independent global file name */ psData[GCdictps].flag = yes; tmp = tempnam(NULL, "axPS"); @@ -23881,13 +26914,10 @@ PSGlobalInit(void) psData[setupps].flag = yes; psData[scriptps].flag = yes;/* new script file name */ psData[endps].flag = yes; - /* path specific file names */ - if ((envAXIOM = getenv("DEVE")) != NULL) { /* get env var AXIOM */ - psData[headerps].flag = yes; - sprintf(psData[headerps].filename, "%s%s", envAXIOM, "/gdraws/PS/header.ps"); + sprintf(psData[headerps].filename,"%s%s",envAXIOM,"/gdraws/PS/header.ps"); sprintf(psData[drawps].filename, "%s%s", envAXIOM, "/gdraws/PS/draw.ps"); sprintf(psData[drawarcps].filename, "%s%s", envAXIOM, "/gdraws/PS/drawarc.ps"); @@ -23960,30 +26990,29 @@ PSGlobalInit(void) "/lib/graph/end.ps"); } else { - fprintf(stderr, " need environment variable AXIOM or DEVE; process aborted\n"); + fprintf(stderr, + " need environment variable AXIOM or DEVE; process aborted\n"); return (psError); } - return (psInit = yes); } +@ +\subsection{PSInit} +\label{PSInit} +\index{gdraws!PSInit} +This needs to be called for every postscript file generated. +It initializes the procedure flags. +<>= -/* - * This needs to be called for every postscript file generated. It - * initializes the procedure flags. - */ - -int -PSInit(Window vw, Window tw) -{ +int PSInit(Window vw, Window tw) { if (!psInit) { /* must have PSGlobalInit() called before this */ - fprintf(stderr, "Error: need initialization for ps data files: call PSGlobalInit().\n"); + fprintf(stderr, + "Error: need initialization for ps data files: call PSGlobalInit().\n"); return (psError); } - sprintf(psData[output].filename, "%s", PSfilename); /* output file name */ - psData[drawps].flag = no; /* ps procedures flags */ psData[drawarcps].flag = no; psData[drawfilledps].flag = no; @@ -23999,22 +27028,23 @@ PSInit(Window vw, Window tw) psData[drawstrps].flag = no; psData[drawIstrps].flag = no; psData[fillarcps].flag = no; - sprintf(psData[scriptps].filename, "%s", tmpnam(NULL)); /* script file */ - return (Gdraws_setDimension(vw, tw)); + return (GdrawsSetDimension(vw, tw)); } -/* - * This procedure sets the line attributes; notice that lineWidth is not set - * for PS, this is because lineWidth of 0, the thinest line on the ps device, - * is device-dependent, thus, we'll leave it and use default. Also lineStyle - * is solid in ps by default, thus we don't need to set it. We'll leave out - * line style here since we really never used anything other than line solid - * which is the default line style in postscript. - */ +@ +\subsection{PSCreateContext} +\label{PSCreateContext} +\index{gdraws!PSCreateContext} +This procedure sets the line attributes; notice that lineWidth is not set +for PS, this is because lineWidth of 0, the thinest line on the ps device, +is device-dependent, thus, we'll leave it and use default. Also lineStyle +is solid in ps by default, thus we don't need to set it. We'll leave out +line style here since we really never used anything other than line solid +which is the default line style in postscript. +<>= -int -PSCreateContext( +int PSCreateContext( GC gc, /* graphics context */ char *C_gc, /* GC name to be used as postscript variable */ int lineWidth, int capStyle, int joinStyle, @@ -24022,16 +27052,12 @@ PSCreateContext( { FILE *fp; GCptr newGC, curGC; - /* get memory for new GC cell */ - if (!(newGC = (GCptr) malloc(sizeof(GCstruct)))) { fprintf(stderr, "Ran out of memory(malloc) trying to create a ps GC.\n"); exit(-1); } - /* attach newGC to chain */ - if (GChead == NULL) GChead = newGC; else { /* attach newGC to end of linked list */ @@ -24040,39 +27066,33 @@ PSCreateContext( curGC = curGC->next; curGC->next = newGC; } - /* fill newGC with information */ - newGC->GCint = gc; sprintf(newGC->GCchar, "%s", C_gc); newGC->next = NULL; - if ((fp = fopen(psData[GCdictps].filename, "a")) == NULL) { fprintf(stderr, "PSCreateContext cannot open %s\n", psData[GCdictps].filename); return (psError); } - fprintf(fp, "\t%d\t%d\t%d\n\t%f\t%f\t/%s\tmakeDict\n", joinStyle, capStyle, lineWidth, bg, fg, C_gc); - return (fclose(fp)); } -/* - * Looks into GC linked list with gc (unsigned long) as index to find the - * character name. - */ +@ +\subsection{PSfindGC} +\label{PSfindGC} +\index{gdraws!PSfindGC} +Looks into GC linked list with gc (unsigned long) as index to find the +character name. +<>= -char * -PSfindGC(GC gc) -{ +char *PSfindGC(GC gc) { GCptr curGC; - curGC = GChead; while ((curGC != NULL) && (curGC->GCint != gc)) curGC = curGC->next; - if (curGC == NULL) { fprintf(stderr, "PSfindGC cannot find gc: %p.\n",gc); return (NULL); @@ -24081,26 +27101,26 @@ PSfindGC(GC gc) return (curGC->GCchar); } -/* - * Sets foreground color; see XSetForeground - */ +@ +\subsection{GSetForeground} +\label{GSetForeground} +\index{gdraws!GSetForeground} +Sets foreground color. +See \ref{XSetForeground} on page~\pageref{XSetForeground}. +<>= -int -GSetForeground( +int GSetForeground( GC gc, /* graphics context */ float color, /* foreground color to be set */ int dFlag) /* display flag: PS, X,... */ { int s = 0; - switch (dFlag) { - case Xoption: - XSetForeground(dsply, gc, (unsigned long) color); - break; - case PSoption: - { + case Xoption: + XSetForeground(dsply, gc, (unsigned long) color); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GSetForeground cannot open %s\n", psData[scriptps].filename); @@ -24110,33 +27130,34 @@ GSetForeground( s = fclose(fp); break; } - default: - fprintf(stderr, "GSetForeground request (%d) not implemented yet\n", dFlag); + default: + fprintf(stderr, + "GSetForeground request (%d) not implemented yet\n", dFlag); return (0); } return (s); } -/* - * Sets background color; see XSetBackground - */ +@ +\subsection{GSetBackground} +\label{GSetBackground} +\index{gdraws!GSetBackground} +Sets background color. +See \ref{XSetBackground} on page~\pageref{XSetBackground}. +<>= -int -GSetBackground( +int GSetBackground( GC gc, /* graphics context */ float color, /* background color to be set */ int dFlag) /* display flag: PS, X,... */ { int s = 0; - switch (dFlag) { - case Xoption: - XSetBackground(dsply, gc, (unsigned long) color); - break; - case PSoption: - { + case Xoption: + XSetBackground(dsply, gc, (unsigned long) color); + break; + case PSoption: { FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GSetBackground cannot open %s\n", psData[scriptps].filename); @@ -24146,130 +27167,118 @@ GSetBackground( s = fclose(fp); break; } - default: - fprintf(stderr, "GSetBackground request (%d) not implemented yet\n", dFlag); + default: + fprintf(stderr, + "GSetBackground request (%d) not implemented yet\n", dFlag); return (0); } return (s); } -/* - * See XSetLineAttributes. Notice that we'll not setting line style for - * postscript. This is because solid is the ls in ps and in view3d and 2d, - * we really don't use anything else than solid. - */ +@ +\subsection{GSetLineAttributes} +\label{GSetLineAttributes} +\index{gdraws!GSetLineAttributes} +(See \ref{XSetLineAttributes} on page~\pageref{XSetLineAttributes}), +Notice that we'll not setting line style for +postscript. This is because solid is the ls in ps and in view3d and 2d, +we really don't use anything else than solid. +<>= -int -GSetLineAttributes( +int GSetLineAttributes( GC gc, int lineWidth, int lineStyle, int capStyle, int joinStyle, - int dFlag) -{ + int dFlag) { int s = 0; - switch (dFlag) { - case Xoption: - XSetLineAttributes(dsply, gc, lineWidth, lineStyle, - capStyle, joinStyle); - break; - case PSoption: - { + case Xoption: + XSetLineAttributes(dsply, gc, lineWidth, lineStyle,capStyle, joinStyle); + break; + case PSoption: { FILE *fp; int psCap, psJoin; - switch (capStyle) { - case 0: /* CapNotLast is not implemented in ps */ - case 1: - psCap = psButtCap; - break; - case 2: - psCap = psRoundCap; - break; - case 3: - psCap = psPSqCap; - break; - default: - fprintf(stderr, "cap style: %d unknown, using default.\n", capStyle); - psCap = psButtCap; + case 0: /* CapNotLast is not implemented in ps */ + case 1: + psCap = psButtCap; + break; + case 2: + psCap = psRoundCap; + break; + case 3: + psCap = psPSqCap; + break; + default: + fprintf(stderr, "cap style: %d unknown, using default.\n", capStyle); + psCap = psButtCap; } - switch (joinStyle) { - case 0: - psJoin = psMiterJoin; - break; - case 1: - psJoin = psRoundJoin; - break; - case 2: - psJoin = psBevelJoin; - break; - default: - fprintf(stderr, "join style: %d unknown, using default.\n", joinStyle); - psJoin = psMiterJoin; + case 0: + psJoin = psMiterJoin; + break; + case 1: + psJoin = psRoundJoin; + break; + case 2: + psJoin = psBevelJoin; + break; + default: + fprintf(stderr,"join style: %d unknown, using default.\n",joinStyle); + psJoin = psMiterJoin; } - /* - * width of zero is machine-dependent and is not recom- mended, + * width of zero is machine-dependent and is not recommended, * we'll use 1 as the thinest line available if (lineWidth < 1) * lineWidth = 1; */ - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GSetLineAttributes cannot open %s\n", psData[scriptps].filename); return (0); } - fprintf(fp, "\t%d\t%d\t%d\t%s\tsetLineAttributes\n", lineWidth, psCap, psJoin, PSfindGC(gc)); s = fclose(fp); } - break; - default: - fprintf(stderr, "GSetLineAttributes request (%d) not implemented yet\n", dFlag); - return (0); + break; + default: + fprintf(stderr, + "GSetLineAttributes request (%d) not implemented yet\n", dFlag); + return (0); } - return (s); + return(s); } -/* - * This procedure frees the data structure used for GC information, and also - * unlinks the GC dictionary file. - */ - -int -PSClose(void) -{ - if (GChead != NULL) { - - /* free memory used by GC struct */ +@ +\subsection{PSClose} +\label{PSClose} +\index{gdraws!PSClose} +This procedure frees the data structure used for GC information, and also +unlinks the GC dictionary file. +<>= +int PSClose(void) { + if (GChead != NULL) { /* free memory used by GC struct */ GCptr curGC = GChead; - while (curGC != NULL) { GCptr freeGC = curGC; - curGC = curGC->next; free(freeGC); } } - - /* remove GC dictionary file */ - - return (unlink(psData[GCdictps].filename)); + return (unlink(psData[GCdictps].filename)); /* remove GC dictionary file */ } +@ +\subsection{centerX} +\label{centerX} +\index{gdraws!centerX} +<>= - - -int -centerX (GC viewGCx,char * theString,int strlength,int windowWidth) -{ - XFontStruct *fontStruct; +int centerX(GC viewGCx,char * theString,int strlength,int windowWidth) +{ XFontStruct *fontStruct; GContext con; int result; - - con=XGContextFromGC(viewGCx); fontStruct = XQueryFont(dsply,con); if(fontStruct == NULL) return(0); @@ -24279,34 +27288,36 @@ centerX (GC viewGCx,char * theString,int strlength,int windowWidth) return(result); } +@ +\subsection{centerY} +\label{centerY} +\index{gdraws!centerY} +<>= -int -centerY (GC viewGCy,int windowHeight) -{ - +int centerY(GC viewGCy,int windowHeight) { XFontStruct *fontStruct; GContext con; int result; - con=XGContextFromGC(viewGCy); fontStruct = XQueryFont(dsply,con); if (fontStruct == NULL) return(0); result = (windowHeight - - (fontStruct->max_bounds.ascent + fontStruct->max_bounds.descent))/2 + - fontStruct->max_bounds.ascent; + (fontStruct->max_bounds.ascent + + fontStruct->max_bounds.descent))/2 + + fontStruct->max_bounds.ascent; XFreeFontInfo(NULL,fontStruct,1); return(result); - } - -/* - * PSColorPolygon draws and fills a polygon given data in XPoint; see - * XFillPolygon - */ +@ +\subsection{PSColorPolygon} +\label{PSColorPolygon} +\index{gdraws!PSColorPolygon} +PSColorPolygon draws and fills a polygon given data in XPoint. +(See \ref{XFillPolygon} on page~\pageref{XFillPolygon}) +<>= -int -PSColorPolygon( +int PSColorPolygon( float r, float g, float b, /* red, green and blue color * components */ XPoint * points, /* vertices of polygon */ @@ -24314,35 +27325,32 @@ PSColorPolygon( { int i = 0; FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSColorPolygon cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[colorpolyps].flag = yes; /* sets procedure flag */ - fprintf(fp, "\t%f\t%f\t%f\tsetrgbcolor\n", r, g, b); - i = numberOfPoints - 1; - while (i > 0) - { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); + while (i > 0) { + fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i = i-1; } - - fprintf(fp, "\t%d\t%d\t%d\tpsColorPoly\n", numberOfPoints, points[i].x, points[i].y); - + fprintf(fp, "\t%d\t%d\t%d\tpsColorPoly\n", + numberOfPoints, points[i].x, points[i].y); return (fclose(fp)); } -/* - * PSColorwOutline draws and also outlines the colored polygon. - */ +@ +\subsection{PSColorwOutline} +\label{PSColorwOutline} +\index{gdraws!PSColorwOutline} +PSColorwOutline draws and also outlines the colored polygon. +<>= -int -PSColorwOutline( +int PSColorwOutline( float r, float g, float b, /* red, green and blue color * components */ XPoint * points, /* vertices of polygon */ @@ -24350,351 +27358,179 @@ PSColorwOutline( { int i = 0; FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSDrawFOL cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[colorwolps].flag = yes; /* sets procedure flag */ - fprintf(fp, "\t%f\t%f\t%f\tsetrgbcolor\n", r, g, b); - i = numberOfPoints - 1; - while (i > 0) - { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); + while (i > 0) { + fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i = i-1; } - fprintf(fp, "\t%d\t%d\t%d\tpsFillwOutline\n", numberOfPoints, points[i].x, points[i].y); - return (fclose(fp)); } -/* - * This function does what XDraw would do, notice that only a subset of - * attributes in GC is implemented -- adequate for our purpose now - */ -int -PSDrawColor( +@ +\subsection{PSDrawColor} +\label{PSDrawColor} +\index{gdraws!PSDrawColor} +This function does what XDraw would do, notice that only a subset of +attributes in GC is implemented -- adequate for our purpose now +<>= + +int PSDrawColor( float r, float g, float b, /* red, green and blue color components */ XPoint *points, /* point list */ int numberOfPoints) /* vertex count and display flag (X, PS,...) */ { int i = 0; FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "GDraw cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[drawcolorps].flag = yes; /* set procedure flag */ - fprintf(fp, "\t%f\t%f\t%f\tsetrgbcolor\n", r, g, b); - i = numberOfPoints - 1; while (i > 0) { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i=i-1; } - - fprintf(fp, "\t%d\t%d\t%d\tpsDrawColor\n", numberOfPoints, points[i].x, points[i].y); - + fprintf(fp, "\t%d\t%d\t%d\tpsDrawColor\n", + numberOfPoints, points[i].x, points[i].y); return (fclose(fp)); } -/* - * PSFillPolygon draws and fills a polygon given data in XPoint; see - * XFillPolygon. - */ -int -PSFillPolygon( +@ +\subsection{PSFillPolygon} +\label{PSFillPolygon} +\index{gdraws!PSFillPolygon} +PSFillPolygon draws and fills a polygon given data in XPoint. +(See \ref{XFillPolygon} on page~\pageref{XFillPolygon}). +<>= + +int PSFillPolygon( GC gc, /* graphics context */ XPoint * points, /* vertices of polygon */ int numberOfPoints) /* number of points */ { int i = 0; FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSFillPolygon cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[fillpolyps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\n", PSfindGC(gc)); - i = numberOfPoints - 1; while (i > 0) { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i = i-1; } - - fprintf(fp, "\t%d\t%d\t%d\tpsFillPoly\n", numberOfPoints, points[i].x, points[i].y); - + fprintf(fp, "\t%d\t%d\t%d\tpsFillPoly\n", + numberOfPoints, points[i].x, points[i].y); return (fclose(fp)); } -/* - * PSFillwOutline draws and also outlines the filled polygon. - */ +@ +\subsection{PSFillwOutline} +\label{PSFillwOutline} +\index{gdraws!PSFillwOutline} +PSFillwOutline draws and also outlines the filled polygon. +<>= -int -PSFillwOutline( +int PSFillwOutline( GC gc, /* graphics context */ XPoint * points, /* vertices of polygon */ int numberOfPoints) /* number of points */ -{ - int i = 0; +{ int i = 0; FILE *fp; - if ((fp = fopen(psData[scriptps].filename, "a")) == NULL) { fprintf(stderr, "PSDrawFOL cannot open %s\n", psData[scriptps].filename); return (psError); } - psData[fillwolps].flag = yes; /* sets procedure flag */ fprintf(fp, "\t%s\n", PSfindGC(gc)); - i = numberOfPoints - 1; while (i > 0) { fprintf(fp, "\t%d\t%d\n", points[i].x, points[i].y); i = i-1; } - fprintf(fp, "\t%d\t%d\t%d\tpsFillwOutline\n", numberOfPoints, points[i].x, points[i].y); - return (fclose(fp)); } -static int -TrivEqual(Window s1,Window s2) -{ + +@ +\subsection{TrivEqual} +\label{TrivEqual} +\index{gdraws!TrivEqual} +<>= + +static int TrivEqual(Window s1,Window s2) { return ( s1 == s2); } -static int -TrivHash_code(Window s,int size) -{ +@ +\subsection{TrivHashCode} +\label{TrivHashCode} +\index{gdraws!TrivHashCode} +<>= + +static int TrivHashCode(Window s,int size) { return (s % size); } +@ +\subsection{XCreateAssocTable} +\label{XCreateAssocTable} +\index{gdraws!XCreateAssocTable} +<>= -HashTable * -XCreateAssocTable(int size) -{ +HashTable *XCreateAssocTable(int size) { HashTable * table; table = (HashTable *) malloc(sizeof(HashTable)); - hash_init(table,size,(EqualFunction)TrivEqual,(HashcodeFunction)TrivHash_code); + hash_init(table,size,(EqualFunction)TrivEqual, + (HashcodeFunction)TrivHashCode); return table; } -void -XMakeAssoc(Display * dsp, HashTable *table, Window w, int * p) -{ +@ +\subsection{XMakeAssoc} +\label{XMakeAssoc} +\index{gdraws!XMakeAssoc} +<>= + +void XMakeAssoc(Display * dsp, HashTable *table, Window w, int * p) { hash_insert(table,(char *) p, (char *) w); } -int * -XLookUpAssoc(Display * dsp, HashTable *table,Window w) -{ - return (int *) hash_find(table,(char *)w); -} +@ +\subsection{XLookUpAssoc} +\label{XLookUpAssoc} +\index{gdraws!XLookUpAssoc} +<>= -void -XDeleteAssoc(Display * dsp,HashTable * table, Window w) -{ - hash_delete(table,(char *) w); +int *XLookUpAssoc(Display * dsp, HashTable *table,Window w) { + return (int *) hash_find(table,(char *)w); } - - - - @ -\section{loadfont.c} -<>= -/* load_font for display to test out Gdraw functions in this directory */ - -<> -<> - -#include +\subsection{XDeleteAssoc} +\label{XDeleteAssoc} +\index{gdraws!XDeleteAssoc} +<>= -void -Gdraws_load_font(XFontStruct **font_info, char *fontname) -{ - if ((*font_info = XLoadQueryFont(dsply, fontname)) == NULL) { - fprintf(stderr, "cannot open font %s\n", fontname); - exit(-1); - } +void XDeleteAssoc(Display * dsp,HashTable * table, Window w) { + hash_delete(table,(char *) w); } -@ -\section{main.c} -<>= -/* main procedure to test out Gdraw functions in this directory */ -#include -<> -<> - -GC gc, gc1; -Display *dsply; -int scrn; -viewPoints *viewport; - -int psInit=no; -GCptr GChead=NULL; -char *PSfilename="OUTPUT.ps"; -char *envAXIOM; - -int -main(int argc, char **argv) -{ - XGCValues values; - - XEvent report; - int x0=0, y0=0, width=300, height=200, border=3; - - char *fontname = "6x13"; - XFontStruct *dsp_font; - - Window menu; - char *str1 = " Print out the PostScript file? ", - *str0 = "Generate a PostScript file (OUTPUT.ps)?"; - int m_width, m_height, flag=yes; - - /* open display */ - if ((dsply = XOpenDisplay(NULL)) == NULL) { - printf("Can't open display NULL\n"); - exit(-1); - } - - scrn = DefaultScreen(dsply); - - /* access font */ - Gdraws_load_font(&dsp_font, fontname); - - values.background = WhitePixel(dsply, scrn); - values.foreground = BlackPixel(dsply, scrn); - - gc = XCreateGC(dsply, RootWindow(dsply, scrn), - (GCForeground | GCBackground), &values); - PSGlobalInit(); /* must initiate before using G/PS functions */ - PSCreateContext(gc, "gc", psNormalWidth, psButtCap, - psMiterJoin, psWhite, psBlack); - XSetFont(dsply, gc, dsp_font->fid); - gc1 = XCreateGC(dsply, RootWindow(dsply, scrn), - (GCForeground | GCBackground), &values); - PSCreateContext(gc1, "gc1", psNormalWidth, psButtCap, psMiterJoin, - psWhite, psBlack); - XSetFont(dsply, gc1, dsp_font->fid); - - if (!(viewport = (viewPoints *)malloc(sizeof(viewPoints)))) { - fprintf(stderr,"Ran out of memory (malloc) trying to create a viewport.\n"); - exit(-1); - } - - viewport->titleWindow = XCreateSimpleWindow(dsply, RootWindow(dsply,scrn), - x0, y0, width+6, - height+32+height/4, border, - BlackPixel(dsply, scrn), - WhitePixel(dsply, scrn)); - - viewport->viewWindow = XCreateSimpleWindow(dsply, viewport->titleWindow, - x0, y0+20, width, height, border, - BlackPixel(dsply, scrn), - WhitePixel(dsply, scrn)); - - strcpy(viewport->title, "what is a test title?"); - - m_width = width; m_height = height/4; - menu = XCreateSimpleWindow(dsply, viewport->titleWindow, x0, y0+20+height+6, - m_width, m_height, border, - BlackPixel(dsply,scrn), WhitePixel(dsply,scrn)); - - XSelectInput(dsply, viewport->viewWindow, - KeyPressMask|ButtonPressMask|ExposureMask); - XSelectInput(dsply, viewport->titleWindow, KeyPressMask|ExposureMask); - XSelectInput(dsply, menu, KeyPressMask|ButtonPressMask|ExposureMask); - - XMapWindow(dsply, viewport->viewWindow); - XMapWindow(dsply, viewport->titleWindow); - XFlush(dsply); - - while (yes) { - XNextEvent(dsply, &report); - switch (report.type) { - - case Expose: - if (report.xexpose.window==viewport->titleWindow) { - if (GDrawImageString(gc, viewport->titleWindow, - 20, 15, viewport->title, - strlen(viewport->title),X) == psError) - printf("screen draw image string failed.\n"); - if (Gdraws_data(X) == psError) - printf("screen Gdraws_data failed.\n"); - } - if (report.xexpose.window==viewport->viewWindow) { - if (Gdraws_data(X) == psError) - printf("screen Gdraws_data failed.\n"); - } - else if (report.xexpose.window==menu) { - if (flag) - Gdraws_draw_menu(menu, str0, m_width, m_height); - else - Gdraws_draw_menu(menu, str1, m_width, m_height); - } - break; - - case ButtonPress: - if (report.xbutton.window==viewport->viewWindow) { - XMapWindow(dsply, menu); - XFlush(dsply); - } - else if (report.xbutton.window==menu && flag) { - XUnmapWindow(dsply, menu); - if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, - report.xbutton.y)) { - flag=no; - XMapWindow(dsply, menu); - PSInit(viewport->viewWindow, viewport->titleWindow); - if (Gdraws_data(PS) != psError) - PSCreateFile(3,viewport->viewWindow, - viewport->titleWindow,viewport->title); - else printf("PS Gdraws_data failed.\n"); - } - } - else if (report.xbutton.window==menu && !flag) { - XUnmapWindow(dsply, menu); - if (Gdraws_pressed_yes(m_width, m_height, report.xbutton.x, - report.xbutton.y)) - system("print OUTPUT.ps"); - flag = yes; - } - break; - - case KeyPress: - if (report.xkey.window==viewport->viewWindow || - report.xkey.window==viewport->titleWindow) { - XFreeGC(dsply, gc); - XFreeGC(dsply, gc1); - XCloseDisplay(dsply); - PSClose(); - exit(1); - } - else if (report.xkey.window==menu) XUnmapWindow(dsply, menu); - - default: - break; - } - } - return 0; -} @ \section{gdraws Makefile} \subsection{environment variables} @@ -24797,36 +27633,6 @@ ${PS}/setup.ps: ${BOOK} @ ${TANGLE} -R"gdraws/psfiles/setup" ${BOOK} >${PS}/setup.ps @ -\section{menu.c} -<>= -/* menu of display used for testing out Gdraw functions in this directory */ -<> -<> - -extern GC gc; - -void -Gdraws_draw_menu(Window menu, char *str, int width, int height) -{ - char *str1 = "y e s", *str2 = "n o"; - int x0=0, y0=0; - - XDrawString(dsply, menu, gc, 30, height/4+3, str, strlen(str)); - - XFillArc(dsply, menu, gc, 35, height/3+5, width/2-50, height/3*2-10, - 0*64, 360*64); - - XFillArc(dsply, menu, gc, width/2+5, height/3+5, width/2-50, height/3*2-10, - 0*64, 360*64); - - XSetForeground(dsply, gc, WhitePixel(dsply, scrn)); - XDrawString(dsply, menu, gc, width/4-5, height/3*2+3, str1, strlen(str1)); - XDrawString(dsply, menu, gc, width/4*3-28,height/3*2+3, str2, strlen(str2)); - XSetForeground(dsply, gc, BlackPixel(dsply, scrn)); - - XFlush(dsply); -} -@ \section{The postscript command definitions} \subsection{colorpoly} \begin{verbatim} @@ -25444,22 +28250,653 @@ region with background color (default: 1, or white). mark %% mark bottom of our stack @ -\section{yesorno.c} -<>= -/* - * Decides if mouse click was in yes or no region; used by program to test - * out Gdraw functions in this directory. - */ +\chapter{The APIs} +\label{TheAPIs} +\section{Graphics API} -<> +\subsection{XDrawString} +\label{XDrawString} +\index{X11!XDrawString} +XDrawString draws an 8-bit text string, foreground only. +\begin{verbatim} +XDrawString (Display *display, Drawable drawable, GC gc, + int x, int y, char *string, int length); +\end{verbatim} -int -Gdraws_pressed_yes(int win_width, int win_height, int x, int y) -{ - return (x < win_width / 2) ? yes : no; -} -@ +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x} -- +Specify the x coordinate of the baseline starting position for +the character, relative to the origin of the specified drawable. +\item {\tt y} -- +Specify the y coordinate of the baseline starting position for +the character, relative to the origin of the specified drawable. +\item {\tt string} -- Specifies the character string. +\item {\tt length} -- +Specifies the number of characters in the string argument. +\end{itemize} + +XDrawString draws the given string into a drawable using the +foreground only to draw set bits in the font. It does not affect any +other pixels in the bounding box for each character. The y coordinate +defines the baseline row of pixels while the x coordinate is the point +for measuring the ibearing, rbearing, and width from. + +XDrawString uses these graphics context component: function, +plane\_mask, fill\_style, font, subwindow\_mode, clip x origin, +clip\_y\_origin, and clip\_mask. This function also uses these graphics +context mode-dcpendent components: foreground, tile, stipple, ts x +origin, and ts\_y\_origin. Each character image, as defined by the font +in gc, is treated as an additional mask for a fill operation on the +drawable. + +\subsection{XDrawPoint} +\label{XDrawPoint} +\index{X11!XDrawPoint} +From the Xlib Drawing Primitives, XDrawPoint draws a point. +\begin{verbatim} +XDrawPoint (Display *display, Drawable drawable, GC gc, int x, int y); +\end{verbatim} +{\bf Arguments} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x} -- +Specify the x coordinate of the point, relative to the corner of the +drawable. +\item {\tt y} -- +Specify the y coordinate of the point, relative to the corner of the +drawable. +\end{itemize} + +XDrawPoint uses the foreground pixel and function components of the +graphics con- text to draw a single point into the specified +drawable. XDrawPoint uses these graphics context components: function, +plane\_mask, foreground, subwindow\_mode, clip x origin, clip\_y\_origin, +and clip\_mask. + +\subsection{XDrawLine} +\label{XDrawLine} +\index{X11!XDrawLine} +From the Xlib Drawing Primitives, XDrawLine draws a line between two points. +\begin{verbatim} +XDrawLine(Display *display, Drawable drawable, GCgc, + int x1, int y1, int x2, int y2); +\end{verbatim} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x1} -- +Specify the x coordinate of the start point of the line relative to +the drawable origin. +\item {\tt y1} -- +Specify the y coordinate of the start point of the line relative to +the drawable origin. +\item {\tt x2} -- +Specify the x coordinate of the end point of the line relative to +the drawable origin. +\item {\tt y2} -- +Specify the y coordinate of the end point of the line relative to +the drawable origin. +\end{itemize} + +XDrawLine connects point (xl, yl) to point (x2, y2). XDrawLine uses +the components of the specified graphics context to draw a line +between two points in the specified drawable. No pixel is drawn more +than once. + +XDrawLine uses these graphics context components: function, +plane\_mask, line\_width, line\_style, cap\_style, fill\_style, +subwindow\_mode, clip\_ x\_origin, clip\_y\_origin, and +clip\_mask. XDrawLine also uses these graphics context mode-dependent +components: foreground, background, tile, stipple, ts\_x\_origin, +ts\_y\_origin, dash\_offset, and dash\_list. XDrawLine is not +affected by tile or stipple in the GC. + +\subsection{XDrawImageString} +\label{XDrawImageString} +\index{X11!XDrawImageString} +XDrawlmageString draws image text characters. +\begin{verbatim} +XDrawImageString(Display *display, Drawable drawable, GC gc, int x, int y, + char *string, int length); +\end{verbatim} + +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x} -- +Specify the x coordinate of the baseline starting position for the +image text character, relative to the origin of the specified +drawable. +\item {\tt y} -- +Specify the y coordinate of the baseline starting position for the +image text character, relative to the origin of the specified +drawable. +\item {\tt string} -- Specifies the character string +\item {\tt length} -- Specifies the number of characters in the string +\end{itemize} + +XDrawImageString uses these graphics context components: plane\_mask, +foreground, background, font, subwindow\_mode, clip x origin, +clip\_y\_origin, and clip\_mask. The function and fill\_style defined +in gc are ignored; the effective function is GXcopy and the effective +fill\_style is FillSolid. XDrawImageString first fills a destination +rectangle with the background pixel defined in gc, and then prints the +text with the foreground pixel. The upper-left corner of the filled +rectngle is at Ix, y - font\_ascent], the width is overall-width and +the height is ascent + descent. The overall-width, ascent, and +descent are as would be returned by XQuery-TextExtents using gc and +string. + + +\subsection{XFillArc} +\label{XFillArc} +\index{X11!XFillArc} +From the Xlib Drawing Primitives, XFillArc fills an arc. +\begin{verbatim} +XFillArc (Display *display, Drawable drawable, GC gc, + int x, int y, unsigned int width, unsigned int height, + int angle1, int angle2); +\end{verbatim} + +{\bf Arguments} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x} -- +Specify the x coordinate of the upper-left corner of the bounding box +containing the arc, relative to the origin of the drawable. +\item {\tt y} -- +Specify the y coordinate of the upper-left corner of the bounding box +containing the arc, relative to the origin of the drawable. +\item {\tt width} -- +Specify the width in pixels. These are the major and minor axes of the arc. +\item {\tt height} -- +Specify the height in pixels. These are the major and minor axes of the arc. +\item {\tt angle1} -- +Specifies the start of the arc relative to the three-o'clock position +from the center. Angles are specified in degrees, multiplied by 64. +\item {\tt angle2} -- +Specifies the path and extent of the arc relative to the start of the +arc. Angles are specified in degrees, multiplied by 64. +\end{itemize} + +{\bf Description} + +XFillArc fills an arc according to the arc mode in the GC. The x, y, +width, and height arguments specify the bounding box for the arc. See +XDrawArc for the description of how this bounding box is used to +compute the arc. Some, but not all, of the pixels drawn with XDrawArc +will be drawn by XFilIArc with the same arguments. The arc forms one +boundary of the area to be filled. The other boundary is determined by +the arc\_mode in the GC. If the arc\_mode in the GC is ArcChord, the +single line segment joining the endpoints of the arc is used. If +ArcPieSlice, the two line segments joining the endpoints of the arc +with the center point are used. + +XFilIArc uses these graphics context components: function, plane\_mask, +fill\_style, arc\_mode, subwindow\_mode, clip x origin, clip\_y\_origin, +and clip\_mask. This function also uses these graphics context +mode-dependent components: foreground, background, tile, stipple, ts +x origin, and ts\_y\_ origin. + +\subsection{XDrawArc} +\label{XDrawArc} +\index{X11!XDrawArc} +From the Xlib Drawing Primitives, XDrawArc draws an arc fitting inside +a rectangle. + +\begin{verbatim} +XDrawArc(Display *display, Drawable drawable, GC gc, int x, int y, + unsigned int width, unsigned int height, int angle1, int angle2); +\end{verbatim} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt drawable} -- Specifies the drawable. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt x} -- +Specify the x coordinate of the upper-left corner of the rectangle that +contains the arc, relative to the origin of the specified drawable. +\item {\tt y} -- +Specify the y coordinate of the upper-left corner of the rectangle that +contains the arc, relative to the origin of the specified drawable. +\item {\tt width} -- +Specify the width in pixels of the major and minor axes of the arc. +\item {\tt height} -- +Specify the height in pixels of the major and minor axes of the arc. +\item {\tt angle1} -- +Specifies the start of the arc relative to the three-o'clock position +from the center. Angles are specified in 64ths of a degree, (360 * 64 +is a complete circle). +\item {\tt int angle2} -- +Specifies the path and extent of the arc relative to the start of the +arc. Angles are specified in 64ths of a degree, (360 * 64 is a +complete circle). +\end{itemize} + +XDrawArc draws a circular or elliptical arc. An arc is specified by a +rectangle and two angles. The x and y coordinates are relative to the +origin of the drawable, and define the upper-left corner of the +rectangle. The center of the circle or ellipse is the center of the +rectan- gle, and the major and minor axes are specified by the width +and height, respectively. The angles are signed integers in 64ths of +a degree, with positive values indicating counter-clockwise motion +and negative values indicating clockwise motion, truncated to a +maximum of 360 degrees. The start of the arc is specified by anglel +relative to the three-o'clock position from the center, and the path +and extent of the arc is specified by angle2 relative to the start of +the arc. + +By specifying one axis to be 0, a horizontal or vertical line can be +drawn. Angles are computed based solely on the coordinate system and +ignore the aspect ratio. In other words, if the bounding rectangle of +the arc is not square and anglel is 0 and angle2 is (45x64), a point +drawn from the center of the bounding box through the endpoint of the +arc will not pass through the comer of the rectangle. + +XDrawArc uses these graphics context components: function, plane\_mask, +line\_width, line\_style, cap\_style, join\_style, fill\_style, +subwindow\_ mode, clip x origin, clip\_y\_origin, and clip\_mask. This +function also uses these graphics context mode-dependent components: +foreground, background, tile, stipple, ts x origin, ts\_y\_origin, +dash\_offset, and dash\_list. XDrawArc is not affected by the tile or +stipple in the GC. + +\subsection{XSetForeground} +\label{XSetForeground} +\index{X11!XSetForeground} +In Xlib, in the Graphics Context, +XSetForeground m set the foreground pixel value in a graphics context. +\begin{verbatim} +XSetForeground (Display *display, GC gc, unsigned long foreground); +\end{verbatim} +{\bf Arguments} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt foreground} -- +Specifies the foreground you want to set for the specified graphics context. +\end{itemize} + +\subsection{XSetBackground} +\label{XSetBackground} +\index{X11!XSetBackground} +In Xlib, in the Graphics Context, +XSetBackground m set the background pixel value in a graphics context. +\begin{verbatim} +XSetBackground (Display *display, GC gc, unsigned long background); +\end{verbatim} +{\bf Arguments} +\begin{itemize} +\item {\tt display} -- +Specifies a pointer to the Display structure; returned from XOpenDisplay. +\item {\tt gc} -- Specifies the graphics context. +\item {\tt background} -- +Specifies the background you want to set for the specified graphics context. +\end{itemize} + +\subsection{XSetLineAttributes} +\label{XSetLineAttributes} +\index{X11!XSetLineAttributes} +In Xlib, in the Graphics Context, the function XSetLineAttributes +sets four types of line characteristics in the GC: line\_width, +line\_style, cap\_style, and join\_style. +\begin{itemize} +\item {\tt line\_width} -- Specifies the line width you want to set +for the specified graphics context. A line\_width of zero (0) means +to use the fastest algorithm for drawing a line of one pixel +width. These lines may not meet properly with lines specified as width +1 or more. +\item {\tt line\_style} -- +Specifies the line style you want to set for the specified graphics context. +Possible values are LineSolid, LineOnOffDash, or LineDouble-Dash. +\item {\tt cap\_style} -- +Specifies the line and cap style you want to set for the specified graphics +context. Possible values are CapNotLast, CapButt, CapRound, or +CapProjecting. +\item {\tt join\_style} -- +Specifies the line-join style you want to set for the specified graphics con- +text. Possible values are JoinMiter, JoinRound, or JoinBevel. +\end{itemize} + +\subsection{DefaultScreen} +\label{DefaultScreen} +\index{X11!DefaultScreen} +The DefaultScreen macro returns the default screen number referenced in +the XOpenDisplay routine. + +\subsection{RootWindow} +\label{RootWindow} +\index{X11!RootWindow} + The RootWindow macro returns the root window. + +\subsection{XCreateAssocTable} +\index{X11!XCreateAssocTable} +Create a new association table (X10). Note that we have our own version +of this function. +\begin{verbatim} + XAssocTable *XCreateAssocTable(int size) +\end{verbatim} +{\bf Arguments} +\begin{itemize} +\item {\tt size} +Specifies the number of buckets in the hashed association table. +\end{itemize} +{\bf Description} +XCreateAssocTable creates an association table, which allows you to +associate your own structures with X resources in a fast lookup +table. This function is provided for compatibility with X Version +10. To use it you must include the file and link with the +library -loldX. The size argument specifies the number of buckets in +the hash system of XAssocTable. For reasons of efficiency the number +of buckets should be a power of two. Some size sugges- tions might be: +use 32 buckets per 100 objects; a reasonable maximum number of object +per buckets is 8. If there is an error allocating memory for the +XAssocTable, a NULL pointer is returned. + +{\bf Structures} +\begin{verbatim} +typedef struct { + XAssoc *buckets; /* pointer to first bucket in array */ + int size; /* table size (number of buckets) */ + } XAssocTable; +\end{verbatim} + +\subsection{XOpenDisplay} +\label{XOpenDisplay} +\index{X11!XOpenDisplay} +To open a connection to the X server that controls a display, +use XOpenDisplay(). +\begin{verbatim} + Display *XOpenDisplay(char *displayname); +\end{verbatim} +{\bf Arguments} +\begin{itemize} +\item {\tt displayname} Specifies the hardware display name, which +determines the display and communications domain to be used. On a +POSIX-conformant system, if the displayname is NULL, it defaults to +the value of the DISPLAY environment variable. +\end{itemize} + +{\bf Description} + +The encoding and interpretation of the display name is implementation +dependent. Strings in the Host Portable Character Encoding are +supported; support for other characters is implementation +dependent. On POSIX-conformant systems, the display name or DISPLAY +environment variable can be a string in the format: +\begin{verbatim} + hostname:number.screennumber +\end{verbatim} + +{\tt hostname} Specifies the name of the host machine on which the display +is physically attached. You follow the hostname with either a single +colon (:) or a double colon (::). + +{\tt number} Specifies the number of the display server on that host +machine. You may optionally follow this display number with a period +(.). A single CPU can have more than one display. Multiple displays +are usually numbered starting with zero. + +{\tt screennumber} Specifies the screen to be used on that server. Multiple +screens can be controlled by a single X server. The screennumber sets +an internal variable that can be accessed by using the DefaultScreen() +macro or the XDefaultScreen() function if you are using languages +other than C. + +For example, the following would specify screen 1 of display 0 on the +machine named ``dual-headed'': +\begin{verbatim} + dual-headed:0.1 +\end{verbatim} +The XOpenDisplay() function returns a Display structure that serves as +the connection to the X server and that contains all the information +about that X server. XOpenDisplay() connects your application to the X +server through TCP or DECnet communications protocols, or through some +local inter-process communication protocol. If the hostname is a host +machine name and a single colon (:) separates the hostname and display +number, XOpenDisplay() connects using TCP streams. If the hostname is +not specified, Xlib uses whatever it believes is the fastest +transport. If the hostname is a host machine name and a double colon +(::) separates the hostname and display number, XOpenDisplay() +connects using DECnet. A single X server can support any or all of +these transport mechanisms simultaneously. A particular Xlib +implementation can support many more of these transport mechanisms. + +If successful, XOpenDisplay() returns a pointer to a Display +structure, which is defined in X11/Xlib.h. If XOpenDisplay() does not +succeed, it returns NULL. After a successful call to XOpenDisplay() +all of the screens in the display can be used by the client. The +screen number specified in the displayname argument is returned by +the DefaultScreen() macro (or the XDefaultScreen() function). You can +access elements of the Display and Screen structures only by using the +information macros or functions. + +\section{X11 API calls} +\begin{itemize} +\item XSolidColor +\begin{itemize} +\item moColor to define the foreground color +\item moColor\_BG to define the background color +\end{itemize} +\item void XMakeAssoc(Display *,HashTable *,Window,int *); +\item int *XLookUpAssoc(Display *, HashTable *, Window); +\item void XDeleteAssoc(Display * , HashTable * , Window ); +\item XID x\_id; -- The X Window System id +\item XPoint * +\item XLoadQueryFont(dsply,xDefault) +\item XEvent +\item XClearArea(dsply,control->controlWindow,0,0,controlWidth,potA,False); +\item XWindowAttributes cwInfo; +\item XGetWindowAttributes(dsply,cp->controlWindow,\&cwInfo); +\item XFlush(dsply); +\item XQueryTree(dsply,tmpW,\&rootW,\&parentW,\&childrenWs,\&nChildren); +\item XFree(childrenWs); +\item XSetWindowAttributes cwAttrib, controlAttrib; +\item XSizeHints sizehints; +\item XColor foreColor, backColor; +\item XCreateBitmapFromData(dsply,rtWindow,mouseBitmap\_bits, + mouseBitmap\_width,mouseBitmap\_height); +\item XQueryColor(dsply,colorMap,\&foreColor); +\item XCreatePixmapCursor(dsply,mousebits,mousemask, + \&foreColor,\&backColor, + mouseBitmap\_x\_hot,mouseBitmap\_y\_hot); +\item XCreateWindow(dsply,rtWindow, + cXY.putX,cXY.putY,controlWidth,controlHeight,3, + CopyFromParent,InputOutput,CopyFromParent, + controlCreateMASK,\&cwAttrib); +\item XSetNormalHints(dsply,cw,\&sizehints); +\item XSetStandardProperties(dsply,cw,"2D Control Panel","2D Control Panel", + None,NULL,0,\&sizehints); +\item XMakeAssoc(dsply,table,(control->buttonQueue[i]).self, + \&((control->buttonQueue[i]).buttonKey)); +\item XMapWindow(dsply,(control->buttonQueue[i]).self); +\item XRaiseWindow(dsply,control->controlWindow); +\item XMoveWindow(dsply,control->controlWindow,whereControl.putX, + whereControl.putY); +\item XClearArea(dsply,viewport->controlPanel->controlWindow, + 0,controlMessageY-2,controlWidth,controlMessageHeight,False); +\item XFontStruct *globalFont,*buttonFont,*headerFont,*titleFont, +\item XrmDatabase rDB; -- X resource database +\item XrmValue value; +\item XGCValues gcVals; +\item (XArc *)malloc(xPointsNeeded * sizeof(XArc)) +\item XSetFont(dsply,gc,font->fid) +\item XCreateAssocTable(nbuckets); +\item XInitSpadFill(dsply,scrn,\&colorMap, + \&totalHues,\&totalSolidShades, + \&totalDitheredAndSolids,\&totalShades); +\item XQueryFont(dsply,XGContextFromGC(DefaultGC(dsply,scrn))); +\item XrmGetResource(rDB, + "Axiom.2D.messageFont", + "Axiom.2D.Font", + str\_type, \&value) == True) +\item XLoadQueryFont(dsply, prop) +\item XCreateGC(dsply,rtWindow,GCForeground | GCBackground , + \&controlGCVals); +\item XrmInitialize(); +\item XrmGetFileDatabase(name); +\item XrmMergeDatabases(applicationDB, \&rDB); +\item XResourceManagerString(dsply) +\item XrmGetStringDatabase(XResourceManagerString(dsply)); +\item XResourceManagerString(dsply) +\item XSync(dsply,False); +\item XUnmapWindow(dsply,control->controlWindow); +\item XWindowAttributes graphWindowAttrib; +\item Xcon = ConnectionNumber(dsply); +\item XEventsQueued(dsply, QueuedAlready) +\item XPending(dsply) +\item XNextEvent(dsply,event); +\item (XButtonEvent *)event +\item (XEvent *)event) +\item XCheckWindowEvent(dsply, + viewport->titleWindow, + ExposureMask, + \&tempEvent); +\item XGetWindowAttributes(dsply, + whichWindow, + \&graphWindowAttrib); +\item XResizeWindow(dsply, + viewport->viewWindow, + graphWindowAttrib.width, + graphWindowAttrib.height-titleHeight); +\item XMapWindow(dsply,whichWindow); +\item XCheckMaskEvent(dsply, + ButtonMotionMask, + event)); +\item (XButtonEvent *)event) +\item XFlush(dsply); +\item XUnmapWindow(dsply,control->controlWindow); +\item XLookUpAssoc(dsply,table,whichWindow)); +\item XMoveWindow(dsply,viewport->titleWindow,i1,i2); +\item XResizeWindow(dsply,viewport->titleWindow,i1,i2+titleHeight); +\item XFreeGC(dsply,globalGC1); +\item XFreeFont(dsply,globalFont); +\item XFreeColormap(dsply,colorMap); +\item XCloseDisplay(dsply); +\item XWindowAttributes attribInfo; +\item XClearWindow(dsply,viewport->titleWindow); +\item XCharStruct overall; +\item XTextExtents(unitFont,"o",1,\&dummyInt,\&ascent,\&descent,\&overall); +\item XSolidColor((int)(aPoint->hue),(int)(aPoint->shade)), +\item XTextWidth(unitFont,aunit,strlength)/2; +\item Xoption +\item XSizeHints titleSizeHints,viewSizeHints; +\item XSetWindowAttributes viewAttrib; +\item XColor foreColor, backColor; +\item XQueryColor(dsply,colorMap,\&foreColor); +\item XInternAtom(dsply, "WM\_DELETE\_WINDOW", False); +\item XSetWMProtocols(dsply, viewTitleWindow, \&wm\_delete\_window, 1); +\item XSetNormalHints(dsply,viewTitleWindow,\&titleSizeHints); +\item XSetStandardProperties(dsply,viewTitleWindow,"Axiom 2D",viewport->title, + None,NULL,0,\&titleSizeHints); +\item XWriteBitmapFile(dsply,viewBitmapFilename, + viewport->titleWindow,vwInfo.width, + vwInfo.height+vwInfo.border\_width+20,-1,-1); +\item XResizeWindow(dsply,viewport->titleWindow,300,300+titleHeight); +\item XDeleteAssoc(dsply,table,(control->buttonQueue[i]).self); +\item XDestroyWindow(dsply,control->controlWindow); +\item XCreateImage(/* display */ dsply, + /* visual */ DefaultVisual(dsply,scrn), + /* depth */ DefaultDepth(dsply,scrn), + /* format */ ZPixmap, + /* offset */ 0, + /* data */ NULL, + /* width */ vwInfo.width, + /* height */ 1, + /* bitmap\_pad */ 32, + /* bytes\_per\_line */ 0); +\item XImage slicer\_image\_stuff +\item XSizeHints sizehint; +\item XGetImage(dsply, slicer\_pixmap, 0, 0, slicer\_width, slicer\_height, + AllPlanes, ZPixmap); +\item XSetFunction(dsply, contourGC, GXcopy); +\item XDrawRectangle(dsply,contourWindow, contourGC /* ZZZ */, + (control->buttonQueue[i]).buttonX, + (control->buttonQueue[i]).buttonY, + (control->buttonQueue[i]).buttonWidth, + (control->buttonQueue[i]).buttonHeight); +\item XClearArea(dsply, contourWindow, long\_str\_X, long\_str\_Y - 12, + long\_W + 50, 18, False); +\item XDrawString(dsply, contourWindow, anotherGC, + long\_str\_X, long\_str\_Y, + stringo, strlen(stringo)); +\item XDrawArc(dsply, contourWindow, contourGC /* ZZZ */, + long\_corner\_X, long\_corner\_Y, + long\_W, long\_H, + 0, 360*64); +\item XDrawLine(dsply, contourWindow, +\item XFillArc(dsply, contourWindow, contourGC /* ZZZ */, + tip\_x - (dotSize>>1), tip\_y - (dotSize>>1), + dotSize, dotSize, + 0, 360*64); +\item XPutImage(dsply, contourWindow, contourGC, + slicer\_image, + 0, 0, + slicer\_image\_X, + slicer\_image\_Y, + slicer\_width, slicer\_height); +\item XChangeShade(dsply, i); +\item XShadeRectangle(dsply,cp->controlWindow, + colormapX + colorOffsetX + i*shadeWidth, + colormapY + colorOffsetY - 10, shadeWidth, 40); +\item XFree(childrenWs); +\item XPoint *quadMesh; +\item XGetErrorText(display,event->error\_code,buffer,511); +\item XSetErrorHandler(the\_handler); +\item XCreateAssocTable(nbuckets); +\item XInitSpadFill(dsply,scrn,\&colorMap, + \&totalHues,\&totalSolidShades, + \&totalDitheredAndSolids,\&totalShades); +\item XInitShades(dsply,scrn) ; +\item XGContextFromGC(DefaultGC(dsply,scrn)) +\item XCreatePixmap(dsply,viewport->viewWindow, + vwInfo.width,vwInfo.height, + DisplayPlanes(dsply,scrn)); +\item .Xdefaults +\item XQueryPointer(dsply,rtWindow,\&dummy,\&dummy,\&px,\&py,\&lx,\&ly,\&lbuttons); +\item XPixelColor((int)colorindx-1) +\item XCreatePixmap(/* display */ dsply, + /* drawable */ viewport->viewWindow, + /* width */ vwInfo.width, + /* height */ vwInfo.height, + /* depth */ DefaultDepth(dsply,scrn)); +\item XFillRectangle(dsply,viewmap,trashGC,0,0,vwInfo.width,vwInfo.height); +\item XPutPixel(imageX,i,0,foregroundColor); +\item XPutImage(dsply,viewport->viewWindow,trashGC,imageX,0,0,0, + scanline,vwInfo.width,1); +\item XDestroyImage(imageX); +\item XCopyArea(dsply,viewmap,viewport->viewWindow,trashGC,0,0, + vwInfo.width,vwInfo.height,0,0); +\item XCopyArea(dsply,viewmap,viewport->viewWindow,trashGC,0,0, + vwInfo.width,vwInfo.height,0,0); +\item XFillPolygon(dsply, viewport->viewWindow, aGC, quadMesh, p->numpts, + Convex,CoordModeOrigin); +\item XPeekEvent(dsply,\&peekEvent); +\item XDrawLines(dsply, wid, gc, points, numberOfPoints, mode); +\item XGContextFromGC(viewGCx); +\item (impl) XCreateAssocTable(int size) +\item (impl) XMakeAssoc(Display * dsp, HashTable *table, Window w, int * p) +\item (impl) XLookUpAssoc(Display * dsp, HashTable *table,Window w) +\item (impl) XDeleteAssoc(Display * dsp,HashTable * table, Window w) +\item XSelectInput(dsply, menu, KeyPressMask|ButtonPressMask|ExposureMask); +\end{itemize} \chapter{Makefile} +\label{Makefile} <<*>>= BOOK=${SPD}/books/bookvol8.pamphlet @@ -25531,8 +28968,8 @@ ISBN 0-387-97855-0 Center for the Study of Language and Information ISBN 0-937073-81-4 Stanford CA (1992) -\bibitem{3} Page, William, ``The Axiom Wiki Website''\\ -{\bf http://wiki.axiom-developer.org} +\bibitem{3} Daly, Timothy, ``The Axiom Website''\\ +{\bf http://axiom.axiom-developer.org} \bibitem{4} Watt, Stephen, ``Aldor'',\\ {\bf http://www.aldor.org} \bibitem{5} Lamport, Leslie, ``Latex -- A Document Preparation System'', diff --git a/changelog b/changelog index ecc0ca2..e5db776 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,4 @@ +20080611 tpd books/bookvol8 add documentation for gdraws 20080610 tpd books/Makefile stop redundant builds 20080610 tpd books/bookvol7 remove bookvol11 handling 20080610 tpd books/bookvol11 update the Makefile