7 #include "parameter.hh"
9 static Parameter<int> x11size("x11size", "X11 window size", 500, 100, 10, 10000);
11 X11Output::X11Output() {
13 display= XOpenDisplay(0);
14 window= XCreateSimpleWindow(display,
15 DefaultRootWindow(display),
16 0,0, x11size,x11size, 0,0,0);
17 gcvalues.background= 0;
18 fabric= XCreateGC(display,window,GCBackground,&gcvalues);
19 gcvalues.foreground= 1;
20 gcvalues.background= 1;
21 mesh= XCreateGC(display,window,GCForeground|GCBackground,&gcvalues);
22 XSelectInput(display,window,0);
23 XMapWindow(display,window);
27 void X11Output::startimage() {
28 XClearWindow(display,window);
31 void X11Output::endimage() {
35 X11Output::~X11Output() {
36 XCloseDisplay(display);
39 void X11Output::drawcell(const Point* list, int n) {
41 for (int i=0; i<n; i++) {
42 Onscreen here= Onscreen(list[i]);
43 xp[i].x= (int)((here.x+1.0)*(x11size*0.5));
44 xp[i].y= (int)((-here.y+1.0)*(x11size*0.5));
46 XFillPolygon(display,window,fabric,xp,n,Nonconvex,CoordModeOrigin);
48 XDrawLines(display,window,mesh,xp,n+1,CoordModeOrigin);