swarm-support
[Top][All Lists]
Advanced

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

drawing pixmaps on rasters


From: Aris Alissandrakis
Subject: drawing pixmaps on rasters
Date: Sun, 12 Jan 2003 18:37:54 -0000

Hello,

In my swarm simulation, every agent has its own display and raster. For demo
purposes,  I want to make some movies of simulation runs. I can capture each
individual display into a pixmap and then get lots of png files to make
movies of the events on each display, but I would like to somehow combine
all the displays in one (bigger) display which I can then save and make a
movie that shows what all the agents do at the same time...

So I thought of capturing the agent rasters into pixmaps, and drawing them
(placed appropriately) on another (larger) raster which I can then capture
as a pixmap and save into a png file...

My code looks like this:

first I create the bigger raster for the movie:

      movieRaster = [Raster createBegin: [self getZone]];
      [movieRaster setWindowGeometryRecordName: "something"];
      [movieRaster createEnd];
      [movieRaster setColormap: colormap];
      [movieRaster setWidth: 480 Height: 560];
      [movieRaster pack];

then I create a pixmap that captures the agent raster,

      aPic = [Pixmap createBegin: [self getZone]];
      [aPic setWidget: anAgentRaster]; //captures the agent raster
      [aPic setDecorationsFlag: YES];
      aPic = [aPic createEnd];

and then I try to draw the pixmap into my big movie raster:

      [aPic setRaster: movieRaster];
      [aPic drawX:10 Y:10];

or I could also/either do this:

      [movieRaster draw: aPic X: 30 Y: 50];

if I save the *agent pixmap*, the resulting png file is fine...

      [aPic save: filename];
      [aPic drop];

but...

      moviePixmap = [Pixmap createBegin: [self getZone]];
      [moviePixmap setWidget: movieRaster];
      moviePixmap = [moviePixmap createEnd];

      [moviePixmap save: differentFilename];
      [moviePixmap drop];

      [movieRaster drop];

...my problem is that when the movieRaster/Pixamp is drawn/saved,
instead of containing the (smaller) agent rasters drawn at the (10,10)
or (30,50) coordinates, I only get white dots there!
(see .png file attached)

Therefore I must be missing something, but I can't think of anything...
Perhaps when I capture the agent raster? But this gets saved fine on its
own...

is there anythig wrong with the draw method of either
the pixmap (once it's raster has been defined)
or the raster itself (using a pixmap) ?

The original agent rasters are ZoomRasters,but that shouldn't matter (?)

Any suggestions on missing steps/typos/syntax on this approach? I can't
really draw everything *originally* in one display and then capture that
(the number of agents can vary), and perhaps I can use some image software
to combine the different pictures, but I should be able to do this with
Swarm...

Thanks in advance for any suggestions,

Aris Alissandrakis
Adaptive Systems Research Group
Department of Computer Science
University of Hertfordshire

Attachment: 0000000.png
Description: PNG image


reply via email to

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