Re: working with bitmaps in C
- From: Stephen.Schoenberger@xxxxxxxxx
- Date: Wed, 26 Dec 2007 13:34:26 -0800 (PST)
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.
.
- References:
- working with bitmaps in C
- From: Stephen . Schoenberger
- Re: working with bitmaps in C
- From: Malcolm McLean
- Re: working with bitmaps in C
- From: Ernie Wright
- Re: working with bitmaps in C
- From: Malcolm McLean
- working with bitmaps in C
- Prev by Date: Re: Making a program pause
- Next by Date: Re: Programming in standard c
- Previous by thread: Re: working with bitmaps in C
- Next by thread: Re: working with bitmaps in C
- Index(es):
Relevant Pages
|