swarm-support
[Top][All Lists]
Advanced

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

Pixmap movies: Bug (fixed)


From: Sven N. Thommesen
Subject: Pixmap movies: Bug (fixed)
Date: Tue, 01 Sep 1998 12:09:50 -0500

I seem to be the first to try the new movie-making feature of Pixmap. I
have discovered two possible bugs, and solutions to them.

#1#
In HeatbugObserverSwarm.m, we find the following code in method _update_ :

#ifdef SCREENSHOTS
    {
      char filename[40];
      sprintf(filename,"heatbugs%07d.png",getCurrentTime());
      [[[Pixmap create: [self getZone[ widget: nil] save: filename] drop];
    }
#endif

If you try to compile heatbugs with 'make CPPFLAGS=-DSCREENSHOTS', as
suggested in the README file, you find out that the observerswarm will not
compile. The reason is that Pixmap does not have a method 'create:widget:'.
The following less compact code will do it:

#ifdef SCREENSHOTS
    {
      char filename[40];
      id <Pixmap> pixmap;
      sprintf(filename,"heatbugs%04u.png",getCurrentTime());
      pixmap = [Pixmap createBegin: [self getZone]];
      [pixmap setWidget: nil];
      pixmap = [pixmap createEnd];
      [pixmap save: filename];
      [pixmap drop];
   }

The program now compiles, and produces a snapshot of the complete screen
(the root window) each time period (since there is a call to _update_
scheduled each time period; see method -buildActions).

#2#
But what if we want a snapshot of the bug raster only? We replace [pixmap
setWidget: nil] with [pixmap setWidget: worldRaster]. And discover another
problem: running the program, we get an X error message and a core dump.

The problem appears to be that at t=0, when _update_ is called, the world
raster has not yet been 'packed' and displayed on the screen, and as a
result there is nothing to be saved to disk. I have found two possible
solutions:

a) insert the line 'if (getCurrentTime() > 0)' right after '#ifdef
SCREENSHOTS';

b) move the code above into a separate _makeMovie_ method, and in method
-buildActions, schedule the following call:

        [displayActions createActionTo: self message: M(_makeMovie_)];

*after* this line:
        [displayActions createActionTo: actionCache message: M(doTkEvents)];


Happy movie-making!
Sven Thommesen


                  ==================================
   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]