[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: 16bpp bmp error
From: "Greg Haerr" ####@####.#### Date: 31 Aug 2006 07:51:03 +0100 Message-Id: <027601c6ccc9$c2362920$6401a8c0@winXP> > i rewrote the image loading routine for bmp so that , instead of allocating the entire image memory , allocate for one row of data and resize it to the destination image . I am able to read and write the 8,24 bmp images correctly , but 16-bpp images are not resizing properly. Am i missing something ... help needed. case 2:{ unsigned short pixel = 0; pos1 = 0x10000; for ( i = dstwidth; i >= 0; --i ) { while ( pos1 >= 0x10000L ) { pixel = *srcp++; pos1 -= 0x10000L; } *dstp++ = pixel; pos1 += inc1; } } break; ***** In the above routine for the 16 bpp case, you're writing only a single byte (*dstp++ = pixel), when you need to be writing 2 bytes for the 16 bpp case. Check out how three bytes are written (r,g,b) in the "case 3:" below for 24 bpp. This will fix your problem. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |