delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/11/11:43:08

From: elf AT netcom DOT com (Marc Singer)
Message-Id: <199606111539.IAA08233@netcom9.netcom.com>
Subject: Re: bmp file format
To: mkoch AT chemie DOT uni-bremen DOT de (Mathias Koch)
Date: Tue, 11 Jun 1996 08:39:42 -0700 (PDT)
In-Reply-To: <9606071033.AA21600@slater.chemie.uni-bremen.de> from "Mathias Koch" at Jun 7, 96 11:33:42 am
MIME-Version: 1.0
Sender: elf AT netcom DOT com

There is a design flaw in the BMP file format.  They chose to misalign
the BMPFILE structure such that the first WORD which contains the
letters "BM" can cause the rest of the structure to be offset by two
bytes.  The latest GNU C compiler (I believe) does not handle the
alignment attribute correctly, so you have to either write the first
two bytes and then the rest of the structure, or you may need to
switch compilers.  This all assumes that I have correctly identified
your problem.

> 
> I want to write a part of the graphic screen into a .bmp file. I changed the
> variable formats, I have found in a script, from 'DWORD' to 'unsigned long'
> and from 'WORD' to 'unsigned short', which should have the same length in bytes.
> 
> I found, that the bytes within the variables are disordered in the file and no
> graphic program can read my bmp files!
> 
> Can anyone help me, to fix this problem?
> 
> Mathias
> 


-- 
Marc Singer      |                     If you give it water, it'll turn green.
elf AT netcom DOT com   |

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019