Re: working with bitmaps in C




"Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote in message
Malcolm McLean wrote, On 27/12/07 17:16:
Actually, the best thing is normally to start off by checking the length is within a valid range, then check the data is valid, then check that you hit a valid tag in the place expected. If any of those things fail you report the file as being corrupt or a format you can't handle.

The object of the exercise is to read the data, not to check the file for adherence to the format.

That's a good point. It should be returning -1 instead of zero on an unrecognised header size, at least. Probably we should try to read it as a 40. However to do a really good job we've got to skip to the raster bits, which means a total rewrite and lots of complications.

Don't advertise your code as being reliable then, advertise it as supporting some but not all BMP files.

The question is what to do with as yet unspecified versions. Presumably MS will extend the header field, maybe add new chunks. The question is whether the raster data will still be readable without the new information, and it is impossible for MS to guarantee that, because they won't change the format for fun, but because some need arises.
I should be able to read every current format, barring bugs, but some are obsolete.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

.



Relevant Pages

  • Re: OT-Did R4 lie?
    ... I think I knew I'd missed Murder Must Advertise. ... I wouldn't mind the other. ... Thanks, could you bring it along in some format, CDROM or USB stick? ...
    (uk.media.radio.archers)
  • Re: working with bitmaps in C
    ... If any of those things fail you report the file as being corrupt or a format you can't handle. ... The object of the exercise is to read the data, not to check the file for adherence to the format. ... Don't advertise your code as being reliable then, advertise it as supporting some but not all BMP files. ...
    (comp.lang.c)
  • Re: printing from plot files
    ... depends on the format of the content, ... data) resp. ... hp-rtl (raster data) format and using a compatible large ...
    (comp.cad.autocad)
  • Re: Printer UniDrv
    ... The CmdSendBlockData just sends instructions to the printer as to what the ... format of the raster data being sent is. ... It doesn't modify the raster image being sent. ... If you need to modify the raster data, you may need to create a rendering ...
    (microsoft.public.development.device.drivers)