//Marcus Daniels Sept. 21, 1999 swarm-support list WS> I may be missing something, but the following code (swarm 1.4.1) WS> to draw a rectangle seems to ignore my y1 coordinate, and computes WS> another so I obtain a square with size (x1-x0), with top-left WS> positioned at (x0,y0). (x1,y1) is supposed to be bottom-right. This works for me with 2.0.1 on Windows and X11. (That problem was fixed shortly after the 1.4.1 release.) #import #import #import #import // getZone #define XSIZE 200 #define YSIZE 200 BOOL quitFlag = NO; @interface MyClass: SwarmObject { id colormap; id raster; id panel; } - drawRectangle; @end @implementation MyClass - exit { quitFlag = YES; return self; } - drawRectangle { [raster erase]; [raster rectangleX0: 50 Y0: 50 X1: 150 Y1: 100 Width: 1 Color: 1]; [raster drawSelf]; return self; } - zoomIn { [raster increaseZoom]; [self drawRectangle]; return self; } - zoomOut { [raster decreaseZoom]; [self drawRectangle]; return self; } - createEnd { colormap = [Colormap create: getZone (self)]; [colormap setColor: 0 ToName: "red"]; [colormap setColor: 1 ToName: "green"]; raster = [ZoomRaster create: getZone (self)]; [raster setColormap: colormap]; [raster setWidth: XSIZE Height: YSIZE]; [raster setWindowTitle: "Raster"]; [raster setZoomFactor: 1]; [raster pack]; panel = [ButtonPanel createBegin: getZone (self)]; [panel setButtonTarget: self]; panel = [panel createEnd]; [panel setWindowTitle: "ControlPanel"]; [panel addButtonName: "ZoomIn" method: @selector (zoomIn)]; [panel addButtonName: "ZoomOut" method: @selector (zoomOut)]; [panel addButtonName: "Exit" method: @selector (exit)]; return self; } @end int main (int argc, const char **argv) { id mainObj; initSwarm (argc, argv); mainObj = [MyClass create: globalZone]; [mainObj drawRectangle]; while (!quitFlag) { while (GUI_EVENT_ASYNC ()) {} } } /* Local Variables: compile-command: "$SWARMHOME/bin/libtool-swarm --mode=link gcc -DDLL -o rectangle -g -Wno-import -I$SWARMHOME/include -L$SWARMHOME/lib rectangle.m -lswarmdll -lobjcdll" End: */