# To subscribers of the xforms list from jprinos@dehavilland.ca :
Sorry, I don't have my XForms manual in front of me.
What does:
flimage_getmem( im );
do again? If I remember correctly, it allocates memory for the image size
and type.
The fact that you're not setting the pixel values to anything shouldn't be
causing your problem...
John
p.s. did you intend to code this:
im->w = w;
im->h = w; <<<<<< intended to be h?
Jens Thoms Toerring <Jens.Toerring@physik.fu-berlin.de>@bob.usuhs.mil on
03/03/2002 11:45:57 AM
Please respond to xforms@bob.usuhs.mil
Sent by: owner-xforms@bob.usuhs.mil
To: xforms@bob.usuhs.mil
cc:
Subject: XForms: flimage problem
# To subscribers of the xforms list from Jens Thoms Toerring
<Jens.Toerring@physik.fu-berlin.de> :
Hi,
I am trying to dump a pixmap to a file. I found the flimage stuff and
it looks (more or less) exactly like what I need. Unfortunately, I am
obviously too stupid to understand the manual. Here is the function I am
trying to use:
int dump_pixmap( Pixmap p, int w, int h )
{
FL_IMAGE *im;
char name[ ] = "A.gif";
if ( ( im = flimage_alloc( ) ) == NULL )
return 0;
im->type = FL_IMAGE_RGB;
im->w = w;
im->h = w;
flimage_getmem( im );
flimage_from_pixmap( im, p );
flimage_dump( im, name, "GIF" );
flimage_free( im );
return 1;
}
Dumping the pixmap to a file still works but when calling flimage_free()
I get a segmentation fault. I guess that I've been meddling with memory
I didn't allocate (at least the manual says that "'im' must be a properly
allocated image" but I guess I am not correctly understanding what
"properly" means in this context). Can anyone tell me were I am going
wrong? I am quite convinced that the pixmap I am passing to the function
as well as its dimensions are ok.
Thanks, Jens
PS: Would it be very difficult to add another function for dumping
images that does not expect a file name but an already open
file descriptor or stream instead?
-- _ _____ _____ | ||_ _||_ _| Jens.Toerring@physik.fu-berlin.de _ | | | | | | AG Moebius, Institut fuer Molekuelphysik | |_| | | | | | Fachbereich Physik, Freie Universitaet Berlin \___/ens|_|homs|_|oerring Tel: ++49 (0)30 838 - 53394 / FAX: - 56046 _________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuhs.mil or see http://bob.usuhs.mil/mailserv/xforms.html XForms Home Page: http://world.std.com/~xforms List Archive: http://bob.usuhs.mil/mailserv/list-archives/_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuhs.mil or see http://bob.usuhs.mil/mailserv/xforms.html XForms Home Page: http://world.std.com/~xforms List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Wed May 01 2002 - 13:54:15 EDT