Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!bcm!etaylor From: etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) Newsgroups: comp.windows.x Subject: Re: Message-ID: <3099@gazette.bcm.tmc.edu> Date: 6 Dec 90 18:38:04 GMT References: <9012061432.AA08997@expo.lcs.mit.edu> Sender: usenet@bcm.tmc.edu Reply-To: etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) Organization: Baylor College of Medicine, Houston, Tx Lines: 23 Nntp-Posting-Host: wilkins.iaims.bcm.tmc.edu In article <9012061432.AA08997@expo.lcs.mit.edu>, PATERNO@ICNUCEVM.CNUCE.CNR.IT writes: |> The Xlib - C Language X Interface states that the function |> XCreateImage "allocates the memory needed for an XImage structure".... |> ..."but doesn't allocate space for the image itself." |> How can we determine the amount of space to be allocated for image |> data in the various formats (XY* or Z*)? |> i.e. if I have to display an image in a say 600x600 pixels window |> how many bytes I need to allocate? When you create the image, use NULL for the data argument. After it is created fill in data field with: image->data = malloc(image->height * image->bytes_per_line) ; I believe that this is the easiest and safest method. It was unfortunate that X did not provide a function that allocated the data for you. -- Eric Taylor Baylor College of Medicine etaylor@wilkins.bcm.tmc.edu (713) 798-3776