Mail Archives: djgpp/1998/08/15/01:30:46
From: | Endlisnis <s257m AT unb DOT ca>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: displaying a bmp
|
Date: | Thu, 13 Aug 1998 12:33:42 -0300
|
Organization: | NBTel Internet
|
Lines: | 40
|
Message-ID: | <35D30756.63EEF1F3@unb.ca>
|
References: | <35D2B912 DOT 3F40D6C8 AT xyz DOT net>
|
NNTP-Posting-Host: | fctnts10c46.nbnet.nb.ca
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Bjorn Hansen wrote:
> void set_mode(int mode)
> {
> __dpmi_regs r;
> r.x.ax = mode;
> __dpmi_int(0x10, &r);
> };
>
> void main()
> {
> char smiley[320*200];
> FILE *pict= fopen("C:\\Cstuff\\smibm.bmp","rb");
> set_mode(VGA_13h);
>
> dosmemput(pict+128,320*200,0xA0000);
> while(!kbhit());
> set_mode(TEXT);
> }
1] Your set_mode function should have a line like:
memset(&r, 0, sizeof(r));
or you might get unexpected (and undesired) results occationally.
2] All you've done is open the file, you never read any data from it.
3] Bitmap files are not just a series of pixel values, they have many
different possible styles (and bit-depths), and some are even
run-length
encoded and stuff like that. You can't just read it directly to the
screen,
you have to interpret the data. And you also have to worry about palettes.
4] I think that bit-maps are stored back-wards or up-side-down (I can't
remember which).
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlis AT nbnet DOT nb DOT ca
- Raw text -