Re: working with bitmaps in C
- From: "Malcolm McLean" <regniztar@xxxxxxxxxxxxxx>
- Date: Wed, 26 Dec 2007 09:48:24 -0000
"Ernie Wright" <erniew@xxxxxxxxxxx> wrote in message
No, it's been tested and basically works. It might not work on everything, but it will load the vast majority of BMPs OK.
Broken for 24-bit and 32-bit, and for 4-bit old-style. See below.
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.
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.
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
.
- Follow-Ups:
- Re: working with bitmaps in C
- From: Ernie Wright
- Re: working with bitmaps in C
- From: Stephen . Schoenberger
- Re: working with bitmaps in C
- 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
- working with bitmaps in C
- Prev by Date: Re: read image from url
- Next by Date: Re: Making C better (by borrowing from C++)
- Previous by thread: Re: working with bitmaps in C
- Next by thread: Re: working with bitmaps in C
- Index(es):
Relevant Pages
|