swarm-support
[Top][All Lists]
Advanced

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

Movies


From: Jan Kreft
Subject: Movies
Date: Mon, 19 Jan 1998 13:53:41 +0000 (GMT)

Hi all,

I've spent some time to figure out how to make screenshots of a Raster
window. First I tried to put the code by Nelson and Benedikt into Raster
(from ZoomRaster) and got ppm files with just one color (black). This was
due to the fact that the buffer used for caching the pixmap was never
written to because the drawing routines of Gecko, which I'm using, do not
call the methods in [Zoom]Raster except -drawSelf. This is, I believe,
because Gecko draws circles which can't be done easily using the messages
in Raster. 

Anyway, I had to think of another way to do it. So I thought I could use a
method similar to -drawSelf but not writing to the screen but into a file.
The method looks like this (in Raster):

-writeBitmapToFile:  (char *) f {
  // adapted from Raster-drawSelf and ZoomRaster-writeSelfToFile:
  // from /usr/X11R6/man/man3/XCopyArea:
//        XCopyArea(display, src, dest, gc, src_x, src_y, width,
//        height,  dest_x, dest_y)
//              Display *display;
//              Drawable src, dest;
//              GC gc;
//              int src_x, src_y;
//              unsigned int width, height;
//              int dest_x, dest_y;
  // from /usr/X11R6/man/man3/XWriteBitmapFile:
//        int XWriteBitmapFile(display, filename, bitmap, width,
//        height, x_hot, y_hot)
//              Display *display;
//              char *filename;
//              Pixmap bitmap;
//              unsigned int width, height;
//              int x_hot, y_hot;

  int result;
  char * fileName = f;

  // these two calls are the gist of -drawSelf
  //XCopyArea(display, pm, xwin, gc, 0, 0, width, height, 0, 0);
  //XFlush(display);

  result = XWriteBitmapFile(display, fileName, pm, width, height, -1, -1);
  return self;
}

Result is, I get an all-white pixmap (GUI running, screen display fine).
Problem is, I don't know anything about Xlib programming. So I tried
calling XCopyArea and/or XFlush before calling XWriteBitmapFile, but to no
avail. Now I hope someone spots an obvious error or suggests what might be
wrong. Are there other general ways to make a screenshot when the drawing
is done outside Swarm???

Thanks,

Jan.

Jan Kreft                       Phone +44 1222 874000 x6036
Biology                         Fax   +44 1222 874305
University of Wales Cardiff     E-mail address@hidden
PO Box 915, Cardiff CF1 3TL, UK




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