swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing on ZoomRaster


From: Marcus G. Daniels
Subject: Re: drawing on ZoomRaster
Date: 21 Jan 1999 08:34:40 -0800

>>>>> "JM" == Marshall James <address@hidden> writes:

JM> the coordinates given are within the
JM> limits of the ZoomRaster, and I call [display drawSelf] after, yet
JM> no ellipses appear on my ZoomRaster! Can anyone suggest why this
JM> might be?

Colormap entry is the same as the background color?
Too big of a zoom?

Anyway, here's a test program that demonstrates ZoomRaster and
ellipses. 

#import <objectbase/SwarmObject.h>
#import <simtools.h>
#import <gui.h>
#import <random.h>

#define XSIZE 100
#define YSIZE 100

@interface MyClass: SwarmObject
{
  id <Colormap> colormap;
  id <ZoomRaster> raster;
  id <ButtonPanel> panel;
}
- drawEllipse;
@end

@implementation MyClass

- exit
{
  exit (0);
}

- drawEllipse
{
  int yradius = [uniformIntRand getIntegerWithMin: 0 withMax: 50];
  int xradius = [uniformIntRand getIntegerWithMin: 0 withMax: 50];
  int x0 = 50 - xradius;
  int y0 = 50 - xradius;
  int x1 = 50 + yradius;
  int y1 = 50 + yradius;

  [raster erase];
  [raster ellipseX0: x0 Y0: y0 X1: x1 Y1: y1 Width: 1 Color: 1];
  [raster drawSelf];

  return self;
}

- zoomIn
{
  [raster increaseZoom];
  [self drawEllipse];

  return self;
}

- zoomOut
{
  [raster decreaseZoom];
  [self drawEllipse];

  return self;
}

- createEnd
{ 
  id <Zone> aZone = [self getZone];

  colormap = [Colormap create: aZone];
  [colormap setColor: 0 ToName: "green"];
  [colormap setColor: 1 ToName: "orange"];
  
  raster = [ZoomRaster create: aZone];
  [raster setColormap: colormap];
  [raster setWidth: XSIZE Height: YSIZE];
  [raster setWindowTitle: "Raster"];
  [raster setZoomFactor: 1];
  [raster pack];
  
  panel = [ButtonPanel createBegin: [self getZone]];
  [panel setButtonTarget: self];
  panel = [panel createEnd];
  [panel setWindowTitle: "ControlPanel"];
  [panel addButtonName: "ZoomIn" method: @selector (zoomIn)];
  [panel addButtonName: "ZoomOut" method: @selector (zoomOut)];
  [panel addButtonName: "Redraw" method: @selector (drawEllipse)];
  [panel addButtonName: "Exit" method: @selector (exit)];
  
  return self;
}
@end

main (int argc, const char **argv)
{ 
  id mainObj;

  initSwarm (argc, argv);

  mainObj = [MyClass create: globalZone];
  [mainObj drawEllipse];

  while (1) { while (GUI_EVENT_ASYNC ()) {} }
}

/*
Local Variables:
compile-command: "/opt/gnu/bin/gcc -V 2.7.2.3 -o zr -g -Wno-import 
-L/opt/SUNWtcl/8.0/sun4/lib -R/opt/SUNWtcl/8.0/sun4/lib -L/opt/SDGblt/2.4f/lib 
-R/opt/SDGblt/2.4f/lib -L/opt/SDGlibffi/1.20/lib -R/opt/SDGlibffi/1.20/lib 
-L/opt/SDGswarm/1.3.1/lib -L/opt/SDGzlib/1.1.3/lib -L/usr/local/X11/lib 
-L/usr/openwin/lib -R/usr/openwin/lib -L/usr/local/lib 
-I/opt/SDGswarm/1.3.1/include zr.m  -lsimtools -lsimtoolsgui -lactivity 
-ltkobjc -lrandom -lobjectbase  -ldefobj -lcollections -lmisc  -ltclobjc 
-ltk8.0 -ltcl8.0 -lBLT -lsocket -ldl -lnsl -L/opt/X11R6/lib -lpng -lz -lXpm 
-lX11 -lffi -lm -lobjc"
End:
*/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]