/************************************************************************ ** ** FILE : hagraph.c ** ** ZWECK : ** ** AUTOR : Michael C. Ancutici ** Universitaet Stuttgart, Fakultaet Informatik ** ** DATUM : 14.03.93 ** *************************************************************************/ #include "hagraph.h" #include "hawin.h" #include "misc.h" #include "colors" #include "netsize.h" /************************************************************************* ** FUNKTION: HaClearPlane ** ZWECK: ** EINGABE: ** AUSGABE: ** ANMERK: *************************************************************************/ #define HaClearPlane() XFillRectangle( MyDisplay, \ HaGraphPixmap, \ ClearGC, \ 0,0, \ PLANE_WIDTH, PLANE_HEIGHT) /************************************************************************* ** FUNKTION: HaGetPixel ** ZWECK: ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ unsigned long HaGetPixel( CName) char *CName; { XColor exact, color; if (!XAllocNamedColor ( MyDisplay, CMap, CName, &exact, &color)); /* Fehler: keine Farballokierung */ return (color.pixel); } /************************************************************************* ** FUNKTION: HaSetLineWidth ** ZWECK: ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaSetLineWidth( gc1, gc2, i) GC gc1, gc2; int i; { XSetLineAttributes( MyDisplay, gc1, i, LineSolid, CapRound, JoinMiter); XSetLineAttributes( MyDisplay, gc2, i, LineSolid, CapRound, JoinMiter); } /************************************************************************* ** FUNKTION: HaCreateGC ** ZWECK: ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaCreateGC( hGC, Fore, Back, Func) GC *hGC; unsigned long Fore, Back; int Func; { *hGC = XCreateGC( MyDisplay, HaGraphPixmap, 0,0); XSetForeground( MyDisplay, *hGC, Fore); XSetBackground( MyDisplay, *hGC, Back); XSetFunction( MyDisplay, *hGC, Func); } /************************************************************************* ** FUNKTION: HaGraphInit ** ZWECK: ** EINGABE: ** AUSGABE: ** RETURN: ** ANMERK: *************************************************************************/ void HaGraphInit() { XGCValues Values; unsigned long InversMask; MyDisplay = XtDisplay( HaShell); MyScreen = DefaultScreen( MyDisplay); MyDepth = DefaultDepth( MyDisplay, MyScreen); CMap = DefaultColormap( MyDisplay, MyScreen); HaBackColor = HaGetPixel( BACKGROUND_COLOR); HaModColor = HaGetPixel( MOD_COLOR); HaGraphPixmap = XCreatePixmap( MyDisplay, RootWindowOfScreen( XtScreen( HaShell)), PLANE_WIDTH, PLANE_HEIGHT, MyDepth); /**** CREATE GC's ****************************************/ HaCreateGC( &ModGC, HaModColor, 0, GXor); HaCreateGC( &ClearGC, HaBackColor, HaBackColor, GXcopy); HaCreateGC( &InvClearGC, 0, 0, GXcopy); /**** CREATE INVERS GC ***************************************/ HaCreateGC( &InversGC, 0xffffffff, 0, GXxor); InversMask = HaModColor ^ HaBackColor; XSetPlaneMask( MyDisplay, InversGC, InversMask); HaMarkeFont = XLoadQueryFont (MyDisplay, "-*-*-bold-r-*-*-14-*-*-*-*-*-*-*"); HaNameFont = XLoadQueryFont (MyDisplay, "-*-*-bold-r-*-*-12-*-*-*-*-*-*-*"); HaClearPlane(); }