• Advertisement

Archived

This topic is now archived and is closed to further replies.

does directDraw have problem with.........??

This topic is 5157 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello... I am having a serious problem. Does DirectDraw have problems with images whose width or height is an odd number of pixels? I am having several images. Those that are 40*40 work perfectly. but thoese that are 53*53, don''t show at all! what is going wrong! Are there any solutions? Thank you very much in advance...

Share this post


Link to post
Share on other sites
Advertisement
If you've written (or copied) a function to load bitmaps it's probably there you'll find the problem. Bitmaps are padded to 4 byte alignment in each row, which means no padding for bitmaps with a width that's evenly divisible by 4 but possibly some padding for other widths (depends on the image depth as well). MSDN describes this in more detail, but if you're not really interested, the simple solution is to read one scanline, skip 4 - (bytesperline % 4) bytes, read the next line and so on, instead of reading all of the image data in one turn.

[edited by - JakobM on January 13, 2004 1:10:26 AM]

Share this post


Link to post
Share on other sites
Careful, 4 - (bytesperline % 4) is not correct when bytesperline is already divisible by four.
I always try to use a simple single line formula too, and screw up too

Share this post


Link to post
Share on other sites
quote:
Original post by Endurion
Careful, 4 - (bytesperline % 4) is not correct when bytesperline is already divisible by four.


Aye, that''s right. My bad

Share this post


Link to post
Share on other sites
DirecDraw Blt and BltFast can hanbdle anything you throw at them, it's most likely your BMP loading routine that can't handle the padding correctly.

See this for a great BMP loader.
Big Sassys BMP loading tutorial

[edited by - Bad Maniac on January 13, 2004 10:28:59 AM]

Share this post


Link to post
Share on other sites

  • Advertisement