#include #include #include #include "rgraph.h" #include #include #include /* attention couleur */ #include /* attention resource */ #define windowID 1000 extern char* errbuf; /* event?*/ #include "Events.h" /*static float aspx, aspy, echx,echy,ech,rxmin,rxmax,rymin,rymax;*/ static int carre, lacouleur; static WindowRecord wgRecord0; static WindowPtr grafWindow0; static Rect boundsRect; int getcolor(); /*int scalx(float x); int scaly(float y);*/ void initgraphique(void) { /* ancien boundsRect.top = 45; boundsRect.left = 15; boundsRect.right = 460; boundsRect.bottom = 460 ; grafWindow0=NewCWindow(&wgRecord0, &boundsRect, "\pGraphics",true, 8, NULL, true, 0);*/ /* nouveau dans la ressource */ grafWindow0=GetNewCWindow(windowID, nil, (WindowPtr) -1); DrawControls(grafWindow0); /* std*/ SetPort(grafWindow0); ShowWindow(grafWindow0); BringToFront(grafWindow0); /* aspx = boundsRect.right - boundsRect.left -10; aspy = boundsRect.bottom - boundsRect.top - 10; carre = aspx == aspy;*/ lacouleur = getcolor(); } /*---------------------------------------------------*/ void sbe(void) { SendBehind(grafWindow0, nil ); } /*---------------------------------------------------*/ void sbf(void) { BringToFront(grafWindow0); } /*---------------------------------------------------*/ void closegraphique(void) { CloseWindow(grafWindow0); } /*---------------------------------------------------*/ void reffecran(void) { EraseRect(&(grafWindow0->portRect)); } /*---------------------------------------------------*/ int getcolor(void) { } /*---------------------------------------------------*/ void putpixel(int ix,int iy, int couleur) { PmForeColor(couleur); MoveTo(ix, iy); LineTo(ix,iy); /* MainEvent(); */ } /*---------------------------------------------------*/ void metpoint(float xbas,float ybas,float xhaut,float yhaut, int npix,int npiy,float x,float y,int c) { int ix,iy; if (c>150){c=c-149;} if (c>150){c=c-149;} ix=npix*(x-xbas)/(xhaut-xbas); iy=npiy-npiy*(y-ybas)/(yhaut-ybas); /*printf(" %6i %6i %6f %6f \n",ix,iy,x,y); poynte(ix,iy);*/putpixel(ix,iy,c); } /*---------------------------------------------------*/ void metligne(float xbas,float ybas,float xhaut,float yhaut, int npix,int npiy,float x1,float y1,float x2,float y2,int c) { int ix1,iy1,ix2,iy2; if (c>150){c=c-149;} if (c>150){c=c-149;} ix1=npix*(x1-xbas)/(xhaut-xbas); iy1=npiy-npiy*(y1-ybas)/(yhaut-ybas); ix2=npix*(x2-xbas)/(xhaut-xbas); iy2=npiy-npiy*(y2-ybas)/(yhaut-ybas); /*printf(" %6i %6i %6f %6f \n",ix,iy,x,y); poynte(ix,iy);*/ PmForeColor(c); MoveTo(ix1, iy1); LineTo(ix2,iy2); } /*---------------------------------------------------*/ void MainEvent(void) { EventRecord event; Boolean eventOccured; /*KeyPressed = false; */ /* set to false every time through */ /*if(WNE_available) eventOccured = WaitNextEvent(everyEvent,&event,10,nil); else { SystemTask();*/ eventOccured = GetNextEvent(everyEvent, &event); /*}*/ /* if(eventOccured) { switch(event.what) { case nullEvent: break; case mouseDown: DoClick(&event); break; case mouseUp: break; case keyDown: DoKey(&event); break; case keyUp: break; case autoKey: DoKey(&event); break; case updateEvt: DoUpdate(&event); break; case diskEvt: break; case activateEvt: DoActivate(&event); break; case networkEvt: break; case driverEvt: break; case app1Evt: break; case app2Evt: break; case app3Evt: break; case osEvt: DoMFinder(&event); break; default: break; } }*/ } /*---------------------------------------------------*/