Re: working with bitmaps in C



On Dec 26, 4:48 am, "Malcolm McLean" <regniz...@xxxxxxxxxxxxxx> wrote:
"Ernie Wright" <ern...@xxxxxxxxxxx> wrote in message

Broken for 24-bit and 32-bit, and for 4-bit old-style.  See below.

No, it's been tested and basically works. It might not work on everything,
but it will load the vast majority of BMPs OK.

This description is inadequate for an API function.  What loadbmp()
returns is a 24-bit bitmap written as an array of 3-byte pixels in BGR
order, with row span of 3 * width, and origin in the upper left corner
of the image.  Callers need this level of detail in order to know how
to use what loadbmp() returns.

No, in rgb order. As is the palette. However that proves your point that the
comment is inadequate. Most of the bug reports are based on that
misunderstanding.
The exception is passing a 256 palette size here.

/* 4 bit bitmaps */
 if(bmpheader.core)
  loadpalettecore(fp, pal, 256);
   else
  loadpalette(fp, pal, bmpheader.palsize);

I think there's some problem with old BMPs which have core rather than
proper palette sizes. It's a while since I wrote that code, it might have
been that I had a degenerate BMP as the test case . Maybe you need to
calculate the palette size from the raster offset, if you can trust it.

Thanks for taking the time to comment, however.

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

Malcolm,

I had a few questions about your code. The images that I need to load
in I know are 8bit images and are 1280x960. Since I am unfamiliar with
the inner workings of bmp images can you provide further guidance
regarding the use of your code to read in the images? The code you
provided looks like it would work for what I need just not sure how to
approach it.
.



Relevant Pages

  • Re: working with bitmaps in C
    ... It might not work on everything, but it will load the vast majority of BMPs OK. ... The exception is passing a 256 palette size here. ... I think there's some problem with old BMPs which have core rather than proper palette sizes. ...
    (comp.lang.c)
  • Re: Question Creating movie file from images.
    ... Win32 SDK. ... I have some 100 bitmap/JPEG images in a folder. ... You can store the BMPs into an uncompressed AVI file using ... You can also store the JPEGs instead of the BMPs, ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Suddenly Cant Save JPGs
    ... | The strangest thing happened this morning --- I suddenly can't save images ... | as JPGs, only BMPs. ...
    (microsoft.public.windowsxp.photos)
  • Re: Suddenly Cant Save JPGs
    ... | The strangest thing happened this morning --- I suddenly can't save images ... | as JPGs, only BMPs. ...
    (microsoft.public.windowsxp.photos)
  • Create WMV from sequence of images
    ... The WMV must ... I've experimented with the WME SDK and have tried modifying many of its VB6 ... the audio and video (i.e. images) to encode into a WMV; ... high-quality WMV out of a sequence of BMPs? ...
    (microsoft.public.windowsmedia.sdk)