
|
[arachne]
||
[Date Prev]
[05-2004 Date Index]
[Date Next]
||
[Thread Prev]
[05-2004 Thread Index]
[Thread Next]
[arachne] Re: skewed BMPs.....
- From: "Michal H. Tyc" <mht@xxxxxxxxxxxxxxxx>
- To: arachne@xxxxxxxxxxxxx
- Date: Sat, 08 May 2004 15:07:54 +0200
Arachne at FreeLists---The Arachne Fan Club!
Hi Glenn,
>> Michal,
>> After reading your message, I went to see if I could fix it also.
>> Did I come-up-with the same fix as you ?
>> if(type==4)
>> {
>> k=bmp->size_x%8;
>> //!!glennmcc: May 07, 2004 -- Michal Tyc pointed out this error
>> // in rounding which causes some BMPs to be 'skewed' when displayed
>> linebytes=(bmp->size_x+k)/2;
>> // linebytes=bmp->size_x/2;
>> }
Not exactly, although the 'mathematical' effect is identical (line
length is rounded up to the next multiply of 4 bytes). Here is my
code to replace a larger piece of HDRAWBMP.C, somewhat reformatted
for clarity:
{
int l; // local to help making it register
l = bmp->size_x; // assume 8 bits per pixel (256 colors)
if (type == 4) // 4 bits per pixel (16 colors):
l = (l + 1) >> 1; // convert nibbles to bytes
else if (type == 24) // 24 bits per pixel (truecolor):
l *= 3; // convert RGB triples to bytes
else if (type != 8) // unsupported (as bmpmono 1 bit per pixel)
goto err;
linebytes = (l + 3) & ~3; // round up to next doubleword boundary
}
Arachne at FreeLists
-- Arachne, The Web Browser/Suite for DOS and Linux --
|

|