Archived

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

Stretching a Bitmap

This topic is 5382 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

I use a library called SDL (www.libsdl.com) it uses videomemory exactly like directdraw but there is no way to stretch bitmaps, there is a way to setpixels and blt normally, if someone out there knows exactly how stretchblting is accomplished (in plain english would work just fine) i just need to understand how it works then I can make an algo for it. Thanks

Share this post


Link to post
Share on other sites
i never used SDL, but: stretching a bitmap is actually a hard task. you can make it simple by stretching the bitmap with a bresenham-like function with error terms for x/y axis, which is easy to code, but the visual quality will be bad when the bitmap gets too large, so you will have to introduce some sort of filter (which is usually slow). does SDL have 3D functions (for bilinear filtered polygons and so on)?

hope this helps

Share this post


Link to post
Share on other sites
It has no 3D functions, you can init OpenGL but I know didly about OpenGL so I would rather stay away from that. Can you go into more detail about that bresehen-like function?

Share this post


Link to post
Share on other sites
i show you the code to it because my english sucks and i''m not good in explaining algorithms :-)

fastBitmap


this will do the job, but as said it will look a bit ugly without filtering. maybe you consider using a real texturemapping algorithm later on, you''d also get sprite rotation for free!

hope this helps

Share this post


Link to post
Share on other sites
I''ve gotten it to stretch using a pixel by pixel loop and stretching the pixel color into a rectangle but it wont shrink. do you know how to do that?

Share this post


Link to post
Share on other sites