[comp.os.msdos.programmer] Turbo C getimage

dbearly@vax1.tcd.ie (06/17/91)

Could someone please e-mail me the format of the image saved when I 
use the getimage(...) and putimage(...) functions of Turbo C's BGI
library?

E-mail is preferable but post if you have trouble!

Also how would I go about storing images within files, say within an
EXE file?
		Thanks

			Dom.    8-{0

dbearly@vax1.tcd.ie
dbearly@unix1.tcd.ie

frank@cavebbs.gen.nz (Frank van der Hulst) (06/18/91)

In article <1991Jun17.152139.1@vax1.tcd.ie> dbearly@vax1.tcd.ie writes:
>Could someone please e-mail me the format of the image saved when I 
>use the getimage(...) and putimage(...) functions of Turbo C's BGI
>library?

Its detailed in the manual -- 2 words giving width & height, followed by
data (1 bit per pixel for B/W, dunno about others). I think that there may
also be an extra word after the width and height.
>
>Also how would I go about storing images within files, say within an
>EXE file?

Here's what I did -- display the image on-screen and use getimage to capture
it, then write it to a file, still in binary. Next, write a wee program which
reads a binary file and writes it out in hex, including 0x before each byte,
and a comma after each... maybe also throw in some new-lines. At the beginning
of the text file, add (either with an editor, or by putting it in the filter
program) the following:

char XXXX[] = {

and at the end add

};

Now compile the file using Turbo C... that'll give you a .OBJ, which you can link
into your executable. (BTW, insert the correct name where I put XXXX above).

In the run-time version of the program, use putimage(XXXX) to display the image.

Frank.

-- 

Take a walk on the wild side, and I don't mean the Milford Track.
Kayaking: The art of appearing to want to go where your boat is taking you.

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (06/19/91)

In article <1991Jun18.015412.20940@cavebbs.gen.nz> frank@cavebbs.gen.nz (Frank van der Hulst) writes:
>In article <1991Jun17.152139.1@vax1.tcd.ie> dbearly@vax1.tcd.ie writes:
>>Could someone please e-mail me the format of the image saved when I 
>>use the getimage(...) and putimage(...) functions of Turbo C's BGI
>>library?
>
>Its detailed in the manual -- 2 words giving width & height, followed by
>data (1 bit per pixel for B/W, dunno about others). I think that there may
>also be an extra word after the width and height.

The format of the data is up to the .BGI driver, I think.  It tries for
whatever is most convenient for loading and storing, not necessarily
any standard form.

Duncan Murdoch